/* ==========================================================================
   LIQUID ANIMATED GLASS DESIGN SYSTEM
   Cyber Readiness & Threat Analytics (Enhanced Mission Control)
   ========================================================================== */

/* --- GOOGLE FONTS IMPORT (with offline system font fallbacks) --- */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --liquid-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --liquid-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --liquid-snap: cubic-bezier(0.4, 0, 0.2, 1);

  --font-ar: 'Cairo', 'Segoe UI', -apple-system, BlinkMacSystemFont, Tahoma, sans-serif;
  --font-en: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-xl: 34px;
  --radius-full: 9999px;
}

/* ==========================================================================
   THEME PALETTES (CYBER, NEBULA, EMERALD, CRIMSON, AURORA)
   ========================================================================== */

/* 1. CYBER THEME (DEFAULT OLED DEEP SPACE & CYAN) */
html,
html[data-theme="cyber"] {
  --bg-primary: #040711;
  --bg-surface: #0a101f;
  --bg-card: rgba(14, 23, 42, 0.65);
  --bg-card-hover: rgba(22, 36, 66, 0.8);
  --bg-glass: rgba(10, 16, 31, 0.72);
  --bg-glass-heavy: rgba(8, 13, 25, 0.88);
  --bg-glass-input: rgba(15, 23, 42, 0.6);

  --border-subtle: rgba(56, 189, 248, 0.14);
  --border-active: #38bdf8;
  --border-glass: rgba(255, 255, 255, 0.08);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-cyan: #38bdf8;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;

  --glow-accent: rgba(56, 189, 248, 0.35);
  --glow-ambient-1: rgba(56, 189, 248, 0.12);
  --glow-ambient-2: rgba(59, 130, 246, 0.08);
  --glow-ambient-3: rgba(168, 85, 247, 0.06);

  --shadow-card: 0 16px 36px -10px rgba(0, 0, 0, 0.65), inset 0 1px 1px 0 rgba(255, 255, 255, 0.08);
  --shadow-glass: 0 20px 50px -15px rgba(0, 0, 0, 0.8), inset 0 1px 1px 0 rgba(255, 255, 255, 0.18), inset 0 -1px 1px 0 rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 30px rgba(56, 189, 248, 0.28);
}

/* 2. NEBULA THEME (COSMIC VIOLET & INDIGO) */
html[data-theme="nebula"] {
  --bg-primary: #070512;
  --bg-surface: #0f0b24;
  --bg-card: rgba(24, 17, 52, 0.65);
  --bg-card-hover: rgba(36, 26, 78, 0.8);
  --bg-glass: rgba(15, 11, 36, 0.72);
  --bg-glass-heavy: rgba(11, 8, 27, 0.88);
  --bg-glass-input: rgba(24, 17, 52, 0.6);

  --border-subtle: rgba(168, 85, 247, 0.16);
  --border-active: #c084fc;
  --border-glass: rgba(255, 255, 255, 0.09);

  --text-primary: #faf5ff;
  --text-secondary: #c4b5fd;
  --text-muted: #8b5cf6;

  --accent-cyan: #818cf8;
  --accent-blue: #6366f1;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;
  --accent-rose: #f472b6;
  --accent-purple: #c084fc;

  --glow-accent: rgba(192, 132, 252, 0.35);
  --glow-ambient-1: rgba(192, 132, 252, 0.13);
  --glow-ambient-2: rgba(129, 140, 248, 0.09);
  --glow-ambient-3: rgba(244, 114, 182, 0.07);

  --shadow-card: 0 16px 36px -10px rgba(0, 0, 0, 0.7), inset 0 1px 1px 0 rgba(255, 255, 255, 0.1);
  --shadow-glass: 0 20px 50px -15px rgba(0, 0, 0, 0.85), inset 0 1px 1px 0 rgba(255, 255, 255, 0.2);
  --shadow-glow: 0 0 30px rgba(192, 132, 252, 0.3);
}

