/**
 * ATON Format - Unified Dark/Light Theme Stylesheet
 * Version 2.0.1
 *
 * Dark mode is the default. Light mode is activated via [data-theme="light"]
 */

/* ============================================================================
   CSS VARIABLES - DARK MODE (DEFAULT)
   ============================================================================ */
:root {
    /* Backgrounds */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-elevated: #222222;
    --bg-card: #1a1a1a;

    /* Text */
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-muted: #86868b;
    --text-inverse: #0a0a0a;

    /* Borders */
    --border-primary: #2a2a2a;
    --border-secondary: #3a3a3a;
    --border-light: rgba(255, 255, 255, 0.1);

    /* Accent - Using neutral tones for dark/light theme */
    --accent-primary: #f5f5f7;
    --accent-secondary: #a1a1a6;
    --accent-highlight: #ffffff;

    /* Interactive */
    --interactive-hover: #2a2a2a;
    --interactive-active: #3a3a3a;

    /* Semantic colors */
    --color-success: #30d158;
    --color-warning: #ffd60a;
    --color-error: #ff453a;
    --color-info: #64d2ff;

    /* Code */
    --code-bg: #1a1a1a;
    --code-text: #f5f5f7;

    /* Navigation */
    --nav-bg: rgba(10, 10, 10, 0.85);
    --nav-border: rgba(255, 255, 255, 0.1);

    /* Footer */
    --footer-bg: #000000;
    --footer-text: #86868b;

    /* Glass effect */
    --glass-bg: rgba(26, 26, 26, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5);

    /* Table */
    --table-header-bg: #1a1a1a;
    --table-row-bg: #111111;
    --table-row-hover: #1a1a1a;
    --table-border: #2a2a2a;

    /* Scrollbar */
    --scrollbar-track: #1a1a1a;
    --scrollbar-thumb: #3a3a3a;
    --scrollbar-thumb-hover: #4a4a4a;

    /* Badges */
    --badge-primary-bg: #f5f5f7;
    --badge-primary-text: #0a0a0a;
    --badge-secondary-bg: #2a2a2a;
    --badge-secondary-text: #f5f5f7;
}

/* ============================================================================
   CSS VARIABLES - LIGHT MODE
   ============================================================================ */
[data-theme="light"] {
    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f7;
    --bg-tertiary: #e8e8ed;
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;

    /* Text */
    --text-primary: #1d1d1f;
    --text-secondary: #424245;
    --text-muted: #86868b;
    --text-inverse: #ffffff;

    /* Borders */
    --border-primary: #d2d2d7;
    --border-secondary: #e5e5e5;
    --border-light: rgba(0, 0, 0, 0.05);

    /* Accent */
    --accent-primary: #1d1d1f;
    --accent-secondary: #424245;
    --accent-highlight: #000000;

    /* Interactive */
    --interactive-hover: #f5f5f7;
    --interactive-active: #e8e8ed;

    /* Code */
    --code-bg: #1d1d1f;
    --code-text: #f5f5f7;

    /* Navigation */
    --nav-bg: rgba(255, 255, 255, 0.85);
    --nav-border: rgba(0, 0, 0, 0.1);

    /* Footer */
    --footer-bg: #1d1d1f;
    --footer-text: #86868b;

    /* Glass effect */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.05);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

    /* Table */
    --table-header-bg: #f5f5f7;
    --table-row-bg: #ffffff;
    --table-row-hover: #f5f5f7;
    --table-border: #e5e5e5;

    /* Scrollbar */
    --scrollbar-track: #f5f5f7;
    --scrollbar-thumb: #d2d2d7;
    --scrollbar-thumb-hover: #b0b0b5;

    /* Badges */
    --badge-primary-bg: #1d1d1f;
    --badge-primary-text: #ffffff;
    --badge-secondary-bg: #f5f5f7;
    --badge-secondary-text: #1d1d1f;
}

/* ============================================================================
   BASE STYLES
   ============================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 17px;
    line-height: 1.5;
    letter-spacing: -0.022em;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.2;
}

h1 { font-size: 3.5rem; letter-spacing: -0.03em; }
h2 { font-size: 2.5rem; letter-spacing: -0.025em; }
h3 { font-size: 1.75rem; letter-spacing: -0.02em; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
    opacity: 0.7;
}

strong, b {
    font-weight: 600;
    color: var(--text-primary);
}

.code-font {
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;
}

/* ============================================================================
   NAVIGATION
   ============================================================================ */
