/* ==========================================================================
   ANTI-GRAVITY V3.2 — RADAR CORE
   Global Design Tokens, Reset, Typography, Keyframes & Utility Classes
   Canvas: 100% Solid Dark — Zero Glassmorphism — Mathematical Elevation
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS (CSS Custom Properties)
   -------------------------------------------------------------------------- */
:root {
    /* Canvas & Surface Palette */
    --canvas-bg: #0b1120;
    --surface-bg: #0f172a;
    --surface-card: #1e293b;
    --surface-hover: #334155;
    --surface-input: #1e293b;
    --surface-deep: #090e1a;

    /* Text Hierarchy (Ergonomic Dark Tone, No Harsh Glare) */
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-disabled: #475569;

    /* Accent Palette (100% Solid & High-Contrast Balanced) */
    --accent-cyan: #38bdf8;
    --accent-blue: #0284c7;
    --accent-blue-hover: #0369a1;
    --accent-green: #22c55e;
    --accent-green-dark: #15803d;
    --accent-red: #ef4444;
    --accent-red-dark: #b91c1c;
    --accent-amber: #f59e0b;

    /* Structural Tokens */
    --hairline: #1e293b;
    --hairline-light: #334155;
    --focus-ring: 0 0 0 2px var(--accent-blue);

    /* 4-Tier Mathematical Shadow Elevation (No Outer Borders) */
    --shadow-v3: rgba(0, 0, 0, 0.35) 0px 4px 12px 0px;
    --shadow-v3-sidebar: rgba(0, 0, 0, 0.4) 2px 0px 10px 0px;
    --shadow-v3-modal: rgba(0, 0, 0, 0.7) 0px 16px 40px 0px;
    --shadow-v3-dropdown: rgba(0, 0, 0, 0.5) 0px 6px 20px 0px;

    /* Geometry */
    --radius-box: 6px;
    --radius-btn: 6px;
    --sidebar-width: 250px;
    --topbar-height: 60px;

    /* Font Stacks */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --font-display: 'Oswald', 'Impact', sans-serif;

    /* Timing */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-smooth: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --------------------------------------------------------------------------
   2. UNIVERSAL RESET
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    background-color: var(--canvas-bg);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 13px;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img, svg {
    display: block;
    max-width: 100%;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    outline: none;
}

button {
    cursor: pointer;
}

ul, ol {
    list-style: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* --------------------------------------------------------------------------
   3. SELECTION & SCROLLBAR
   -------------------------------------------------------------------------- */
::selection {
    background: var(--accent-blue);
    color: #fff;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

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

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

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-blue) var(--surface-bg);
}

/* --------------------------------------------------------------------------
   4. KEYFRAME ANIMATIONS
   -------------------------------------------------------------------------- */
@keyframes pulse-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes slide-in-right {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slide-out-right {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes skeleton-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes loader-progress {
    0% { width: 0; }
    50% { width: 70%; }
    100% { width: 90%; }
}

@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --------------------------------------------------------------------------
   5. PAGE LOADER (3px Top Laser Progress Bar)
   -------------------------------------------------------------------------- */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
    z-index: 9999;
    transition: width 0.4s ease, opacity 0.3s ease;
    pointer-events: none;
    opacity: 0;
}

.page-loader.active {
    opacity: 1;
    animation: loader-progress 2s ease forwards;
}

.page-loader.done {
    width: 100% !important;
    animation: none;
    transition: width 0.2s ease, opacity 0.4s ease 0.3s;
    opacity: 0;
}

.page-loader.fail {
    background: linear-gradient(90deg, var(--accent-red), var(--accent-amber));
    width: 100% !important;
    animation: none;
}

/* --------------------------------------------------------------------------
   6. TYPOGRAPHY UTILITIES
   -------------------------------------------------------------------------- */
.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }
.font-main { font-family: var(--font-main); }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-cyan { color: var(--accent-cyan); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-amber { color: var(--accent-amber); }
.text-blue { color: var(--accent-blue); }

.text-xs { font-size: 10px; }
.text-sm { font-size: 11px; }
.text-base { font-size: 13px; }
.text-lg { font-size: 15px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 24px; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.uppercase { text-transform: uppercase; }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   7. INLINE CODE & CODE BLOCKS
   -------------------------------------------------------------------------- */
code {
    background: var(--surface-card);
    padding: 2px 6px;
    border-radius: var(--radius-btn);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent-cyan);
}

.code-block {
    background: var(--surface-deep);
    padding: 16px;
    border-radius: var(--radius-box);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.7;
}

/* --------------------------------------------------------------------------
   8. SPACING & LAYOUT UTILITIES
   -------------------------------------------------------------------------- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* --------------------------------------------------------------------------
   9. DIVIDER
   -------------------------------------------------------------------------- */
.divider {
    border: 0;
    border-top: 1px solid var(--hairline);
    margin: 16px 0;
}

/* --------------------------------------------------------------------------
   10. VISUALLY HIDDEN (Accessibility)
   -------------------------------------------------------------------------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