/* 3. EMERALD THEME (TACTICAL MATRIX DEFENSE) */
html[data-theme="emerald"] {
  --bg-primary: #020906;
  --bg-surface: #06150e;
  --bg-card: rgba(10, 30, 20, 0.65);
  --bg-card-hover: rgba(15, 46, 31, 0.8);
  --bg-glass: rgba(6, 21, 14, 0.72);
  --bg-glass-heavy: rgba(4, 16, 11, 0.88);
  --bg-glass-input: rgba(10, 30, 20, 0.6);

  --border-subtle: rgba(16, 185, 129, 0.16);
  --border-active: #34d399;
  --border-glass: rgba(255, 255, 255, 0.08);

  --text-primary: #f0fdf4;
  --text-secondary: #a7f3d0;
  --text-muted: #4ade80;

  --accent-cyan: #34d399;
  --accent-blue: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #facc15;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;

  --glow-accent: rgba(52, 211, 153, 0.35);
  --glow-ambient-1: rgba(16, 185, 129, 0.14);
  --glow-ambient-2: rgba(52, 211, 153, 0.09);
  --glow-ambient-3: rgba(56, 189, 248, 0.06);

  --shadow-card: 0 16px 36px -10px rgba(0, 0, 0, 0.75), inset 0 1px 1px 0 rgba(255, 255, 255, 0.08);
  --shadow-glass: 0 20px 50px -15px rgba(0, 0, 0, 0.85), inset 0 1px 1px 0 rgba(255, 255, 255, 0.18);
  --shadow-glow: 0 0 30px rgba(52, 211, 153, 0.32);
}

/* 4. CRIMSON THEME (HIGH-ALERT GUARDIAN) */
html[data-theme="crimson"] {
  --bg-primary: #0a0406;
  --bg-surface: #17090e;
  --bg-card: rgba(36, 14, 22, 0.65);
  --bg-card-hover: rgba(54, 21, 33, 0.8);
  --bg-glass: rgba(23, 9, 14, 0.72);
  --bg-glass-heavy: rgba(16, 6, 10, 0.88);
  --bg-glass-input: rgba(36, 14, 22, 0.6);

  --border-subtle: rgba(244, 63, 94, 0.16);
  --border-active: #fb7185;
  --border-glass: rgba(255, 255, 255, 0.09);

  --text-primary: #fff1f2;
  --text-secondary: #fecdd3;
  --text-muted: #fb7185;

  --accent-cyan: #fb7185;
  --accent-blue: #38bdf8;
  --accent-emerald: #34d399;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #c084fc;

  --glow-accent: rgba(251, 113, 133, 0.35);
  --glow-ambient-1: rgba(244, 63, 94, 0.14);
  --glow-ambient-2: rgba(251, 146, 60, 0.08);
  --glow-ambient-3: rgba(236, 72, 153, 0.07);

  --shadow-card: 0 16px 36px -10px rgba(0, 0, 0, 0.75), inset 0 1px 1px 0 rgba(255, 255, 255, 0.1);
  --shadow-glass: 0 20px 50px -15px rgba(0, 0, 0, 0.85), inset 0 1px 1px 0 rgba(255, 255, 255, 0.2);
  --shadow-glow: 0 0 30px rgba(251, 113, 133, 0.32);
}

/* 5. AURORA THEME (CRYSTAL TEAL & IRIDESCENCE) */
html[data-theme="aurora"] {
  --bg-primary: #04090b;
  --bg-surface: #09161a;
  --bg-card: rgba(13, 33, 40, 0.65);
  --bg-card-hover: rgba(20, 50, 60, 0.8);
  --bg-glass: rgba(9, 22, 26, 0.72);
  --bg-glass-heavy: rgba(6, 16, 19, 0.88);
  --bg-glass-input: rgba(13, 33, 40, 0.6);

  --border-subtle: rgba(45, 212, 191, 0.16);
  --border-active: #2dd4bf;
  --border-glass: rgba(255, 255, 255, 0.09);

  --text-primary: #f0fdfa;
  --text-secondary: #99f6e4;
  --text-muted: #2dd4bf;

  --accent-cyan: #2dd4bf;
  --accent-blue: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #fbbf24;
  --accent-rose: #f472b6;
  --accent-purple: #a855f7;

  --glow-accent: rgba(45, 212, 191, 0.35);
  --glow-ambient-1: rgba(45, 212, 191, 0.13);
  --glow-ambient-2: rgba(56, 189, 248, 0.09);
  --glow-ambient-3: rgba(168, 85, 247, 0.07);

  --shadow-card: 0 16px 36px -10px rgba(0, 0, 0, 0.7), inset 0 1px 1px 0 rgba(255, 255, 255, 0.1);
  --shadow-glass: 0 20px 50px -15px rgba(0, 0, 0, 0.85), inset 0 1px 1px 0 rgba(255, 255, 255, 0.18);
  --shadow-glow: 0 0 30px rgba(45, 212, 191, 0.32);
}

