/* Xengine Documentation - Modern Dark Theme */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.3);
    --secondary: #10b981;
    --accent: #8b5cf6;
    --bg-dark: #0a0a0a;
    --bg-darker: #000000;
    --bg-card: #141414;
    --bg-card-hover: #1a1a1a;
    --bg-code: #0d0d0d;
    --text: #f5f5f5;
    --text-muted: #a3a3a3;
    --text-dim: #737373;
    --border: #262626;
    --border-light: #333333;
    --sidebar-width: 280px;
    --header-height: 60px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.7;
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-darker);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.logo {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.logo h1 span {
    color: var(--primary);
}

.logo .version {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 4px;
    font-weight: 500;
}

.search-box {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.search-box input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

.search-box input::placeholder {
    color: var(--text-dim);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.nav-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.nav-links {
    list-style: none;
}

.nav-section {
    padding: 16px 20px 8px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    font-weight: 600;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--transition-fast);
    border-left: 2px solid transparent;
}

.nav-links a:hover {
    background: var(--bg-card);
    color: var(--text);
}

.nav-links a.active {
    background: var(--bg-card);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-links a .nav-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

/* Main Content */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    height: var(--header-height);
    padding: 0 40px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-darker);
    display: flex;
    align-items: center;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--transition-fast);
}

.menu-toggle:hover {
    background: var(--bg-card);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-fast);
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb span {
    color: var(--text-dim);
}

article {
    flex: 1;
    padding: 48px;
    max-width: 900px;
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 48px 0 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    letter-spacing: -0.02em;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 32px 0 16px;
    color: var(--text);
}

h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 24px 0 12px;
    color: var(--text-muted);
}

p {
    margin-bottom: 16px;
    color: var(--text-muted);
}

.lead {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    line-height: 1.8;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin: 32px 0;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: var(--transition-normal);
}

.feature-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-darker);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--primary);
    font-size: 1.25rem;
}

.feature-card h3 {
    margin: 0 0 8px;
    font-size: 1rem;
    color: var(--text);
}

.feature-card p {
    color: var(--text-dim);
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.6;
}

/* Code Blocks */
pre {
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    overflow-x: auto;
    margin: 20px 0;
    position: relative;
}

pre::before {
    content: attr(data-language);
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
}

:not(pre) > code {
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--secondary);
    font-size: 0.85em;
}

/* Copy Button */
.code-block {
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0;
    transition: var(--transition-fast);
}

.code-block:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text);
}

.copy-btn.copied {
    color: var(--secondary);
}

/* Tables */
.api-table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 0.875rem;
}

.api-table th,
.api-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.api-table th {
    background: var(--bg-card);
    font-weight: 600;
    color: var(--text);
}

.api-table tr:hover td {
    background: var(--bg-card);
}

.api-table td code {
    font-size: 0.8rem;
}

/* Method Signatures */
.method-signature {
    background: var(--bg-card);
    padding: 16px 20px;
    border-radius: 8px;
    border-left: 3px solid var(--primary);
    margin: 24px 0 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    overflow-x: auto;
}

.method-signature .keyword {
    color: var(--accent);
}

.method-signature .type {
    color: var(--primary);
}

.method-signature .method-name {
    color: var(--secondary);
}

.method-signature .param {
    color: var(--text-muted);
}

/* Parameters Table */
.param-table {
    width: 100%;
    margin: 16px 0;
    border-collapse: collapse;
}

.param-table th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
}

.param-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.param-table td:first-child code {
    color: var(--primary);
}

/* Returns Box */
.returns {
    background: var(--bg-card);
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
    border-left: 3px solid var(--secondary);
}

.returns-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--secondary);
    margin-bottom: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: var(--transition-fast);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    color: var(--text);
}

.btn-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 24px 0;
}

/* Info Boxes */
.info-box {
    padding: 16px 20px;
    border-radius: 8px;
    margin: 24px 0;
    border-left: 3px solid;
    display: flex;
    gap: 12px;
}

.info-box-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.info-box-content {
    flex: 1;
}

.info-box-content p {
    margin: 0;
    color: var(--text-muted);
}

.info-box-content p:first-child {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.info-box.tip {
    background: rgba(16, 185, 129, 0.08);
    border-color: var(--secondary);
}

.info-box.warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: #f59e0b;
}

.info-box.note {
    background: rgba(59, 130, 246, 0.08);
    border-color: var(--primary);
}

.info-box.danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: #ef4444;
}

/* Module Cards */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 32px 0;
}

.module-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: var(--transition-normal);
    text-decoration: none;
    display: block;
}

.module-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.module-card h3 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 1.1rem;
}

.module-card p {
    margin: 0;
    color: var(--text-dim);
    font-size: 0.875rem;
}

.module-card .module-meta {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 16px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Example Cards */
.example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 32px 0;
}

.example-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition-normal);
}

.example-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.example-card-header {
    padding: 16px 20px;
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.example-card-header h4 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text);
}

.example-card-header .tag {
    font-size: 0.7rem;
    padding: 4px 8px;
    background: var(--primary-glow);
    color: var(--primary);
    border-radius: 4px;
}

.example-card pre {
    margin: 0;
    border: none;
    border-radius: 0;
}

/* TOC */
.toc {
    position: sticky;
    top: calc(var(--header-height) + 32px);
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    max-height: calc(100vh - var(--header-height) - 64px);
    overflow-y: auto;
}

.toc h4 {
    margin: 0 0 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.toc ul {
    list-style: none;
}

.toc a {
    display: block;
    padding: 6px 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

.toc a:hover {
    color: var(--primary);
}

.toc a.active {
    color: var(--primary);
}

/* Footer */
footer {
    padding: 32px 48px;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.875rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

footer a {
    color: var(--text-muted);
}

footer a:hover {
    color: var(--primary);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease forwards;
}

.animate-slide-in {
    animation: slideIn 0.3s ease forwards;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    article {
        padding: 24px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 640px) {
    .feature-grid,
    .module-grid,
    .example-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    footer {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
}

/* Hero Showcase */
.hero-showcase {
    text-align: center;
    padding: 40px 0;
    margin-bottom: 40px;
}

.hero-logo {
    margin-bottom: 32px;
}

.hero-logo img {
    max-width: 200px;
    height: auto;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.hero-showcase h1 {
    margin-bottom: 16px;
}

.hero-showcase .lead {
    max-width: 600px;
    margin: 0 auto 24px;
}

/* Gameplay Showcase */
.gameplay-showcase {
    margin: 48px 0;
    padding: 32px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.gameplay-showcase h2 {
    text-align: center;
    margin-top: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.showcase-main {
    display: flex;
    justify-content: center;
    margin: 32px 0;
}

.gameplay-gif {
    max-width: 100%;
    width: 700px;
    border-radius: 12px;
    border: 2px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: var(--transition-normal);
}

.gameplay-gif:hover {
    transform: scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 25px 80px rgba(59, 130, 246, 0.2);
}

.showcase-gallery {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 24px;
}

.showcase-gallery img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition-fast);
}

.showcase-gallery img:hover {
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
    .showcase-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .showcase-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero-logo img {
        max-width: 150px;
    }
}

/* Utility Classes */
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
