/* ═══════════════════════════════════════════════════════════════════
   Witline Futuristic Theme v2 — Centralized Design System
   Inspired by: SkiaSharp particles, MAUI neon borders,
   Syncfusion dark charts, CommunityToolkit animations
   ═══════════════════════════════════════════════════════════════════ */

/* ── Light Theme Variables ── */
html[data-theme="light"] {
    /* Backgrounds */
    --holo-bg: #f0f2f5;
    --holo-bg-darker: #e4e6eb;
    --holo-surface: rgba(255, 255, 255, 0.92);
    --holo-surface-hover: rgba(245, 245, 250, 0.96);
    --holo-surface-elevated: rgba(255, 255, 255, 0.98);

    /* Borders */
    --holo-border: rgba(99, 102, 241, 0.2);
    --holo-border-active: rgba(99, 102, 241, 0.5);
    --holo-border-subtle: rgba(0, 0, 0, 0.08);

    /* Glows */
    --holo-glow: 0 0 20px rgba(99, 102, 241, 0.08);
    --holo-glow-strong: 0 0 40px rgba(99, 102, 241, 0.15);
    --holo-glow-cyan: 0 0 25px rgba(0, 180, 220, 0.12);

    /* Neon Colors (slightly muted for light bg) */
    --neon-primary: #4f46e5;
    --neon-secondary: #0891b2;
    --neon-cyan: #0284c7;
    --neon-blue: #2563eb;
    --neon-purple: #7c3aed;
    --neon-success: #16a34a;
    --neon-warning: #d97706;
    --neon-danger: #dc2626;

    /* Text */
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a60;
    --text-dim: #8888a0;
    --text-inverse: #f0f2f5;

    /* Glass effect — lighter */
    --glass-blur: blur(12px);
    --glass-opacity: 0.85;
}

/* ── Light theme body overrides ── */
html[data-theme="light"] body {
    background: #f0f2f5;
    color: #1a1a2e;
}

html[data-theme="light"] .glass-panel {
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0,0,0,0.08);
}

html[data-theme="light"] .neon-btn {
    background: rgba(79, 70, 229, 0.05);
}
html[data-theme="light"] .neon-btn:hover {
    background: var(--neon-primary);
    color: white;
}

html[data-theme="light"] .top-bar,
html[data-theme="light"] .top-bar-left,
html[data-theme="light"] .top-bar-right {
    background: rgba(255,255,255,0.9);
    border-color: rgba(0,0,0,0.08);
    color: #1a1a2e;
}

html[data-theme="light"] .top-bar-btn {
    color: #4a4a60;
}
html[data-theme="light"] .top-bar-btn:hover {
    background: rgba(0,0,0,0.06);
    color: #1a1a2e;
}

html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] select {
    background: white;
    color: #1a1a2e;
    border-color: rgba(0,0,0,0.15);
}

html[data-theme="light"] .task-bar {
    background: rgba(255,255,255,0.92);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(0,0,0,0.08);
}

html[data-theme="light"] .task-bar-btn {
    color: #4a4a60;
}
html[data-theme="light"] .task-bar-btn:hover {
    background: rgba(79,70,229,0.08);
    color: #4f46e5;
}

html[data-theme="light"] .starfield-canvas {
    opacity: 0.15;
}

/* ── Light theme: Home page DeepSeek overrides ── */
html[data-theme="light"] [data-wit-component="home-dashboard"] .dash-hero {
    background: linear-gradient(135deg, #f8f9ff 0%, #eef0ff 30%, #e8f0fe 60%, #e0e8f5 100%);
    border-color: rgba(99,102,241,0.15);
}

html[data-theme="light"] .ds-search-box {
    background: white !important;
    border-color: rgba(99,102,241,0.2) !important;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06) !important;
}

html[data-theme="light"] .ds-search-input {
    color: #1a1a2e !important;
    background: transparent !important;
}

html[data-theme="light"] .ds-mode-chip {
    background: #f0f2f5;
    color: #4a4a60;
    border-color: rgba(0,0,0,0.08);
}
html[data-theme="light"] .ds-mode-chip.active {
    background: rgba(79,70,229,0.1);
    color: #4f46e5;
    border-color: #4f46e5;
}

html[data-theme="light"] .ds-search-btn {
    background: #4f46e5;
    color: white;
}

html[data-theme="light"] .ds-mic-btn {
    color: #4a4a60;
}
html[data-theme="light"] .ds-mic-btn:hover {
    background: rgba(79,70,229,0.08);
    color: #4f46e5;
}

