/* ==========================================================================
   themes.css – Centralized Multi-Theme Design Token System
   Cow Status View System (سیستم مدیریت گله و وضعیت دام‌ها)
   Themes:
     1. Apple / Liquid Glass (Light & Dark)
     2. Linear-inspired Dark UI
     3. Modern SaaS / Shadcn Admin (Light & Dark)
     4. Material Design 3 (Light & Dark)
     5. Notion-inspired Minimal (Light & Dark)
     6. Cyber Dark (Neon Sci-Fi)
   ========================================================================== */

/* ── Base Token Contract (Default: Apple / Liquid Glass Light) ────────────── */
:root {
    /* ── Surface & Background Tokens ── */
    --theme-name: "apple-light";
    --bg-app: #f5f6f8;
    --bg-surface: #ffffff;
    --bg-surface-elevated: rgba(255, 255, 255, 0.94);
    --bg-surface-alt: #f8fafc;
    --bg-surface-subtle: #f1f5f9;
    --bg-surface-hover: #eef2f6;
    --bg-surface-active: #e2e8f0;
    --bg-input: #f8fafc;
    --bg-overlay: rgba(15, 23, 42, 0.55);

    /* ── Typography & Foreground Tokens ── */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;
    --text-inverse: #ffffff;
    --font-sans: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --font-heading: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
    --letter-spacing-tight: -0.015em;

    /* ── Brand & Accent Tokens ── */
    --primary: #0071e3;
    --primary-hover: #0077ed;
    --primary-active: #005bb5;
    --primary-light: #e8f2fe;
    --primary-dark: #005bb5;
    --primary-fg: #ffffff;
    --primary-border: rgba(0, 113, 227, 0.25);

    --accent: #f59e0b;
    --accent-light: #fef3c7;
    --accent-fg: #92400e;

    /* ── Status Tokens ── */
    --success: #10b981;
    --success-light: #d1fae5;
    --success-fg: #065f46;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --danger-fg: #991b1b;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --warning-fg: #92400e;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --info-fg: #1e40af;

    /* ── Borders & Outlines ── */
    --border-subtle: rgba(226, 232, 240, 0.8);
    --border-default: #e2e8f0;
    --border-strong: #cbd5e1;
    --border-focus: #0071e3;
    --ring-focus: rgba(0, 113, 227, 0.25);

    /* ── Shapes & Geometry ── */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --radius-pill: 9999px;
    --radius-card: 16px;
    --radius-input: 10px;
    --radius-btn: 10px;

    /* ── Shadows & Depth ── */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 2px 6px -1px rgba(15, 23, 42, 0.06), 0 1px 4px -1px rgba(15, 23, 42, 0.03);
    --shadow-md: 0 6px 18px -3px rgba(15, 23, 42, 0.08), 0 2px 8px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 16px 36px -6px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
    --shadow-card: 0 3px 14px -2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.03);
    --shadow-glow: none;

    /* ── Glassmorphism / Liquid Material ── */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.7);
    --glass-blur: blur(20px) saturate(180%);
    --glass-card-border-top: rgba(255, 255, 255, 0.95);

    /* ── Motion & Animation ── */
    --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --active-scale: scale(0.98);

    /* ── Backward Compatibility with Existing style.css Variables ── */
    --bg: var(--bg-app);
    --surface: var(--bg-surface);
    --surface-alt: var(--bg-surface-alt);
    --border: var(--border-default);
    --text: var(--text-primary);
    --radius: var(--radius-md);
    --touch-target: 44px;
}

/* ==========================================================================
   THEME 1: Apple / Liquid Glass
   ========================================================================== */
/* Apple Light */
[data-theme="apple-light"],
[data-theme="apple"][data-mode="light"],
[data-theme="apple"]:not([data-mode="dark"]) {
    --theme-name: "apple-light";
    --bg-app: #f2f3f7;
    --bg-surface: #ffffff;
    --bg-surface-elevated: rgba(255, 255, 255, 0.92);
    --bg-surface-alt: #f8fafc;
    --bg-surface-subtle: #f0f3f7;
    --bg-surface-hover: #e9eef5;
    --bg-surface-active: #dde3eb;
    --bg-input: rgba(245, 247, 250, 0.9);
    --bg-overlay: rgba(15, 23, 42, 0.45);

    --text-primary: #1d1d1f;
    --text-secondary: #515154;
    --text-muted: #86868b;
    --text-subtle: #a1a1a6;

    --primary: #0071e3;
    --primary-hover: #0077ed;
    --primary-active: #005bb5;
    --primary-light: #eaf3fe;
    --primary-dark: #005bb5;
    --primary-fg: #ffffff;
    --primary-border: rgba(0, 113, 227, 0.22);

    --accent: #ff9500;
    --accent-light: #fff4e5;
    --accent-fg: #944e00;

    --border-subtle: rgba(0, 0, 0, 0.06);
    --border-default: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.18);
    --border-focus: #0071e3;
    --ring-focus: rgba(0, 113, 227, 0.28);

    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-card: 18px;
    --radius-input: 12px;
    --radius-btn: 12px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 48px -8px rgba(0, 0, 0, 0.14);
    --shadow-card: 0 4px 18px -2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.02);

    --glass-bg: rgba(255, 255, 255, 0.86);
    --glass-border: rgba(255, 255, 255, 0.85);
    --glass-blur: blur(24px) saturate(190%);
    --glass-card-border-top: rgba(255, 255, 255, 0.98);
}