.nav-sticky {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--nav-border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav-sticky a {
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.nav-sticky a:hover,
.nav-sticky a.active {
    color: var(--text-primary);
    opacity: 1;
}

/* Main navigation (documentation style) */
.main-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--nav-border);
}

/* ============================================================================
   THEME TOGGLE BUTTON
   ============================================================================ */
.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--interactive-hover);
    border-color: var(--border-secondary);
}

.theme-toggle i {
    font-size: 16px;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    color: var(--text-inverse);
    padding: 12px 24px;
    border-radius: 980px;
    font-weight: 500;
    font-size: 17px;
    letter-spacing: -0.022em;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    opacity: 0.85;
    transform: scale(1.02);
    color: var(--text-inverse);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 980px;
    font-weight: 500;
    font-size: 17px;
    letter-spacing: -0.022em;
    border: 1px solid var(--border-primary);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

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

/* ============================================================================
   CARDS & GLASS EFFECTS
   ============================================================================ */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    box-shadow: var(--shadow-lg);
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* ============================================================================
   SECTIONS & BACKGROUNDS
   ============================================================================ */
.section-primary,
.bg-white {
    background-color: var(--bg-primary) !important;
}

.section-secondary,
.bg-gray-50 {
    background-color: var(--bg-secondary) !important;
}

.section-tertiary {
    background-color: var(--bg-tertiary) !important;
}

.hero-gradient {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-primary), transparent);
    margin: 80px 0;
}

/* ============================================================================
   CODE BLOCKS
   ============================================================================ */
.code-block {
    background: var(--code-bg);
    color: var(--code-text);
    border-radius: 12px;
    padding: 20px;
    overflow-x: auto;
    border: 1px solid var(--border-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
}

.code-block pre {
    margin: 0;
    color: inherit;
}

.inline-code,
code:not(.code-block code) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
}

/* ============================================================================
   TABLES
   ============================================================================ */
table,
.data-table,
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--table-row-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--table-border);
}

th {
    background: var(--table-header-bg) !important;
    color: var(--text-primary) !important;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid var(--table-border);
}

td {
    padding: 16px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--table-border);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--table-row-hover);
}

/* ============================================================================
   BADGES
   ============================================================================ */
.format-badge,
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.016em;
}

.badge-aton,
.badge-primary {
    background: var(--badge-primary-bg);
    color: var(--badge-primary-text);
}

.badge-json,
.badge-toon,
.badge-vsc,
.badge-secondary {
    background: var(--badge-secondary-bg);
    color: var(--badge-secondary-text);
}

.version-badge {
    display: inline-block;
    background: var(--accent-primary);
    color: var(--text-inverse);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
}

/* ============================================================================
   STATS
   ============================================================================ */
.stat-number {
    font-size: 56px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--text-primary);
}

.stat-label {
    font-size: 17px;
    font-weight: 400;
    color: var(--text-muted);
}

/* ============================================================================
   FORMS & INPUTS
   ============================================================================ */
input,
textarea,
select {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

input[type="number"] {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

/* Checkboxes */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
}

/* ============================================================================
   TABS
   ============================================================================ */
.tab-button {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-primary);
}

/* ============================================================================
   PROGRESS BAR
   ============================================================================ */
.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-primary);
    transition: width 0.3s ease;
}

/* ============================================================================
   SIDEBAR (DOCUMENTATION)
   ============================================================================ */
.sidebar nav {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
}

.sidebar h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.sidebar ul {
    list-style: none;
    margin-bottom: 24px;
}

.sidebar a {
    color: var(--text-secondary);
    display: block;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.sidebar a:hover,
.sidebar a.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    opacity: 1;
}

/* ============================================================================
   API METHOD BLOCKS
   ============================================================================ */
.api-method {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
    border-left: 4px solid var(--accent-primary);
}

.method-signature {
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.param-name {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--text-primary);
}

.param-type {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    font-size: 14px;
}

/* ============================================================================
   NOTES & WARNINGS
   ============================================================================ */
.note {
    background: rgba(255, 214, 10, 0.1);
    border-left: 4px solid var(--color-warning);
    padding: 16px;
    border-radius: 8px;
    margin: 20px 0;
}

.note-title {
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--color-warning);
}

.warning {
    background: rgba(255, 69, 58, 0.1);
    border-left: 4px solid var(--color-error);
    padding: 16px;
    border-radius: 8px;
    margin: 20px 0;
}

.warning-title {
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--color-error);
}

/* ============================================================================
   FEATURE CARDS
   ============================================================================ */
.feature-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    transition: background-color 0.3s ease;
}