html[data-theme="light"] .ds-prompt-chip {
    background: #f0f2f5;
    color: #4a4a60;
    border-color: rgba(0,0,0,0.06);
}
html[data-theme="light"] .ds-prompt-chip:hover {
    background: rgba(79,70,229,0.08);
    color: #4f46e5;
    border-color: rgba(79,70,229,0.3);
}

/* ── CSS Custom Properties (Design Tokens) ── */
:root {
    /* Backgrounds */
    --holo-bg: #0a0e17;
    --holo-bg-darker: #060912;
    --holo-surface: rgba(16, 20, 40, 0.85);
    --holo-surface-hover: rgba(24, 30, 60, 0.92);
    --holo-surface-elevated: rgba(20, 25, 50, 0.95);

    /* Borders */
    --holo-border: rgba(99, 102, 241, 0.25);
    --holo-border-active: rgba(99, 102, 241, 0.6);
    --holo-border-subtle: rgba(255, 255, 255, 0.06);

    /* Glows */
    --holo-glow: 0 0 20px rgba(99, 102, 241, 0.12);
    --holo-glow-strong: 0 0 40px rgba(99, 102, 241, 0.25);
    --holo-glow-cyan: 0 0 25px rgba(0, 242, 254, 0.2);

    /* Neon Colors */
    --neon-primary: #6366f1;
    --neon-secondary: #22d3ee;
    --neon-cyan: #00F2FE;
    --neon-blue: #4FACFE;
    --neon-purple: #a855f7;
    --neon-success: #22c55e;
    --neon-warning: #f59e0b;
    --neon-danger: #ef4444;

    /* Text */
    --text-primary: #e2e8f0;
    --text-secondary: #c8d2e0;
    --text-dim: #94a3b8;
    --text-inverse: #0a0e17;

    /* Typography */
    --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* ── Legacy --wit-* compatibility aliases (T8, 2026-09-15) ──
       Single definition point for the retired parallel namespace: every name is pinned
       to its current effective legacy value (zero visual change). Dynamic overrides
       (branding/JS: --wit-accent, --wit-accent-glow) keep working via inline styles.
       Consumer migration to the canonical tokens is per-page work (theme T5). */
    --wit-primary: #1976d2;
    --wit-accent: #1976d2;
    --wit-accent-glow: 0 0 20px rgba(59, 130, 246, 0.5);
    --wit-primary-light: #e3f2fd;
    --wit-secondary: #6c757d;
    --wit-success: #22c55e;
    --wit-warning: #e65100;
    --wit-danger: #ef4444;
    --wit-bg: #ffffff;
    --wit-bg-hover: #f0f0f0;
    --wit-bg-secondary: #f5f5f5;
    --wit-bg-subtle: #f8fafc;
    --wit-bg-card: #ffffff;
    --wit-card-bg: #ffffff;
    --wit-surface: #1e293b;
    --wit-text: var(--text-primary);
    --wit-text-primary: #333333;
    --wit-text-secondary: #94a3b8;
    --wit-border: #e0e0e0;
    --wit-border-radius: 8px;
    --wit-glass-bg: rgba(15, 23, 42, 0.6);
    --wit-glass-border: rgba(59, 130, 246, 0.2);
    --wit-glass-blur: 12px;
    --wit-animation-speed: 0.3s;
    --wit-neon-cyan: #22d3ee;
    --wit-neon-magenta: #e879f9;
    --wit-canvas-taskbar: 52px;
    --wit-canvas-bg: rgba(8, 12, 24, 0.92);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }

body.futuristic-dark {
    background: var(--holo-bg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Starfield Canvas ── */
.starfield-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 0;
    pointer-events: none;
    opacity: 0.5;
}

/* ── Glass-Morphism Card ── */
.glass-panel {
    background: var(--holo-surface);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--holo-border);
    border-radius: var(--radius-md);
    box-shadow: var(--holo-glow);
    transition: all var(--transition-normal);
}
.glass-panel:hover {
    border-color: var(--holo-border-active);
    box-shadow: var(--holo-glow-strong);
}

/* ── Neon Animated Border (matching MAUI LinearGradientBrush) ── */
.neon-border {
    position: relative;
    border-radius: var(--radius-md);
    background: var(--holo-surface);
    overflow: hidden;
}
.neon-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue), var(--neon-primary), var(--neon-secondary));
    background-size: 300% 300%;
    animation: neonRotate 4s ease-in-out infinite;
    z-index: -1;
    opacity: 0.6;
}
@keyframes neonRotate {
    0%, 100% { background-position: 0% 0%; }
    25% { background-position: 100% 0%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
}

/* ── Neon Text Glow ── */
.neon-text {
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0,242,254,0.5), 0 0 30px rgba(0,242,254,0.25);
    letter-spacing: 2px;
    font-weight: 700;
}