/* Apple Dark (Liquid Glass Night) */
[data-theme="apple-dark"],
[data-theme="apple"][data-mode="dark"] {
    --theme-name: "apple-dark";
    --bg-app: #000000;
    --bg-surface: #161618;
    --bg-surface-elevated: rgba(30, 30, 33, 0.88);
    --bg-surface-alt: #1c1c1e;
    --bg-surface-subtle: #242426;
    --bg-surface-hover: #2c2c2e;
    --bg-surface-active: #3a3a3c;
    --bg-input: #1c1c1e;
    --bg-overlay: rgba(0, 0, 0, 0.75);

    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-muted: #86868b;
    --text-subtle: #6e6e73;
    --text-inverse: #000000;

    --primary: #2997ff;
    --primary-hover: #47a6ff;
    --primary-active: #147ce5;
    --primary-light: rgba(41, 151, 255, 0.16);
    --primary-dark: #147ce5;
    --primary-fg: #ffffff;
    --primary-border: rgba(41, 151, 255, 0.35);

    --accent: #ff9f0a;
    --accent-light: rgba(255, 159, 10, 0.18);
    --accent-fg: #ffb340;

    --success: #30d158;
    --success-light: rgba(48, 209, 88, 0.18);
    --success-fg: #30d158;
    --danger: #ff453a;
    --danger-light: rgba(255, 69, 58, 0.18);
    --danger-fg: #ff453a;
    --warning: #ffd60a;
    --warning-light: rgba(255, 214, 10, 0.18);
    --warning-fg: #ffd60a;

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-default: rgba(255, 255, 255, 0.14);
    --border-strong: rgba(255, 255, 255, 0.24);
    --border-focus: #2997ff;
    --ring-focus: rgba(41, 151, 255, 0.35);

    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-card: 18px;
    --radius-input: 12px;
    --radius-btn: 12px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 26px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.7);
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);

    --glass-bg: rgba(28, 28, 30, 0.85);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-blur: blur(24px) saturate(200%);
    --glass-card-border-top: rgba(255, 255, 255, 0.22);
}

/* ==========================================================================
   THEME 2: Linear-inspired Dark UI (Obsidian & Indigo)
   ========================================================================== */
[data-theme="linear-dark"],
[data-theme="linear"] {
    --theme-name: "linear-dark";
    --bg-app: #08090a;
    --bg-surface: #0f1013;
    --bg-surface-elevated: #14151a;
    --bg-surface-alt: #17181f;
    --bg-surface-subtle: #1c1d25;
    --bg-surface-hover: #22242e;
    --bg-surface-active: #2a2c38;
    --bg-input: #121318;
    --bg-overlay: rgba(5, 6, 8, 0.85);

    --text-primary: #f2f3f5;
    --text-secondary: #9ea3b0;
    --text-muted: #717684;
    --text-subtle: #525663;
    --text-inverse: #08090a;

    --primary: #5e6ad2;
    --primary-hover: #6e7be0;
    --primary-active: #4e58b8;
    --primary-light: rgba(94, 106, 210, 0.18);
    --primary-dark: #4e58b8;
    --primary-fg: #ffffff;
    --primary-border: rgba(94, 106, 210, 0.35);

    --accent: #8b5cf6;
    --accent-light: rgba(139, 92, 246, 0.16);
    --accent-fg: #c4b5fd;

    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.16);
    --success-fg: #34d399;
    --danger: #f43f5e;
    --danger-light: rgba(244, 63, 94, 0.16);
    --danger-fg: #fb7185;
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.16);
    --warning-fg: #fbbf24;

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.18);
    --border-focus: #5e6ad2;
    --ring-focus: rgba(94, 106, 210, 0.35);

    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 14px;
    --radius-card: 8px;
    --radius-input: 6px;
    --radius-btn: 6px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.7);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    --shadow-glow: 0 0 16px rgba(94, 106, 210, 0.25);

    --glass-bg: rgba(15, 16, 19, 0.92);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(12px);
    --glass-card-border-top: rgba(255, 255, 255, 0.12);
}

/* ==========================================================================
   THEME 3: Modern SaaS / Shadcn Admin
   ========================================================================== */
/* Shadcn Light */
[data-theme="shadcn-light"],
[data-theme="shadcn"][data-mode="light"],
[data-theme="shadcn"]:not([data-mode="dark"]) {
    --theme-name: "shadcn-light";
    --bg-app: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #ffffff;
    --bg-surface-alt: #f1f5f9;
    --bg-surface-subtle: #f8fafc;
    --bg-surface-hover: #f1f5f9;
    --bg-surface-active: #e2e8f0;
    --bg-input: #ffffff;
    --bg-overlay: rgba(15, 23, 42, 0.6);

    --text-primary: #020817;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;

    --primary: #0f172a;
    --primary-hover: #1e293b;
    --primary-active: #020817;
    --primary-light: #f1f5f9;
    --primary-dark: #020817;
    --primary-fg: #f8fafc;
    --primary-border: #cbd5e1;

    --accent: #2563eb;
    --accent-light: #eff6ff;
    --accent-fg: #1d4ed8;

    --border-subtle: #f1f5f9;
    --border-default: #e2e8f0;
    --border-strong: #cbd5e1;
    --border-focus: #0f172a;
    --ring-focus: rgba(15, 23, 42, 0.2);

    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 14px;
    --radius-card: 10px;
    --radius-input: 8px;
    --radius-btn: 8px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);

    --glass-bg: #ffffff;
    --glass-border: #e2e8f0;
    --glass-blur: none;
    --glass-card-border-top: #e2e8f0;
}

