/* =============================================================================
   JWT-HACK Documentation — Green Dark Theme (GitButler-style)
   ============================================================================= */

/* --- Google Fonts --- */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap");

/* --- Color Tokens --- */
:root {
    --primary: #22c55e;
    --primary-hover: #16a34a;
    --primary-light: #86efac;
    --primary-dark: #15803d;
    --primary-subtle: rgba(34, 197, 94, 0.1);
    --primary-border: rgba(34, 197, 94, 0.3);
}

[data-theme="dark"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-card: #161616;
    --bg-code: #0d0d0d;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border-color: #27272a;
    --border-subtle: #1f1f23;
    --header-bg: rgba(10, 10, 10, 0.8);
    --sidebar-bg: #0f0f0f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-card: #ffffff;
    --bg-code: #f8f9fa;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --border-subtle: #f3f4f6;
    --header-bg: rgba(255, 255, 255, 0.8);
    --sidebar-bg: #f9fafb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* --- Layout Tokens --- */
:root {
    --header-h: 60px;
    --sidebar-w: 280px;
    --content-max-w: 820px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* --- Reset --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- Base --- */
html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Links --- */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--primary-hover);
}

/* =============================================================================
   Header — fixed glassmorphism
   ============================================================================= */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.header-logo img {
    height: 50px;
    width: auto;
}

.header-logo .logo-dark {
    display: block;
}
.header-logo .logo-light {
    display: none;
}
[data-theme="light"] .header-logo .logo-dark {
    display: none;
}
[data-theme="light"] .header-logo .logo-light {
    display: block;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.header-nav a {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.header-nav a:hover {
    color: var(--text-primary);
    background: var(--primary-subtle);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.version-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--primary-subtle);
    color: var(--primary);
    border: 1px solid var(--primary-border);
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.4rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary-border);
    background: var(--primary-subtle);
}

.theme-toggle .icon-sun {
    display: none;
}
.theme-toggle .icon-moon {
    display: block;
}
[data-theme="light"] .theme-toggle .icon-sun {
    display: block;
}
[data-theme="light"] .theme-toggle .icon-moon {
    display: none;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.4rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
}

/* =============================================================================
   Layout Container
   ============================================================================= */
.docs-layout {
    display: flex;
    padding-top: var(--header-h);
    min-height: 100vh;
}

/* =============================================================================
   Sidebar — fixed left
   ============================================================================= */
.docs-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: var(--sidebar-w);
    height: calc(100vh - var(--header-h));
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 1.25rem 0.75rem;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
}

.docs-sidebar::-webkit-scrollbar {
    width: 4px;
}
.docs-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.docs-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.sidebar-section {
    margin-bottom: 1.25rem;
}

.sidebar-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.25rem 0.75rem;
    margin-bottom: 0.25rem;
}

.sidebar-links {
    list-style: none;
}
.sidebar-links li {
    margin-bottom: 1px;
}

.sidebar-links a {
    display: block;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    border-left: 2px solid transparent;
}

.sidebar-links a:hover {
    color: var(--text-primary);
    background: var(--primary-subtle);
}

.sidebar-links a.active {
    color: var(--primary);
    background: var(--primary-subtle);
    border-left-color: var(--primary);
    font-weight: 500;
}

.sidebar-sublinks {
    list-style: none;
    padding-left: 0.75rem;
}
.sidebar-sublinks a {
    font-size: 0.8rem;
}

/* =============================================================================
   Main Content
   ============================================================================= */
.docs-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 2rem 3rem 4rem;
    max-width: calc(var(--content-max-w) + var(--sidebar-w) + 6rem);
    min-height: calc(100vh - var(--header-h));
}

.docs-content {
    max-width: var(--content-max-w);
}

/* =============================================================================
   Typography
   ============================================================================= */
.docs-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 1.5rem 0;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.docs-content h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 2.5rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    letter-spacing: -0.01em;
}

.docs-content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem 0;
}

.docs-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.5rem 0;
}

.docs-content p {
    margin-bottom: 1rem;
}

.docs-content ul,
.docs-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.docs-content li {
    margin-bottom: 0.35rem;
}

.docs-content strong {
    font-weight: 600;
}

.docs-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

.docs-content blockquote {
    border-left: 3px solid var(--primary);
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    background: var(--primary-subtle);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* --- Tables --- */
.docs-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.docs-content th,
.docs-content td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border: 1px solid var(--border-color);
}

.docs-content th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.85rem;
}

.docs-content tr:hover {
    background: var(--bg-secondary);
}