/* ==========================================================================
   LIGHT MODE OVERRIDES FOR ALL THEMES
   ========================================================================== */

html[data-mode="light"] {
  --bg-primary: #f3f6fc;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.82);
  --bg-card-hover: rgba(241, 245, 249, 0.95);
  --bg-glass: rgba(255, 255, 255, 0.84);
  --bg-glass-heavy: rgba(255, 255, 255, 0.96);
  --bg-glass-input: rgba(241, 245, 249, 0.85);

  --border-subtle: rgba(148, 163, 184, 0.28);
  --border-active: #0284c7;
  --border-glass: rgba(255, 255, 255, 0.6);

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --accent-cyan: #0284c7;
  --accent-blue: #2563eb;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  --accent-purple: #7c3aed;

  --glow-accent: rgba(2, 132, 199, 0.2);
  --glow-ambient-1: rgba(2, 132, 199, 0.08);
  --glow-ambient-2: rgba(37, 99, 235, 0.06);
  --glow-ambient-3: rgba(124, 58, 237, 0.04);

  --shadow-card: 0 8px 24px -4px rgba(15, 23, 42, 0.08), inset 0 1px 1px 0 rgba(255, 255, 255, 0.9);
  --shadow-glass: 0 14px 34px -8px rgba(15, 23, 42, 0.12), inset 0 1px 2px 0 rgba(255, 255, 255, 1);
  --shadow-glow: 0 0 20px rgba(2, 132, 199, 0.16);
}

html[data-mode="light"][data-theme="nebula"] {
  --bg-primary: #f6f3ff;
  --border-active: #7c3aed;
  --accent-cyan: #6366f1;
  --accent-purple: #7c3aed;
  --glow-accent: rgba(124, 58, 237, 0.2);
}

html[data-mode="light"][data-theme="emerald"] {
  --bg-primary: #f0fdf4;
  --border-active: #059669;
  --accent-cyan: #059669;
  --accent-emerald: #059669;
  --glow-accent: rgba(5, 150, 105, 0.2);
}

html[data-mode="light"][data-theme="crimson"] {
  --bg-primary: #fff1f2;
  --border-active: #e11d48;
  --accent-cyan: #e11d48;
  --accent-rose: #e11d48;
  --glow-accent: rgba(225, 29, 72, 0.2);
}

html[data-mode="light"][data-theme="aurora"] {
  --bg-primary: #f0fdfa;
  --border-active: #0d9488;
  --accent-cyan: #0d9488;
  --glow-accent: rgba(13, 148, 136, 0.2);
}

/* ==========================================================================
   AMBIENT BACKGROUND DYNAMICS & SCANLINE GRID
   ========================================================================== */

body {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-ar);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  transition: background-color 450ms var(--liquid-smooth), color 450ms var(--liquid-smooth);
}

html[dir="ltr"] body {
  font-family: var(--font-en);
}

/* Ambient Liquid Orbs (GPU-accelerated, pointer-events none) */
.liquid-ambient-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.liquid-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.6;
  mix-blend-mode: screen;
  will-change: transform;
  animation: liquidOrbFloat 24s ease-in-out infinite alternate;
}

html[data-mode="light"] .liquid-orb {
  mix-blend-mode: multiply;
  opacity: 0.45;
  filter: blur(75px);
}

.liquid-orb-1 {
  width: 550px;
  height: 550px;
  top: -120px;
  left: 10%;
  background: radial-gradient(circle, var(--glow-ambient-1) 0%, transparent 70%);
  animation-duration: 22s;
}