/* Shadcn Dark */
[data-theme="shadcn-dark"],
[data-theme="shadcn"][data-mode="dark"] {
    --theme-name: "shadcn-dark";
    --bg-app: #09090b;
    --bg-surface: #09090b;
    --bg-surface-elevated: #18181b;
    --bg-surface-alt: #18181b;
    --bg-surface-subtle: #27272a;
    --bg-surface-hover: #27272a;
    --bg-surface-active: #3f3f46;
    --bg-input: #09090b;
    --bg-overlay: rgba(0, 0, 0, 0.8);

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-subtle: #52525b;
    --text-inverse: #09090b;

    --primary: #fafafa;
    --primary-hover: #f4f4f5;
    --primary-active: #e4e4e7;
    --primary-light: #27272a;
    --primary-dark: #f4f4f5;
    --primary-fg: #18181b;
    --primary-border: #3f3f46;

    --accent: #3b82f6;
    --accent-light: rgba(59, 130, 246, 0.16);
    --accent-fg: #93c5fd;

    --border-subtle: #18181b;
    --border-default: #27272a;
    --border-strong: #3f3f46;
    --border-focus: #fafafa;
    --ring-focus: rgba(250, 250, 250, 0.25);

    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 14px;
    --radius-card: 10px;
    --radius-input: 8px;
    --radius-btn: 8px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.65);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4);

    --glass-bg: #09090b;
    --glass-border: #27272a;
    --glass-blur: none;
    --glass-card-border-top: #27272a;
}

/* ==========================================================================
   THEME 4: Material Design 3 (Material You / Tonal Surfaces)
   ========================================================================== */
/* Material 3 Light */
[data-theme="material-light"],
[data-theme="material"][data-mode="light"],
[data-theme="material"]:not([data-mode="dark"]) {
    --theme-name: "material-light";
    --bg-app: #fbf8fd;
    --bg-surface: #fbf8fd;
    --bg-surface-elevated: #f3edf7;
    --bg-surface-alt: #ede6f2;
    --bg-surface-subtle: #e6e0ec;
    --bg-surface-hover: #ded7e5;
    --bg-surface-active: #d2cadb;
    --bg-input: #ede6f2;
    --bg-overlay: rgba(26, 28, 30, 0.5);

    --text-primary: #1d1b20;
    --text-secondary: #49454f;
    --text-muted: #79747e;
    --text-subtle: #938f99;

    --primary: #6750a4;
    --primary-hover: #735cae;
    --primary-active: #533e8d;
    --primary-light: #eaddff;
    --primary-dark: #533e8d;
    --primary-fg: #ffffff;
    --primary-border: #cac4d0;

    --accent: #7d5260;
    --accent-light: #ffd8e4;
    --accent-fg: #31111d;

    --border-subtle: #e6e0ec;
    --border-default: #cac4d0;
    --border-strong: #79747e;
    --border-focus: #6750a4;
    --ring-focus: rgba(103, 80, 164, 0.28);

    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-pill: 9999px;
    --radius-card: 16px;
    --radius-input: 12px;
    --radius-btn: 20px;

    --shadow-sm: 0 1px 3px 1px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 2px 6px 2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px 3px rgba(0, 0, 0, 0.12);
    --shadow-card: 0 1px 3px 1px rgba(0, 0, 0, 0.08);

    --glass-bg: #f3edf7;
    --glass-border: #cac4d0;
    --glass-blur: none;
    --glass-card-border-top: #cac4d0;
}

/* Material 3 Dark */
[data-theme="material-dark"],
[data-theme="material"][data-mode="dark"] {
    --theme-name: "material-dark";
    --bg-app: #141218;
    --bg-surface: #141218;
    --bg-surface-elevated: #211f26;
    --bg-surface-alt: #2b2930;
    --bg-surface-subtle: #36343b;
    --bg-surface-hover: #403e46;
    --bg-surface-active: #4a4852;
    --bg-input: #2b2930;
    --bg-overlay: rgba(0, 0, 0, 0.7);

    --text-primary: #e6e0e9;
    --text-secondary: #cac4d0;
    --text-muted: #938f99;
    --text-subtle: #79747e;
    --text-inverse: #141218;

    --primary: #d0bcff;
    --primary-hover: #dcceff;
    --primary-active: #b99bf7;
    --primary-light: #4f378b;
    --primary-dark: #b99bf7;
    --primary-fg: #381e72;
    --primary-border: #49454f;

    --accent: #efb8c8;
    --accent-light: #492532;
    --accent-fg: #ffd8e4;

    --border-subtle: #2b2930;
    --border-default: #49454f;
    --border-strong: #938f99;
    --border-focus: #d0bcff;
    --ring-focus: rgba(208, 188, 255, 0.35);

    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-pill: 9999px;
    --radius-card: 16px;
    --radius-input: 12px;
    --radius-btn: 20px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4);

    --glass-bg: #211f26;
    --glass-border: #49454f;
    --glass-blur: none;
    --glass-card-border-top: #49454f;
}

/* ==========================================================================
   THEME 5: Notion-inspired Minimal (Warm & Editorial)
   ========================================================================== */
/* Notion Light */
[data-theme="notion-light"],
[data-theme="notion"][data-mode="light"],
[data-theme="notion"]:not([data-mode="dark"]) {
    --theme-name: "notion-light";
    --bg-app: #fffefc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #ffffff;
    --bg-surface-alt: #f7f6f3;
    --bg-surface-subtle: #f1f0ec;
    --bg-surface-hover: #eae9e4;
    --bg-surface-active: #dfddd6;
    --bg-input: #f7f6f3;
    --bg-overlay: rgba(15, 15, 15, 0.4);

    --text-primary: #37352f;
    --text-secondary: #787774;
    --text-muted: #9b9a97;
    --text-subtle: #c4c3c0;

    --primary: #2eaadc;
    --primary-hover: #1f9ece;
    --primary-active: #1a88b2;
    --primary-light: #e8f4f9;
    --primary-dark: #1a88b2;
    --primary-fg: #ffffff;
    --primary-border: #e1e0dc;

    --accent: #d9730d;
    --accent-light: #faece0;
    --accent-fg: #8a3f00;

    --border-subtle: #f1f0ec;
    --border-default: #e9e8e4;
    --border-strong: #d3d1cb;
    --border-focus: #2eaadc;
    --ring-focus: rgba(46, 170, 220, 0.25);

    --radius-xs: 3px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
    --radius-card: 6px;
    --radius-input: 4px;
    --radius-btn: 4px;

    --shadow-sm: none;
    --shadow-md: 0 4px 12px rgba(15, 15, 15, 0.05);
    --shadow-lg: 0 12px 24px rgba(15, 15, 15, 0.08);
    --shadow-card: none;

    --glass-bg: #ffffff;
    --glass-border: #e9e8e4;
    --glass-blur: none;
    --glass-card-border-top: #e9e8e4;
}