.feature-title {
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.feature-description {
    font-size: 14px;
    color: var(--text-muted);
}

/* ============================================================================
   FOOTER
   ============================================================================ */
footer {
    background: var(--footer-bg) !important;
    color: var(--footer-text);
    padding: 60px 0 40px;
}

footer h3 {
    color: var(--text-primary);
}

footer a {
    color: var(--footer-text);
    transition: color 0.2s ease;
}

footer a:hover {
    color: var(--text-primary);
    opacity: 1;
}

/* ============================================================================
   HEADER (DOCUMENTATION)
   ============================================================================ */
header {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 60px 0;
    text-align: center;
}

header p {
    color: var(--text-secondary);
}

/* ============================================================================
   SCROLLBAR
   ============================================================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* ============================================================================
   UTILITY CLASSES - TEXT COLORS (Override Tailwind)
   ============================================================================ */
.text-gray-400,
.text-gray-500,
.text-gray-600,
.text-gray-700 {
    color: var(--text-secondary) !important;
}

.text-black {
    color: var(--text-primary) !important;
}

.text-white {
    color: var(--text-primary) !important;
}

/* Keep text-white actual white when inside dark sections */
.bg-black .text-white,
.bg-gray-900 .text-white,
.bg-black.text-white {
    color: #f5f5f7 !important;
}

/* V2 Enhancement cards - remove blue */
.text-blue-600 {
    color: var(--text-primary) !important;
}

/* Success color for percentages */
.text-green-600 {
    color: var(--color-success) !important;
}

/* ============================================================================
   UTILITY CLASSES - BACKGROUNDS (Override Tailwind)
   ============================================================================ */
.bg-gradient-to-b {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%) !important;
}

/* Tailwind gradient overrides */
.bg-gradient-to-b.from-gray-50.to-white,
.bg-gradient-to-b.from-gray-50,
.from-gray-50.to-white {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%) !important;
}

.bg-gradient-to-b.from-white.to-gray-50,
.from-white.to-gray-50 {
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%) !important;
}

.bg-gradient-to-br.from-gray-50.to-white,
.bg-gradient-to-br.from-blue-50.to-white,
.from-blue-50.to-white {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%) !important;
}

/* Black section override - stays dark in both themes */
.bg-black {
    background-color: #0a0a0a !important;
}

/* In light mode, bg-black sections still need dark background */
[data-theme="light"] .bg-black {
    background-color: #1d1d1f !important;
}

/* Text inside bg-black sections should stay light colored */
.bg-black h1,
.bg-black h2,
.bg-black h3,
.bg-black h4,
.bg-black p:not(.text-gray-400):not(.text-gray-500) {
    color: #f5f5f7 !important;
}

.bg-black .text-gray-400 {
    color: #a1a1a6 !important;
}

/* Gray-900 for dark sections */
.bg-gray-900 {
    background-color: var(--code-bg) !important;
}

/* Blue backgrounds override */
.bg-blue-50 {
    background-color: var(--bg-secondary) !important;
}

.bg-blue-600 {
    background-color: var(--accent-primary) !important;
}

/* Hover variants */
.hover\:bg-blue-700:hover {
    background-color: var(--text-primary) !important;
    opacity: 0.85;
}

/* ============================================================================
   UTILITY CLASSES - BORDERS (Override Tailwind)
   ============================================================================ */
.border-gray-200,
.border-gray-300 {
    border-color: var(--border-primary) !important;
}

/* ============================================================================
   SMOOTH TRANSITIONS
   ============================================================================ */
.smooth-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.smooth-hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 1024px) {
    .doc-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }

    .stat-number {
        font-size: 40px;
    }

    body {
        font-size: 15px;
    }

    .nav-sticky .flex.gap-8 {
        gap: 1rem;
    }
}

/* ============================================================================
   CHART.JS THEME VARIABLES
   ============================================================================ */
:root {
    --chart-bar-primary: #f5f5f7;
    --chart-bar-highlight: #1d1d1f;
    --chart-border: #3a3a3a;
    --chart-grid: #2a2a2a;
    --chart-text: #a1a1a6;
    --chart-title: #f5f5f7;
}

[data-theme="light"] {
    --chart-bar-primary: #e8e8ed;
    --chart-bar-highlight: #1d1d1f;
    --chart-border: #d2d2d7;
    --chart-grid: #e8e8ed;
    --chart-text: #6e6e73;
    --chart-title: #1d1d1f;
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */
@media print {
    body {
        background: white;
        color: black;
    }

    .nav-sticky,
    .theme-toggle,
    footer {
        display: none;
    }
}