.liquid-orb-2 {
  width: 650px;
  height: 650px;
  bottom: 5%;
  right: 5%;
  background: radial-gradient(circle, var(--glow-ambient-2) 0%, transparent 70%);
  animation-duration: 28s;
  animation-delay: -6s;
}

.liquid-orb-3 {
  width: 450px;
  height: 450px;
  top: 45%;
  left: 60%;
  background: radial-gradient(circle, var(--glow-ambient-3) 0%, transparent 70%);
  animation-duration: 20s;
  animation-delay: -11s;
}

@keyframes liquidOrbFloat {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  50% {
    transform: translate3d(40px, -35px, 0) scale(1.1);
  }

  100% {
    transform: translate3d(-30px, 45px, 0) scale(0.92);
  }
}

/* Micro Tactical Grid Overlay */
.liquid-tactical-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--border-subtle) 1px, transparent 0);
  background-size: 32px 32px;
  opacity: 0.35;
}

/* ==========================================================================
   LIQUID GLASS FLOATING ISLAND HEADER
   ========================================================================== */

.app-header-container {
  position: sticky;
  top: 14px;
  z-index: 90;
  padding: 0 24px;
  max-width: 1440px;
  margin: 0 auto 16px;
}

.app-header-island {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-glass);
  transition: all 350ms var(--liquid-smooth);
  position: relative;
}

.app-header-island::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  padding: 1px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent 45%, var(--border-subtle) 90%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Brand Section */
.app-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.app-shield-badge {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-card-hover), var(--bg-surface));
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-size: 1.35rem;
  flex-shrink: 0;
  transition: transform 300ms var(--liquid-spring);
}

.app-shield-badge:hover {
  transform: scale(1.08) rotate(-4deg);
}

.app-shield-pulse {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--accent-cyan);
  opacity: 0.5;
  animation: shieldPulse 2.8s cubic-bezier(0.24, 0, 0.38, 1) infinite;
  pointer-events: none;
}

@keyframes shieldPulse {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }

  70% {
    transform: scale(1.35);
    opacity: 0;
  }

  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.app-title-block h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.25;
}

.app-title-block small {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.tlp-amber-pill {
  font-size: 0.64rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tlp-amber-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

/* Header Action Controls */
.app-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   LIQUID BUTTONS & CONTROLS ARCHITECTURE (DOUBLE-BEZEL)
   ========================================================================== */

.liquid-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  outline: none;
  user-select: none;
  overflow: hidden;
  transition: color 250ms var(--liquid-smooth),
    background 250ms var(--liquid-smooth),
    border-color 250ms var(--liquid-smooth),
    transform 180ms var(--liquid-spring),
    box-shadow 250ms var(--liquid-smooth);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.08);
}

.liquid-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  transform: translateY(-1.5px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25), var(--shadow-glow);
}

.liquid-btn:active {
  transform: translateY(0.5px) scale(0.97);
}

/* Button-in-Button Nested Icon */
.liquid-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.88rem;
  transition: transform 220ms var(--liquid-spring), background 220ms var(--liquid-smooth);
}

.liquid-btn:hover .liquid-btn-icon {
  transform: scale(1.12);
  background: color-mix(in srgb, var(--accent-cyan) 25%, transparent);
}

/* Fluid Liquid Ripple Effect */
.liquid-ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 70%);
  transform: scale(0);
  animation: liquidRippleAnim 600ms cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
  pointer-events: none;
}