/* Notion Dark */
[data-theme="notion-dark"],
[data-theme="notion"][data-mode="dark"] {
    --theme-name: "notion-dark";
    --bg-app: #191919;
    --bg-surface: #202020;
    --bg-surface-elevated: #252525;
    --bg-surface-alt: #2c2c2c;
    --bg-surface-subtle: #333333;
    --bg-surface-hover: #3d3d3d;
    --bg-surface-active: #474747;
    --bg-input: #272727;
    --bg-overlay: rgba(0, 0, 0, 0.7);

    --text-primary: #ffffff;
    --text-secondary: #979797;
    --text-muted: #757575;
    --text-subtle: #575757;
    --text-inverse: #191919;

    --primary: #529cca;
    --primary-hover: #67aadc;
    --primary-active: #3e88b6;
    --primary-light: rgba(82, 156, 202, 0.16);
    --primary-dark: #3e88b6;
    --primary-fg: #ffffff;
    --primary-border: #373737;

    --accent: #ff9f43;
    --accent-light: rgba(255, 159, 67, 0.16);
    --accent-fg: #ffc078;

    --border-subtle: #272727;
    --border-default: #333333;
    --border-strong: #444444;
    --border-focus: #529cca;
    --ring-focus: rgba(82, 156, 202, 0.3);

    --radius-xs: 3px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
    --radius-card: 6px;
    --radius-input: 4px;
    --radius-btn: 4px;

    --shadow-sm: none;
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.5);
    --shadow-card: none;

    --glass-bg: #202020;
    --glass-border: #333333;
    --glass-blur: none;
    --glass-card-border-top: #333333;
}

/* ==========================================================================
   THEME 6: Cyber Dark (High-tech Neon Sci-Fi)
   ========================================================================== */
[data-theme="cyber-dark"],
[data-theme="cyber"] {
    --theme-name: "cyber-dark";
    --bg-app: #050811;
    --bg-surface: #0a0e1a;
    --bg-surface-elevated: #0f1526;
    --bg-surface-alt: #131c33;
    --bg-surface-subtle: #192442;
    --bg-surface-hover: #1e2c52;
    --bg-surface-active: #273868;
    --bg-input: #080c17;
    --bg-overlay: rgba(2, 4, 10, 0.88);

    --text-primary: #00f0ff;
    --text-secondary: #7ce9ff;
    --text-muted: #4ba3b6;
    --text-subtle: #2a6472;
    --text-inverse: #050811;

    --primary: #00f0ff;
    --primary-hover: #33f3ff;
    --primary-active: #00b8c4;
    --primary-light: rgba(0, 240, 255, 0.15);
    --primary-dark: #00b8c4;
    --primary-fg: #050811;
    --primary-border: #00f0ff;

    --accent: #ff0055;
    --accent-light: rgba(255, 0, 85, 0.18);
    --accent-fg: #ff4d88;

    --success: #00ff9f;
    --success-light: rgba(0, 255, 159, 0.15);
    --success-fg: #00ff9f;
    --danger: #ff0055;
    --danger-light: rgba(255, 0, 85, 0.18);
    --danger-fg: #ff0055;
    --warning: #ffb800;
    --warning-light: rgba(255, 184, 0, 0.15);
    --warning-fg: #ffb800;

    --border-subtle: rgba(0, 240, 255, 0.15);
    --border-default: rgba(0, 240, 255, 0.3);
    --border-strong: rgba(0, 240, 255, 0.6);
    --border-focus: #00f0ff;
    --ring-focus: rgba(0, 240, 255, 0.45);

    --radius-xs: 2px;
    --radius-sm: 3px;
    --radius-md: 4px;
    --radius-lg: 6px;
    --radius-xl: 8px;
    --radius-card: 4px;
    --radius-input: 3px;
    --radius-btn: 3px;

    --shadow-sm: 0 0 8px rgba(0, 240, 255, 0.15);
    --shadow-md: 0 0 16px rgba(0, 240, 255, 0.25);
    --shadow-lg: 0 0 32px rgba(0, 240, 255, 0.35);
    --shadow-card: 0 0 12px rgba(0, 240, 255, 0.12), inset 0 0 8px rgba(0, 240, 255, 0.05);
    --shadow-glow: 0 0 20px rgba(0, 240, 255, 0.5);

    --glass-bg: rgba(10, 14, 26, 0.94);
    --glass-border: rgba(0, 240, 255, 0.35);
    --glass-blur: blur(8px);
    --glass-card-border-top: rgba(0, 240, 255, 0.5);
}

/* ==========================================================================
   GLOBAL COMPONENT THEME ADAPTATIONS
   ========================================================================== */

/* ── Typography & Smooth Theme Transitions ── */
body, .app-header, .tab-nav, .controls-bar, .table-compact-bar, .cow-card,
.modal-content, .photos-filter-panel, .pagination-bar, table, th, td {
    transition: background-color var(--transition-normal),
                border-color var(--transition-normal),
                color var(--transition-fast),
                box-shadow var(--transition-normal);
}