/* --- Code --- */
.docs-content code {
    font-family:
        "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 0.85em;
    background: var(--bg-tertiary);
    color: var(--primary-light);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

[data-theme="light"] .docs-content code {
    color: var(--primary-dark);
}

.docs-content pre {
    background: var(--bg-code);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 1rem 0;
    line-height: 1.5;
}

.docs-content pre code {
    background: none;
    color: var(--text-primary);
    padding: 0;
    font-size: 0.85rem;
}

/* --- Images --- */
.docs-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

/* =============================================================================
   Section List (for section.html)
   ============================================================================= */
ul.section-list {
    list-style: none;
    padding: 0;
}

ul.section-list li {
    margin-bottom: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

ul.section-list li:hover {
    border-color: var(--primary-border);
    background: var(--primary-subtle);
}

ul.section-list li a {
    font-weight: 500;
}

/* =============================================================================
   Pagination
   ============================================================================= */
nav.pagination {
    margin: 2rem 0;
}

nav.pagination .pagination-list {
    list-style: none;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

nav.pagination a {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

nav.pagination a:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.pagination-current span {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--primary);
    background: var(--primary-subtle);
    color: var(--primary);
    font-size: 0.875rem;
}

/* =============================================================================
   Alert / Info Boxes
   ============================================================================= */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin: 1rem 0;
    border-left: 4px solid;
    font-size: 0.9rem;
}

.alert-info,
.alert[data-type="info"] {
    background: rgba(34, 197, 94, 0.08);
    border-color: var(--primary);
    color: var(--text-primary);
}

.alert-warning,
.alert[data-type="warning"] {
    background: rgba(234, 179, 8, 0.08);
    border-color: #eab308;
    color: var(--text-primary);
}

.alert-error,
.alert[data-type="error"],
.alert[data-type="danger"] {
    background: rgba(239, 68, 68, 0.08);
    border-color: #ef4444;
    color: var(--text-primary);
}

.alert-tip,
.alert[data-type="tip"] {
    background: rgba(59, 130, 246, 0.08);
    border-color: #3b82f6;
    color: var(--text-primary);
}

.alert strong {
    display: block;
    margin-bottom: 0.25rem;
}

/* =============================================================================
   Buttons
   ============================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: #fff;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-subtle);
}

/* =============================================================================
   Landing Page — Hero
   ============================================================================= */
.landing-hero {
    position: relative;
    text-align: center;
    padding: 5rem 2rem 4rem;
    background: radial-gradient(
        ellipse at 50% 0%,
        rgba(34, 197, 94, 0.12) 0%,
        transparent 60%
    );
    border-bottom: 1px solid var(--border-color);
}

.landing-hero .hero-badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    background: var(--primary-subtle);
    color: var(--primary);
    border: 1px solid var(--primary-border);
    margin-bottom: 1.5rem;
}

.landing-hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.landing-hero h1 .highlight {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-hero .hero-desc {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.hero-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

/* --- Terminal Mockup --- */
.terminal-mockup {
    max-width: 600px;
    margin: 0 auto;
    background: #0d0d0d;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-align: left;
    box-shadow: var(--shadow-lg);
}

[data-theme="light"] .terminal-mockup {
    background: #1e1e1e;
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.75rem 1rem;
    background: #161616;
    border-bottom: 1px solid #27272a;
}

[data-theme="light"] .terminal-header {
    background: #2d2d2d;
    border-bottom-color: #3d3d3d;
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.terminal-dot.red {
    background: #ff5f57;
}
.terminal-dot.yellow {
    background: #febc2e;
}
.terminal-dot.green {
    background: #28c840;
}

.terminal-body {
    padding: 1rem 1.25rem;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #e4e4e7;
}

.terminal-body .prompt {
    color: var(--primary);
}
.terminal-body .cmd {
    color: #fafafa;
}
.terminal-body .comment {
    color: #71717a;
}

/* =============================================================================
   Landing Page — Features
   ============================================================================= */
.landing-features {
    padding: 4rem 2rem;
    max-width: 1100px;
    margin: 0 auto;
}

.landing-features .section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.landing-features .section-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    border: none;
    padding: 0;
}

.landing-features .section-header p {
    color: var(--text-secondary);
    max-width: 550px;
    margin: 0 auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all var(--transition-normal);
}

.feature-card:hover {
    border-color: var(--primary-border);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.feature-card .feature-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--primary-subtle);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* =============================================================================
   Landing Page — CTA
   ============================================================================= */
.landing-cta {
    padding: 3rem 2rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: radial-gradient(
        ellipse at 50% 100%,
        rgba(34, 197, 94, 0.06) 0%,
        transparent 60%
    );
}

.landing-cta h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    border: none;
    padding: 0;
}

.landing-cta p {
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto 1.5rem;
}

/* =============================================================================
   Footer
   ============================================================================= */
.site-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.site-footer a {
    color: var(--text-secondary);
}
.site-footer a:hover {
    color: var(--primary);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-content .separator {
    opacity: 0.4;
}

.footer-logo {
    height: 24px;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}
.footer-logo:hover {
    opacity: 1;
}

/* =============================================================================
   404 Page
   ============================================================================= */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 2rem;
}

.error-page h1 {
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.error-page p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* =============================================================================
   Responsive — Tablet (1024px)
   ============================================================================= */
@media (max-width: 1024px) {
    .docs-sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        z-index: 500;
        background: var(--bg-primary);
    }

    .docs-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .docs-main {
        margin-left: 0;
        padding: 2rem 2rem 4rem;
        max-width: 100%;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =============================================================================
   Responsive — Mobile (768px)
   ============================================================================= */
@media (max-width: 768px) {
    .site-header {
        padding: 0 1rem;
    }

    .header-nav {
        display: none;
    }

    .docs-main {
        padding: 1.5rem 1rem 3rem;
    }

    .landing-hero {
        padding: 3rem 1.5rem 2.5rem;
    }
    .landing-hero h1 {
        font-size: 2rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .docs-content h1 {
        font-size: 1.6rem;
    }
    .docs-content h2 {
        font-size: 1.25rem;
    }

    .docs-content pre {
        padding: 0.75rem;
        font-size: 0.8rem;
    }

    .docs-content table {
        display: block;
        overflow-x: auto;
    }
}

/* --- Sidebar overlay for mobile --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 499;
}

.sidebar-overlay.active {
    display: block;
}