@keyframes liquidRippleAnim {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ==========================================================================
   AR / EN DUAL-PILL LIQUID TOGGLE SWITCH
   ========================================================================== */

.liquid-lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
  cursor: pointer;
  user-select: none;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.liquid-lang-option {
  position: relative;
  z-index: 2;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  transition: color 250ms var(--liquid-smooth);
  display: flex;
  align-items: center;
  gap: 5px;
}

.liquid-lang-switch[data-lang="ar"] .liquid-lang-option.opt-ar,
.liquid-lang-switch[data-lang="en"] .liquid-lang-option.opt-en {
  color: var(--text-primary);
}

.liquid-lang-slider {
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: calc(50% - 3px);
  border-radius: var(--radius-full);
  background: var(--accent-cyan);
  box-shadow: 0 2px 10px var(--glow-accent);
  z-index: 1;
  transition: transform 320ms var(--liquid-spring);
}

/* RTL / LTR slider translation */
html[dir="rtl"] .liquid-lang-switch[data-lang="ar"] .liquid-lang-slider {
  transform: translateX(0);
}

html[dir="rtl"] .liquid-lang-switch[data-lang="en"] .liquid-lang-slider {
  transform: translateX(-100%);
}

html[dir="ltr"] .liquid-lang-switch[data-lang="ar"] .liquid-lang-slider {
  transform: translateX(100%);
}

html[dir="ltr"] .liquid-lang-switch[data-lang="en"] .liquid-lang-slider {
  transform: translateX(0);
}

/* Language slider text contrast in light / dark */
.liquid-lang-switch[data-lang="ar"] .liquid-lang-option.opt-ar,
.liquid-lang-switch[data-lang="en"] .liquid-lang-option.opt-en {
  color: #ffffff;
}

html[data-mode="light"] .liquid-lang-switch[data-lang="ar"] .liquid-lang-option.opt-ar,
html[data-mode="light"] .liquid-lang-switch[data-lang="en"] .liquid-lang-option.opt-en {
  color: #ffffff;
}

/* ==========================================================================
   COLOR THEME TOGGLE & PALETTE DROPDOWN
   ========================================================================== */

.theme-dropdown-wrap {
  position: relative;
}

.liquid-theme-btn {
  padding: 8px 12px;
}

.theme-palette-menu {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  width: 250px;
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glass);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  transition: all 260ms var(--liquid-spring);
  z-index: 100;
}

.theme-palette-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.theme-palette-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 4px 6px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theme-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: start;
  transition: all 200ms var(--liquid-smooth);
}

.theme-palette-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-subtle);
  transform: translateX(3px);
}

html[dir="rtl"] .theme-palette-item:hover {
  transform: translateX(-3px);
}

.theme-palette-item.active {
  background: color-mix(in srgb, var(--accent-cyan) 16%, transparent);
  border-color: var(--border-active);
  color: var(--text-primary);
  font-weight: 700;
}

.theme-swatch-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.swatch-cyber {
  background: linear-gradient(135deg, #040711 50%, #38bdf8 50%);
}

.swatch-nebula {
  background: linear-gradient(135deg, #070512 50%, #c084fc 50%);
}

.swatch-emerald {
  background: linear-gradient(135deg, #020906 50%, #34d399 50%);
}

.swatch-crimson {
  background: linear-gradient(135deg, #0a0406 50%, #fb7185 50%);
}

.swatch-aurora {
  background: linear-gradient(135deg, #04090b 50%, #2dd4bf 50%);
}

/* Mode Switch Row inside Theme Menu */
.theme-mode-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.theme-mode-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 180ms var(--liquid-smooth);
}

.theme-mode-btn:hover,
.theme-mode-btn.active {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-active);
}

/* ==========================================================================
   LIQUID ANIMATED TABS WITH FLOATING GLIDER
   ========================================================================== */

.tab-nav-wrapper {
  max-width: 1440px;
  margin: 0 auto 20px;
  padding: 0 24px;
}

.tab-nav-liquid {
  position: relative;
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-glass);
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-nav-liquid::-webkit-scrollbar {
  display: none;
}

/* Liquid Sliding Glider (The Morphing Capsule) */
.liquid-tab-glider {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 0;
  width: 0;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-cyan) 25%, var(--bg-surface)), var(--bg-card-hover));
  border: 1px solid var(--border-active);
  box-shadow: var(--shadow-glow), 0 4px 14px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  pointer-events: none;
  z-index: 1;
  transition: transform 380ms var(--liquid-spring),
    width 340ms var(--liquid-spring),
    background 350ms var(--liquid-smooth);
}

/* Tab Button */
.liquid-tab-btn {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  outline: none;
  user-select: none;
  transition: color 250ms var(--liquid-smooth), transform 160ms var(--liquid-spring);
}

.liquid-tab-btn:hover {
  color: var(--text-primary);
}

.liquid-tab-btn.active {
  color: var(--text-primary);
}