/* ── App Header ── */
.app-header {
    background: var(--glass-bg) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-default) !important;
    color: var(--text-primary) !important;
    box-shadow: var(--shadow-sm) !important;
}

.header-left h1 {
    color: var(--text-primary) !important;
    font-weight: 700;
}

.user-info {
    color: var(--primary) !important;
    font-weight: 600;
}

#syncStatusBadgeHeader {
    background: var(--bg-surface-subtle) !important;
    border: 1px solid var(--border-default) !important;
    color: var(--text-secondary) !important;
}

#syncStatusBadgeHeader:hover {
    background: var(--bg-surface-hover) !important;
    border-color: var(--border-strong) !important;
}

/* ── Tab Navigation ── */
.tab-nav {
    background: var(--bg-surface) !important;
    border-bottom: 1px solid var(--border-default) !important;
}

.tab-btn {
    color: var(--text-secondary) !important;
    border-bottom: 3px solid transparent !important;
}

.tab-btn:hover {
    color: var(--primary) !important;
    background: var(--bg-surface-hover) !important;
}

.tab-btn.active {
    color: var(--primary) !important;
    border-bottom-color: var(--primary) !important;
    background: transparent !important;
}

.tab-dropdown-menu .tab-dropdown-item {
    border-bottom: none !important;
    color: var(--text-primary) !important;
    background: transparent !important;
}

.tab-dropdown-menu .tab-dropdown-item:hover {
    background: var(--bg-surface-hover) !important;
    color: var(--primary) !important;
}

.tab-dropdown-menu .tab-dropdown-item.active {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
}

.tab-subnav-bar .tab-subnav-item {
    border: 1px solid var(--border-default) !important;
    background: var(--bg-surface) !important;
    color: var(--text-secondary) !important;
}

.tab-subnav-bar .tab-subnav-item.active {
    background: var(--primary) !important;
    color: var(--primary-fg) !important;
    border-color: var(--primary) !important;
}

/* ── Search & Controls Bar ── */
.controls-bar {
    background: var(--bg-surface) !important;
    border-bottom: 1px solid var(--border-default) !important;
}

.table-compact-bar {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-card) !important;
    box-shadow: var(--shadow-card) !important;
}

.search-input,
.table-quick-search-wrapper .search-input {
    background: var(--bg-input) !important;
    border: 1.5px solid var(--border-default) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-input) !important;
}

.search-input:focus,
.table-quick-search-wrapper .search-input:focus {
    background: var(--bg-surface) !important;
    border-color: var(--border-focus) !important;
    box-shadow: 0 0 0 3px var(--ring-focus) !important;
}

.search-icon,
.table-quick-search-wrapper .search-icon {
    color: var(--text-muted) !important;
}

.filter-pill-select {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-default) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-input) !important;
}

.stats-badge {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    border-radius: var(--radius-pill) !important;
}

.stats-badge .count {
    background: var(--primary) !important;
    color: var(--primary-fg) !important;
}

.mobile-filter-arrow-btn {
    background: var(--bg-surface-subtle) !important;
    border: 1px solid var(--border-default) !important;
    color: var(--text-secondary) !important;
    border-radius: var(--radius-pill) !important;
}

.mobile-filter-arrow-btn.active {
    background: var(--primary) !important;
    color: var(--primary-fg) !important;
    border-color: var(--primary) !important;
}

/* ── Cow Cards View ── */
.cow-card {
    background: var(--glass-bg) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border) !important;
    border-top: 1px solid var(--glass-card-border-top) !important;
    border-radius: var(--radius-card) !important;
    box-shadow: var(--shadow-card) !important;
    color: var(--text-primary) !important;
}

.cow-card:hover {
    border-color: var(--primary-border) !important;
    box-shadow: var(--shadow-md) !important;
    transform: translateY(-3px);
}

.card-header {
    border-bottom: 1px solid var(--border-subtle) !important;
}

.card-body-number {
    color: var(--primary) !important;
}

.card-cow-avatar-wrap {
    background: var(--bg-surface-alt) !important;
    border: 1.5px solid var(--border-default) !important;
    border-radius: var(--radius-sm) !important;
}

.card-cow-avatar-wrap:hover {
    border-color: var(--primary) !important;
}

.card-bcode {
    background: var(--accent-light) !important;
    color: var(--accent-fg) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-pill) !important;
}

.card-detail-row {
    border-bottom: 1px solid var(--border-subtle) !important;
}

.card-label {
    color: var(--text-muted) !important;
}

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

/* ── Table View ── */
.table-scroll {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-card) !important;
    box-shadow: var(--shadow-card) !important;
}

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

thead th {
    background: var(--bg-surface-alt) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    color: var(--text-secondary) !important;
    border-bottom: 1.5px solid var(--border-strong) !important;
}

thead th:first-child {
    background: var(--bg-surface-alt) !important;
    border-left: 1px solid var(--border-default) !important;
}

tbody td {
    border-bottom: 1px solid var(--border-subtle) !important;
    color: var(--text-primary) !important;
}

tbody td:first-child {
    background: var(--bg-surface) !important;
    color: var(--primary) !important;
    border-left: 1px solid var(--border-default) !important;
}

tbody tr:nth-child(even) td {
    background: var(--bg-surface-subtle) !important;
}

tbody tr:hover td {
    background: var(--primary-light) !important;
}

tbody tr:hover td:first-child {
    background: var(--primary-light) !important;
}

/* ── Pagination ── */
.pagination-bar {
    background: var(--glass-bg) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top: 1.5px solid var(--border-default) !important;
    box-shadow: var(--shadow-sm) !important;
}