/* ── Neon Button ── */
.neon-btn {
    background: transparent;
    border: 1px solid var(--neon-primary);
    color: var(--neon-primary);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85rem;
}
.neon-btn:hover {
    background: var(--neon-primary);
    color: var(--text-inverse);
    box-shadow: 0 0 25px rgba(99,102,241,0.5), 0 0 50px rgba(99,102,241,0.15);
    transform: translateY(-1px);
}
.neon-btn:active {
    transform: translateY(0);
}

/* ── KPI Glow Card ── */
.kpi-glow {
    background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(34,211,238,0.04));
    border: 1px solid var(--holo-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    transition: all var(--transition-normal);
    cursor: pointer;
}
.kpi-glow:hover {
    border-color: var(--neon-cyan);
    box-shadow: var(--holo-glow-cyan);
    transform: translateY(-2px);
}

/* ── Dashboard Hero Banner (now per-page via [data-wit-component]) ── */
/* Global .dash-hero removed — use scoped [data-wit-component] selectors */

/* ── Dashboard Metric Card (now per-page) ── */
/* Global .dash-card removed — use scoped [data-wit-component] selectors */

/* ── Page Container (consistent spacing) ── */
.page-container {
    padding: var(--space-lg);
    max-width: 1440px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ── Data Table (dark theme) ── */
.wit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.wit-table th {
    background: rgba(99, 102, 241, 0.1);
    color: var(--neon-cyan);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.75rem;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--holo-border);
    text-align: left;
}
.wit-table td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--holo-border-subtle);
    color: var(--text-secondary);
}
.wit-table tr:hover td {
    background: var(--holo-surface-hover);
    color: var(--text-primary);
}

/* ── Priority Badges ── */
.badge-high {
    background: rgba(239, 68, 68, 0.15);
    color: var(--neon-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.badge-med {
    background: rgba(245, 158, 11, 0.15);
    color: var(--neon-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-low {
    background: rgba(34, 197, 94, 0.15);
    color: var(--neon-success);
    border: 1px solid rgba(34, 197, 94, 0.3);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* ── Data Readout (mono numbers) ── */
.data-readout {
    font-family: var(--font-mono);
    color: var(--neon-cyan);
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(0, 242, 254, 0.3);
}

/* ── Pulse Glow Animation ── */
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(34, 211, 238, 0.3); }
    50% { box-shadow: 0 0 20px rgba(34, 211, 238, 0.6); }
}
.pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* ── Connection Status Dot ── */
.connection-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: var(--space-xs);
}
.connection-dot.online {
    background: var(--neon-success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}
.connection-dot.offline {
    background: var(--neon-danger);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

/* ── Domain Card Grid ── */
.domain-card {
    background: var(--holo-surface);
    border: 1px solid var(--holo-border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
}
.domain-card:hover {
    border-color: var(--neon-primary);
    box-shadow: var(--holo-glow);
    transform: translateY(-2px);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--holo-bg); }
::-webkit-scrollbar-thumb {
    background: var(--holo-border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--neon-primary); }

/* ── Input Fields ── */
.wit-input, .wit-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--holo-border);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}
.wit-input:focus, .wit-select:focus {
    outline: none;
    border-color: var(--neon-primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

/* ── Utility Buttons ── */
.wit-btn {
    background: var(--holo-surface);
    border: 1px solid var(--holo-border);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}
.wit-btn:hover {
    border-color: var(--neon-primary);
    background: var(--holo-surface-hover);
}
.wit-btn-primary {
    background: var(--neon-primary);
    border-color: var(--neon-primary);
    color: #fff;
}
.wit-btn-primary:hover {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}
.wit-btn-danger {
    border-color: var(--neon-danger);
    color: var(--neon-danger);
}
.wit-btn-danger:hover {
    background: var(--neon-danger);
    color: #fff;
}
.wit-btn-sm {
    padding: 4px 12px;
    font-size: 0.75rem;
}

/* ── Section Headers ── */
.section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-dim);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-sm);
}

/* ── Navigation Items ── */
.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
    font-size: 0.9rem;
}
.nav-item:hover {
    background: var(--holo-surface-hover);
    color: var(--text-primary);
}
.nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--neon-primary);
    border-left: 2px solid var(--neon-primary);
}
.nav-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}
.nav-label {
    flex: 1;
}
.nav-badge {
    background: var(--neon-primary);
    color: #fff;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
}
