/* =====================================================
   ONAIR KHABAR MASTER THEME SYSTEM
   Google Stitch Design System Implementation
   Dynamic switching with CSS Variables + Tailwind Ready
   ===================================================== */

/* =====================================================
   1. DEFAULT ROOT VARIABLES (Stitch Design Tokens)
   ===================================================== */
:root {
    /* Brand - OnAir Khabar Primary */
    --primary: #ea2a33;
    --primary-dark: #c41c24;
    --brand: #ea2a33;
    --brand-2: #c41c24;

    /* Background */
    --bg: #ffffff;
    --bg-2: #f8f6f6;
    --bg-light: #f8f6f6;
    --bg-dark: #211111;
    --card: #ffffff;

    /* Text */
    --text: #1b0e0e;
    --text-2: #374151;
    --muted: #6b7280;

    /* Semantic Colors */
    --success: #10b981;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Borders */
    --border: #e5e7eb;
    --border-light: #f3e7e8;

    /* Links */
    --link: var(--primary);
    --link-hover: var(--primary-dark);

    /* UI */
    --radius: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);

    /* Typography - Stitch System */
    --font-ui: "Inter", system-ui, sans-serif;
    --font-nepali: "Noto Sans Devanagari", "Mukta", sans-serif;
    --font-headline: var(--font-nepali);
    --font-serif: "Mukta", Georgia, serif;

    /* Layout density */
    --container: 1280px;
    --container-lg: 1400px;
    --gap: 18px;
    --line: 1.7;

    /* Ticker */
    --ticker-bg: var(--primary);
    --ticker-text: #ffffff;
}

/* =====================================================
   1b. THEME: DEFAULT (OnAir Brand - matches :root)
   ===================================================== */
.theme-default {
    /* Uses :root variables - no overrides needed */
}

/* =====================================================
   2. THEME: SETOPATI (Clean + Compact + Soft Blue)
   ===================================================== */
.theme-setopati {
    --brand: #2563eb;
    --brand-2: #1d4ed8;

    --bg: #ffffff;
    --bg-2: #f8fafc;
    --card: #ffffff;

    --text: #0f172a;
    --text-2: #1f2937;
    --muted: #64748b;

    --border: #e2e8f0;

    --link: #2563eb;
    --link-hover: #1d4ed8;

    --radius: 14px;
    --shadow: 0 10px 24px rgba(2, 6, 23, 0.06);

    --font-headline: var(--font-nepali);

    --container: 1200px;
    --gap: 16px;
    --line: 1.75;

    --ticker-bg: #0f172a;
    --ticker-text: #ffffff;
}

/* Setopati Special Rules */
.theme-setopati .article-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border);
}

.theme-setopati .section-header {
    border-bottom-color: var(--brand);
}

/* =====================================================
   3. THEME: RATOPATI (Bold Red + Punchy)
   ===================================================== */
.theme-ratopati {
    --brand: #d32f2f;
    --brand-2: #b71c1c;

    --bg: #ffffff;
    --bg-2: #fff5f5;
    --card: #ffffff;

    --text: #121212;
    --text-2: #1f2937;
    --muted: #6b7280;

    --border: #fee2e2;

    --link: #d32f2f;
    --link-hover: #b71c1c;

    --radius: 16px;
    --shadow: 0 12px 28px rgba(0, 0, 0, 0.10);

    --font-headline: var(--font-nepali);

    --container: 1200px;
    --gap: 20px;
    --line: 1.7;

    --ticker-bg: #b71c1c;
    --ticker-text: #ffffff;
}

/* Ratopati Special Rules */
.theme-ratopati .article-title {
    font-size: 1.2rem;
    font-weight: 800;
}

.theme-ratopati .breaking-news-banner {
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
}

.theme-ratopati .hero-category {
    background: var(--brand);
    font-weight: 800;
}

/* =====================================================
   4. THEME: EKANTIPUR (Newspaper + Classic)
   ===================================================== */
.theme-ekantipur {
    --brand: #111827;
    --brand-2: #0f172a;

    --bg: #fbf7ef;
    --bg-2: #f4efe4;
    --card: #ffffff;

    --text: #111827;
    --text-2: #1f2937;
    --muted: #6b7280;

    --border: #e7dfcf;

    --link: #111827;
    --link-hover: #000000;

    --radius: 10px;
    --shadow: 0 10px 22px rgba(0, 0, 0, 0.08);

    --font-headline: Georgia, "Times New Roman", serif;

    --container: 1200px;
    --gap: 18px;
    --line: 1.85;

    --ticker-bg: #111827;
    --ticker-text: #ffffff;
}

/* Ekantipur Special Rules - Newspaper Feel */
.theme-ekantipur h1,
.theme-ekantipur h2,
.theme-ekantipur h3,
.theme-ekantipur .article-title,
.theme-ekantipur .hero-title {
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: -0.01em;
}

.theme-ekantipur .article-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.theme-ekantipur .section-header {
    border-bottom: 2px solid #111827;
}

/* =====================================================
   5. THEME: BBC (Premium Minimal Black/White/Red)
   ===================================================== */
.theme-bbc {
    --brand: #d00000;
    --brand-2: #a80000;

    --bg: #ffffff;
    --bg-2: #f6f7f8;
    --card: #ffffff;

    --text: #0b0c0c;
    --text-2: #1f2937;
    --muted: #5a5a5a;

    --border: #e5e5e5;

    --link: #d00000;
    --link-hover: #a80000;

    --radius: 12px;
    --shadow: 0 12px 26px rgba(0, 0, 0, 0.09);

    --font-headline: Inter, system-ui, sans-serif;

    --container: 1240px;
    --gap: 20px;
    --line: 1.7;

    --ticker-bg: #0b0c0c;
    --ticker-text: #ffffff;
}

