/* ─────────────────────────────────────────────────────────────────────────────
   CodeSavvy Documentation & Interactive Testing Suite — Core Design System
   Modern glassmorphic aesthetic with dark & light theme variables.
───────────────────────────────────────────────────────────────────────────── */

:root {
    /* Brand Palettes */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.25);
    --secondary: #10b981;
    --secondary-hover: #059669;
    --secondary-glow: rgba(16, 185, 129, 0.2);
    --accent: #f59e0b;
    --accent-glow: rgba(245, 158, 11, 0.2);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.2);
    --info: #0ea5e9;

    /* Dark Mode Defaults */
    --bg-base: #060913;
    --bg-dark: #060913;
    --bg-surface: #0b1120;
    --bg-card: rgba(15, 23, 42, 0.72);
    --bg-card-hover: rgba(30, 41, 59, 0.8);
    --bg-elevated: #111827;
    --bg-input: rgba(15, 23, 42, 0.9);
    --bg-code: #090e1a;

    --border-subtle: rgba(255, 255, 255, 0.07);
    --border-normal: rgba(255, 255, 255, 0.08);
    --border-medium: rgba(255, 255, 255, 0.14);
    --border-glow: rgba(99, 102, 241, 0.3);

    --text-primary: #f8fafc;
    --text-main: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
    --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-glow: 0 0 24px var(--primary-glow);

    --sidebar-width: 290px;
    --header-height: 68px;
}

html[data-theme="light"] {
    --bg-base: #f1f5f9;
    --bg-dark: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.92);
    --bg-card-hover: #ffffff;
    --bg-elevated: #ffffff;
    --bg-input: #ffffff;
    --bg-code: #f1f5f9;

    --border-subtle: rgba(148, 163, 184, 0.2);
    --border-normal: rgba(148, 163, 184, 0.25);
    --border-medium: rgba(148, 163, 184, 0.35);
    --border-glow: rgba(99, 102, 241, 0.25);

    --text-primary: #0f172a;
    --text-main: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-inverse: #f8fafc;

    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 4px 18px rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

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

html {
    scroll-behavior: smooth;
    font-size: 15px;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 15% 15%, var(--primary-glow) 0%, transparent 45%),
        radial-gradient(circle at 85% 80%, var(--secondary-glow) 0%, transparent 45%);
    background-attachment: fixed;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Light mode body background */
html[data-theme="light"] body {
    background-color: #f1f5f9;
    color: #0f172a;
    background-image:
        radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(16, 185, 129, 0.06) 0%, transparent 45%);
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.25);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

/* Floating Circular Theme Toggle */
#cs-theme-toggle,
.cs-theme-floating-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border-medium);
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    cursor: pointer;
    font-size: 19px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    line-height: 1;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
    user-select: none;
}
#cs-theme-toggle:hover,
.cs-theme-floating-toggle:hover {
    transform: scale(1.12);
    box-shadow: var(--shadow-glow);
    border-color: var(--primary);
}
#cs-theme-toggle:active,
.cs-theme-floating-toggle:active {
    transform: scale(0.95);
}
#cs-theme-toggle span,
.cs-theme-floating-toggle span {
    display: none !important;
}

/* Navbar Theme Toggle Button */
.cs-theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.cs-theme-toggle-btn .theme-label {
    font-weight: 600;
}

/* Keyboard Shortcut Badges */
kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border-medium);
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: 2px 7px;
    color: var(--primary);
    font-weight: 600;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}
html[data-theme="light"] kbd {
    background: #e2e8f0;
    color: #4338ca;
    border-color: #cbd5e1;
}

/* Common Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
}
.badge-primary {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border-color: rgba(99, 102, 241, 0.3);
}
html[data-theme="light"] .badge-primary {
    color: #4f46e5;
    background: rgba(99, 102, 241, 0.1);
}
.badge-secondary {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}
html[data-theme="light"] .badge-secondary {
    color: #059669;
    background: rgba(16, 185, 129, 0.1);
}
.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}
html[data-theme="light"] .badge-warning {
    color: #d97706;
    background: rgba(245, 158, 11, 0.1);
}
.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}
html[data-theme="light"] .badge-danger {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.1);
}

/* Live Testing Arena Wrappers */
.test-arena {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 18px;
    position: relative;
    box-shadow: var(--shadow-sm);
}
.test-arena-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
    flex-wrap: wrap;
    gap: 8px;
}
.test-arena-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.test-arena-status {
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}
.test-arena-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
html[data-theme="light"] .test-arena-btn {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.3);
}
.test-arena-btn:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}