.liquid-tab-btn:active {
  transform: scale(0.96);
}

.liquid-tab-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  transition: all 250ms var(--liquid-smooth);
}

.liquid-tab-btn.active .liquid-tab-badge {
  background: color-mix(in srgb, var(--accent-cyan) 25%, transparent);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* ==========================================================================
   FLOATING COMMAND DOCK & QUICK TOOLS
   ========================================================================== */

.liquid-dock {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 85;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.75), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  transition: all 300ms var(--liquid-smooth);
}

.liquid-dock:hover {
  box-shadow: 0 24px 55px -10px rgba(0, 0, 0, 0.85), var(--shadow-glow);
  transform: translateX(-50%) translateY(-2px);
}

.dock-item {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 220ms var(--liquid-spring);
  outline: none;
}

.dock-item:hover {
  transform: scale(1.18) translateY(-4px);
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), var(--shadow-glow);
}

.dock-item:active {
  transform: scale(0.95);
}

.dock-divider {
  width: 1px;
  height: 22px;
  background: var(--border-subtle);
  margin: 0 2px;
}

.dock-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  opacity: 0;
  pointer-events: none;
  transition: all 180ms var(--liquid-smooth);
}

.dock-item:hover .dock-tooltip {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ==========================================================================
   LIQUID GLASS MODALS (SEARCH, SUMMARY, DOSSIER)
   ========================================================================== */

.liquid-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all 280ms var(--liquid-smooth);
}

.liquid-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.liquid-modal-card {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass), 0 25px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  transition: transform 320ms var(--liquid-spring);
}

.liquid-modal-overlay.open .liquid-modal-card {
  transform: translateY(0) scale(1);
}

.liquid-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-glass);
}

.liquid-modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.liquid-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 180ms var(--liquid-smooth);
}

.liquid-modal-close:hover {
  background: var(--accent-rose);
  color: #fff;
  border-color: var(--accent-rose);
  transform: scale(1.1) rotate(90deg);
}

.liquid-modal-body {
  padding: 24px;
  overflow-y: auto;
  line-height: 1.7;
}

/* Instant Search Input in Modal */
.modal-search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--bg-glass-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  transition: border-color 200ms;
}

.modal-search-box:focus-within {
  border-color: var(--border-active);
  box-shadow: 0 0 15px var(--glow-accent);
}

.modal-search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text-primary);
}

.modal-search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.search-result-item {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 200ms var(--liquid-smooth);
}

.search-result-item:hover {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
  transform: translateX(4px);
}

html[dir="rtl"] .search-result-item:hover {
  transform: translateX(-4px);
}

/* ==========================================================================
   DOUBLE-BEZEL CARD UPGRADES (REINFORCING BASE STYLES)
   ========================================================================== */

.section-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
  transition: border-color 300ms var(--liquid-smooth), box-shadow 300ms var(--liquid-smooth);
}

.section-card:hover {
  border-color: color-mix(in srgb, var(--border-active) 35%, var(--border-subtle));
}

.ins-kpi,
.pt-card,
.rd-card {
  border-radius: var(--radius-md);
  transition: all 240ms var(--liquid-smooth);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.ins-kpi:hover,
.pt-card:hover,
.rd-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-active);
  box-shadow: var(--shadow-glow);
}

/* ==========================================================================
   MOBILE & RESPONSIVE CONSTRAINTS (< 768px)
   ========================================================================== */

@media (max-width: 768px) {
  .app-header-container {
    padding: 0 12px;
    top: 8px;
  }

  .app-header-island {
    padding: 8px 14px;
    border-radius: var(--radius-lg);
  }

  .app-title-block h1 {
    font-size: 0.92rem;
  }

  .app-title-block small {
    display: none;
  }

  .tab-nav-wrapper {
    padding: 0 12px;
  }

  .liquid-tab-btn {
    padding: 8px 14px;
    font-size: 0.78rem;
  }

  .liquid-dock {
    bottom: 14px;
    padding: 6px 10px;
    gap: 6px;
  }

  .dock-item {
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
  }

  .section-card {
    padding: 16px;
    border-radius: var(--radius-md);
  }
}