/* BBC Special Rules - Premium Grid */
.theme-bbc .article-card {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.theme-bbc .article-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.25;
}

.theme-bbc .section-header {
    border-bottom: 4px solid var(--brand);
}

.theme-bbc .hero-title {
    font-weight: 800;
    letter-spacing: -0.03em;
}

/* =====================================================
   6. USER DARK MODE (Works with Any Theme)
   ===================================================== */
.mode-dark {
    --bg: #0b1220;
    --bg-2: #0f172a;
    --card: #0f172a;

    --text: #f8fafc;
    --text-2: #e2e8f0;
    --muted: #94a3b8;

    --border: rgba(255, 255, 255, 0.08);

    --shadow: 0 14px 34px rgba(0, 0, 0, 0.45);

    --ticker-bg: #000000;
    --ticker-text: #ffffff;
}

/* Dark Mode Adjustments */
.mode-dark body,
body.mode-dark {
    background-color: var(--bg);
    color: var(--text);
}

.mode-dark .article-card,
.mode-dark .widget,
.mode-dark .latest-headlines {
    background: var(--card);
    border-color: var(--border);
}

.mode-dark .site-header {
    background: var(--card);
    border-color: var(--border);
}

/* =====================================================
   7. ADMIN PANEL - LIGHT THEME
   ===================================================== */
.admin-theme-light {
    --admin-primary: #6366f1;
    --admin-primary-hover: #4f46e5;

    --admin-bg: #f8fafc;
    --admin-card: #ffffff;

    --admin-text: #0f172a;
    --admin-text-2: #334155;
    --admin-muted: #64748b;

    --admin-border: #e2e8f0;

    --admin-sidebar: #0f172a;
    --admin-sidebar-text: #cbd5e1;
    --admin-sidebar-hover: #1e293b;
    --admin-sidebar-active: #6366f1;

    --admin-success: #22c55e;
    --admin-warning: #f59e0b;
    --admin-danger: #ef4444;
    --admin-info: #3b82f6;

    --admin-radius: 14px;
    --admin-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
}

/* =====================================================
   8. ADMIN PANEL - DARK THEME
   ===================================================== */
.admin-theme-dark {
    --admin-primary: #818cf8;
    --admin-primary-hover: #6366f1;

    --admin-bg: #0b1220;
    --admin-card: #0f172a;

    --admin-text: #f8fafc;
    --admin-text-2: #e2e8f0;
    --admin-muted: #94a3b8;

    --admin-border: rgba(255, 255, 255, 0.08);

    --admin-sidebar: #000000;
    --admin-sidebar-text: #e2e8f0;
    --admin-sidebar-hover: #111827;
    --admin-sidebar-active: #818cf8;

    --admin-success: #4ade80;
    --admin-warning: #fbbf24;
    --admin-danger: #f87171;
    --admin-info: #60a5fa;

    --admin-radius: 14px;
    --admin-shadow: 0 16px 36px rgba(0, 0, 0, 0.50);
}

/* Admin Dark Mode Overrides */
.admin-theme-dark body {
    background: var(--admin-bg);
    color: var(--admin-text);
}

.admin-theme-dark .admin-sidebar {
    background: var(--admin-sidebar);
}

.admin-theme-dark .admin-card {
    background: var(--admin-card);
    border-color: var(--admin-border);
}

.admin-theme-dark .admin-topbar {
    background: var(--admin-card);
    border-color: var(--admin-border);
}

.admin-theme-dark .form-control {
    background: var(--admin-card);
    border-color: var(--admin-border);
    color: var(--admin-text);
}

.admin-theme-dark .admin-table th {
    background: var(--admin-bg);
    color: var(--admin-text);
}

.admin-theme-dark .admin-table td {
    border-color: var(--admin-border);
    color: var(--admin-text-2);
}

/* =====================================================
   9. AUTO DARK MODE (OS Preference)
   ===================================================== */
@media (prefers-color-scheme: dark) {
    .admin-theme-auto {
        --admin-primary: #818cf8;
        --admin-primary-hover: #6366f1;
        --admin-bg: #0b1220;
        --admin-card: #0f172a;
        --admin-text: #f8fafc;
        --admin-text-2: #e2e8f0;
        --admin-muted: #94a3b8;
        --admin-border: rgba(255, 255, 255, 0.08);
        --admin-sidebar: #000000;
        --admin-sidebar-text: #e2e8f0;
        --admin-sidebar-hover: #111827;
        --admin-shadow: 0 16px 36px rgba(0, 0, 0, 0.50);
    }
}

/* =====================================================
   10. UTILITY CLASSES (Tailwind-Compatible)
   ===================================================== */

/* Background utilities */
.bg-brand {
    background-color: var(--brand);
}

.bg-brand-2 {
    background-color: var(--brand-2);
}

.bg-main {
    background-color: var(--bg);
}

.bg-alt {
    background-color: var(--bg-2);
}

.bg-card {
    background-color: var(--card);
}

/* Text utilities */
.text-brand {
    color: var(--brand);
}

.text-main {
    color: var(--text);
}

.text-secondary {
    color: var(--text-2);
}

.text-muted {
    color: var(--muted);
}

/* Border utilities */
.border-main {
    border-color: var(--border);
}

.rounded-theme {
    border-radius: var(--radius);
}

/* Shadow utilities */
.shadow-theme {
    box-shadow: var(--shadow);
}

/* Gap utilities */
.gap-theme {
    gap: var(--gap);
}

/* Container */
.container-theme {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1rem;
}