/* ── Pagination Buttons (Scoped strictly to pagination so it never breaks action buttons) ── */
.pagination-bar .page-btn {
    background: var(--bg-surface) !important;
    border: 1.5px solid var(--border-default) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-btn) !important;
}

.pagination-bar .page-btn:hover:not(:disabled) {
    background: var(--primary-light) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.pagination-bar .page-btn:disabled {
    background: var(--bg-surface-subtle) !important;
    border-color: var(--border-subtle) !important;
    color: var(--text-subtle) !important;
}

/* Generic secondary/outline button default */
.page-btn {
    background: var(--bg-surface);
    border: 1.5px solid var(--border-default);
    color: var(--text-primary);
    border-radius: var(--radius-btn);
}

/* ── Primary Action Buttons (Never White-on-White, Always High-Contrast) ── */
#spermSearchBtn,
#fullcardSearchBtn,
#photosApplyBtn,
#report24hRefreshBtn,
.table-apply-btn,
.primary-btn,
.btn-save,
.btn-primary,
.view-toggle-btn.active,
.baskol-btn-primary {
    background: var(--primary) !important;
    color: var(--primary-fg) !important;
    border: 1px solid var(--primary-border, transparent) !important;
    box-shadow: var(--shadow-sm) !important;
}

#spermSearchBtn:hover,
#fullcardSearchBtn:hover,
#photosApplyBtn:hover,
#report24hRefreshBtn:hover,
.table-apply-btn:hover,
.primary-btn:hover,
.btn-save:hover,
.baskol-btn-primary:hover {
    background: var(--primary-hover) !important;
    color: var(--primary-fg) !important;
    box-shadow: var(--shadow-md) !important;
}

/* ── Secondary / Reset Outline Buttons ── */
.photos-reset-btn,
.table-reset-quick-btn,
.btn-cancel,
.btn-quick,
.view-toggle-btn,
.settings-btn {
    background: var(--bg-surface) !important;
    border: 1.5px solid var(--border-default) !important;
    color: var(--text-secondary) !important;
    border-radius: var(--radius-btn) !important;
}

.photos-reset-btn:hover,
.table-reset-quick-btn:hover,
.btn-cancel:hover,
.btn-quick:hover,
.view-toggle-btn:hover,
.settings-btn:hover {
    background: var(--bg-surface-hover) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-strong) !important;
}

/* ── Sperm Recommendation Tab Adaptive Theme ── */
#tab-sperm .search-wrapper {
    background: var(--bg-surface) !important;
    border: 1.5px solid var(--border-default) !important;
    box-shadow: var(--shadow-card) !important;
}

#tab-sperm .search-wrapper:focus-within {
    background: var(--bg-surface) !important;
    border-color: var(--border-focus) !important;
    box-shadow: 0 0 0 3px var(--ring-focus) !important;
}

#tab-sperm #spermBodyInput,
#tab-sperm .search-input {
    color: var(--text-primary) !important;
    background: transparent !important;
}

#tab-sperm .search-icon {
    color: var(--text-muted) !important;
}

#tab-sperm label {
    background: var(--bg-surface-subtle) !important;
    border: 1px solid var(--border-default) !important;
    color: var(--text-secondary) !important;
}

#tab-sperm label:hover {
    background: var(--bg-surface-hover) !important;
    border-color: var(--border-strong) !important;
    color: var(--text-primary) !important;
}

.sperm-recommendation-card {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-default) !important;
    color: var(--text-primary) !important;
}

.sperm-chip-row {
    background: var(--bg-surface-alt) !important;
    border: 1px solid var(--border-subtle) !important;
}

.sperm-chip-label {
    color: var(--text-muted) !important;
}

.sperm-chip-value {
    color: var(--primary) !important;
}

.sperm-summary-banner {
    background: var(--bg-surface-subtle) !important;
    border: 1px solid var(--border-default) !important;
}

.sperm-pill-badge {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-default) !important;
    color: var(--text-primary) !important;
}

.page-info {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    border: 1px solid var(--primary-border) !important;
    border-radius: var(--radius-pill) !important;
}

.rows-select {
    background: var(--bg-surface) !important;
    border: 1.5px solid var(--border-default) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-input) !important;
}

/* ── Modals & Popovers ── */
.modal-overlay {
    background: var(--bg-overlay) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-lg) !important;
    color: var(--text-primary) !important;
}

.modal-header {
    border-bottom: 2px solid var(--border-subtle) !important;
}

.modal-body-num {
    color: var(--primary) !important;
}

.modal-close {
    background: var(--bg-surface-subtle) !important;
    border: 1.5px solid var(--border-default) !important;
    color: var(--text-secondary) !important;
}

.modal-close:hover {
    background: var(--bg-surface-hover) !important;
    color: var(--text-primary) !important;
}

.section-title {
    color: var(--primary) !important;
    border-right-color: var(--primary) !important;
}

.info-item {
    background: var(--bg-surface-alt) !important;
    border-radius: var(--radius-sm) !important;
}

.info-label {
    color: var(--text-muted) !important;
}

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

.detail-tab-btn {
    background: var(--bg-surface-subtle) !important;
    border: 1px solid var(--border-default) !important;
    color: var(--text-secondary) !important;
    border-radius: var(--radius-pill) !important;
}

.detail-tab-btn:hover {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.detail-tab-btn.active {
    background: var(--primary) !important;
    color: var(--primary-fg) !important;
    border-color: var(--primary) !important;
}

/* ── Filter Drawers & Panels ── */
.photos-filter-panel,
.table-filter-panel {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-default) !important;
    box-shadow: var(--shadow-lg) !important;
    color: var(--text-primary) !important;
}

.table-filter-header-sticky,
.table-filter-footer-sticky {
    background: var(--bg-surface-alt) !important;
    border-color: var(--border-default) !important;
}

.table-filter-item {
    background: var(--bg-surface-alt) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-sm) !important;
}

.table-filter-item:hover {
    border-color: var(--border-strong) !important;
}

.table-filter-item.has-filter {
    border-color: var(--primary) !important;
    background: var(--primary-light) !important;
}

/* ── Buttons & Common UI Elements ── */
.admin-btn {
    background: var(--primary) !important;
    color: var(--primary-fg) !important;
    border-radius: var(--radius-pill) !important;
}

.logout-btn {
    background: var(--danger) !important;
    color: #ffffff !important;
    border-radius: var(--radius-pill) !important;
}

.table-filter-toggle-btn {
    background: var(--primary) !important;
    color: var(--primary-fg) !important;
    border: 1.5px solid var(--primary-dark) !important;
    border-radius: var(--radius-pill) !important;
}

.table-filter-toggle-btn.active {
    background: var(--bg-surface-active) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-strong) !important;
}

/* ── Jalali Datepicker Popover ── */
.de-jalali-popover {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
}

.de-jalali-header,
.de-jalali-footer {
    border-color: var(--border-subtle) !important;
}

.de-jalali-select-month,
.de-jalali-select-year {
    background: var(--bg-input) !important;
    color: var(--primary) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-xs) !important;
}

.de-jalali-nav-btn {
    background: var(--bg-surface-subtle) !important;
    border: 1px solid var(--border-default) !important;
    color: var(--text-secondary) !important;
    border-radius: var(--radius-xs) !important;
}

.de-jalali-nav-btn:hover {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
}

.de-jalali-day-cell {
    border-radius: var(--radius-sm) !important;
    color: var(--text-primary);
}

.de-jalali-day-cell:hover:not(.empty) {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
}

.de-jalali-day-cell.selected {
    background: var(--primary) !important;
    color: var(--primary-fg) !important;
    box-shadow: 0 2px 8px var(--ring-focus) !important;
}

.de-jalali-day-cell.today {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

/* ── Cyber Dark Theme Special Glow Effects ── */
[data-theme="cyber-dark"] .cow-card,
[data-theme="cyber"] .cow-card {
    border-image: linear-gradient(135deg, rgba(0, 240, 255, 0.4), transparent, rgba(255, 0, 85, 0.3)) 1;
}

[data-theme="cyber-dark"] .app-header,
[data-theme="cyber"] .app-header {
    border-bottom: 1px solid #00f0ff !important;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.25) !important;
}

[data-theme="cyber-dark"] .search-input:focus,
[data-theme="cyber"] .search-input:focus {
    box-shadow: 0 0 14px rgba(0, 240, 255, 0.4) !important;
}

/* ==========================================================================
   THEME SELECTOR MODAL & HEADER BUTTON STYLES
   ========================================================================== */
.theme-selector-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-pill);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.theme-selector-trigger-btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-xs);
}

.theme-selector-trigger-btn:active {
    transform: scale(0.96);
}

.theme-selector-trigger-btn .theme-btn-icon {
    font-size: 1rem;
    line-height: 1;
}

.theme-selector-trigger-btn .theme-btn-label {
    white-space: nowrap;
}

@media (max-width: 600px) {
    .theme-selector-trigger-btn {
        padding: 0 8px;
        height: 30px;
    }
    .theme-selector-trigger-btn .theme-btn-label {
        display: none;
    }
}

/* ── Theme Modal Dialog ── */
.theme-modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.theme-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.theme-modal-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 820px;
    max-height: 90vh;
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    direction: rtl;
    color: var(--text-primary);
}

.theme-modal-overlay.active .theme-modal-box {
    transform: scale(1) translateY(0);
}

.theme-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface-alt);
    flex-shrink: 0;
}

.theme-modal-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-modal-title-group h2 {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-primary);
}

.theme-modal-title-group p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
}

.theme-modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.theme-modal-close-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.theme-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

/* ── Light / Dark Mode Global Switcher ── */
.theme-mode-switch-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}

.theme-mode-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.theme-mode-label strong {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.theme-mode-label span {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.theme-mode-toggle-group {
    display: inline-flex;
    padding: 3px;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-pill);
    gap: 4px;
}

.theme-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: none;
    background: transparent;
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.theme-mode-btn.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ── Theme Cards Grid ── */
.theme-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.theme-preview-card {
    background: var(--bg-surface-alt);
    border: 2px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 14px;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    user-select: none;
}

.theme-preview-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.theme-preview-card.active {
    border-color: var(--primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--ring-focus), var(--shadow-md);
}

.theme-card-badge-active {
    position: absolute;
    top: -10px;
    left: 12px;
    background: var(--primary);
    color: var(--primary-fg);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
    display: none;
}

.theme-preview-card.active .theme-card-badge-active {
    display: inline-block;
}

/* ── Miniature Visual Preview Box Inside Card ── */
.theme-mini-viewport {
    height: 105px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

.mini-header {
    height: 18px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
}

.mini-dots {
    display: flex;
    gap: 3px;
}

.mini-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.mini-content {
    flex: 1;
    display: flex;
    gap: 6px;
}

.mini-card {
    flex: 1;
    border-radius: 6px;
    padding: 5px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.mini-line {
    height: 4px;
    border-radius: 2px;
}

.mini-btn {
    height: 14px;
    border-radius: 3px;
    align-self: flex-start;
    padding: 0 8px;
}

/* ── Card Info ── */
.theme-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.theme-card-title-group h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.theme-card-title-group span {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.theme-card-icon {
    font-size: 1.3rem;
}

.theme-card-desc {
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
    flex: 1;
}

.theme-color-swatches {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-subtle);
}

.swatch-item {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--bg-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.theme-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface-alt);
    flex-shrink: 0;
}

.theme-modal-footer p {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin: 0;
}

.theme-apply-confirm-btn {
    background: var(--primary);
    color: var(--primary-fg);
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius-btn);
    font-weight: 700;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-apply-confirm-btn:hover {
    filter: brightness(1.1);
}


/* ── Additional Component Adaptations: Baskol, AI Chat, Data Entry & Admin ── */
.baskol-stat-card,
.baskol-card,
.report24h-stat-card,
.card {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-card) !important;
    box-shadow: var(--shadow-card) !important;
    color: var(--text-primary) !important;
}

.baskol-sub-nav,
.baskol-subtab-btn {
    background: var(--bg-surface-subtle) !important;
    border-color: var(--border-default) !important;
    color: var(--text-secondary) !important;
}

.baskol-subtab-btn.active {
    background: var(--primary) !important;
    color: var(--primary-fg) !important;
    border-color: var(--primary) !important;
}

/* AI Chat Box */
.ai-chat-container {
    background: var(--bg-surface) !important;
    border-color: var(--border-default) !important;
}

.ai-chat-header {
    background: var(--bg-surface-alt) !important;
    border-bottom: 1px solid var(--border-default) !important;
}

.ai-message.ai-msg-bot {
    background: var(--bg-surface-alt) !important;
    border: 1px solid var(--border-default) !important;
    color: var(--text-primary) !important;
}

.ai-message.ai-msg-user {
    background: var(--primary-light) !important;
    border: 1px solid var(--primary-border) !important;
    color: var(--primary) !important;
}

.ai-chat-input-wrap textarea {
    background: var(--bg-input) !important;
    border: 1.5px solid var(--border-default) !important;
    color: var(--text-primary) !important;
}

/* Data Entry Form Fields */
.entry-form-row input,
.entry-form-row select,
.cr-form-control {
    background: var(--bg-input) !important;
    border: 1.5px solid var(--border-default) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-input) !important;
}

/* Admin Panel Components */
.admin-tabs-bar {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-card) !important;
}

.admin-tab-btn {
    color: var(--text-secondary) !important;
    border-radius: var(--radius-sm) !important;
}

.admin-tab-btn:hover {
    background: var(--bg-surface-hover) !important;
    color: var(--primary) !important;
}

.admin-tab-btn.active {
    background: var(--primary) !important;
    color: var(--primary-fg) !important;
}

.admin-back-btn {
    background: var(--bg-surface-subtle) !important;
    border: 1px solid var(--border-default) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-pill) !important;
}

.admin-back-btn:hover {
    background: var(--bg-surface-hover) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}


/* ── Settings Tab Page Styles ── */
.settings-page-wrapper {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 20px));
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-header-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    flex-wrap: wrap;
    gap: 12px;
}

.settings-header-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-header-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.settings-header-title-wrap h2 {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0 0 4px 0;
    color: var(--text-primary);
}

.settings-header-title-wrap p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
}

.settings-subtabs-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.settings-subtab-btn {
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    border: 1.5px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.settings-subtab-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--primary);
    border-color: var(--primary);
}

.settings-subtab-btn.active {
    background: var(--primary) !important;
    color: var(--primary-fg) !important;
    border-color: var(--primary) !important;
    box-shadow: var(--shadow-sm);
}

.settings-subtab-pane {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.settings-subtab-pane.active {
    display: flex;
}

.theme-mode-switch-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    flex-wrap: wrap;
    gap: 12px;
}

.theme-mode-info h3 {
    font-size: 0.96rem;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: var(--text-primary);
}

.theme-mode-info p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
}

.settings-section-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.settings-section-header h3 {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0 0 4px 0;
    color: var(--text-primary);
}

.settings-section-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.theme-active-status-pill {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-border);
    padding: 4px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 700;
}

.settings-theme-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
}


/* ═════════════════════════════════════════════
   فاز ۱ — فونت فارسی وزیرمتن (بارگذاری محلی)
   ═════════════════════════════════════════════ */
@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ═════════════════════════════════════════════
   فاز ۶ — مقیاس لایه‌بندی Z-Index
   ═════════════════════════════════════════════ */
:root {
    --z-sticky: 10;
    --z-dropdown: 100;
    --z-overlay: 1000;
    --z-modal: 1100;
    --z-popover: 1200;
    --z-toast: 1300;
}

/* ═════════════════════════════════════════════
   فاز ۹ — دسترس‌پذیری: فوکوس و کاهش حرکت
   ═════════════════════════════════════════════ */
:focus-visible {
    outline: 2px solid var(--primary, #0071e3);
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ═════════════════════════════════════════════
   فاز ۲ — کامپوننت‌های مشترک حالت خالی و بارگذاری
   ═════════════════════════════════════════════ */
.loading-placeholder,
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted, #64748b);
    font-size: 1rem;
}
.empty-state-sub {
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
    margin-top: 6px;
}

/* ═════════════════════════════════════════════
   فاز ۱۲ — اسکلتون بارگذاری (Skeleton Loading)
   ═════════════════════════════════════════════ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input, #f1f5f9) 25%, var(--bg-surface, #ffffff) 50%, var(--bg-input, #f1f5f9) 75%);
    background-size: 200% 100%;
    animation: skeleton-wave 1.4s infinite;
    border-radius: 8px;
    min-height: 16px;
    color: transparent !important;
}
@keyframes skeleton-wave {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ═════════════════════════════════════════════
   فاز ۱۱ — هدر استاندارد مودال‌ها بر پایه تم
   ═════════════════════════════════════════════ */
.modal-header-default { background: var(--primary, #1e6f8c); color: var(--primary-fg, #fff); }
.modal-header-danger  { background: var(--danger, #dc2626); color: #fff; }
.modal-header-success { background: var(--success, #27875a); color: #fff; }
