/* =========================================================================
   Sona UI 4.0 & Universal Design System - Rodrigo Cunha Executive Hub
   Design Tokens, Surfaces, Glassmorphism, Micro-Interactions & WCAG 2.1 AA
   ========================================================================= */

:root {
  /* Paleta Primária & Acentos */
  --color-scarlet-600: #FF2400;
  --color-scarlet-500: #ff3d1a;
  --color-royal-600: #26619c;
  --color-royal-500: #3472ad;
  --color-emerald-600: #10b981;
  --color-emerald-500: #059669;
  --color-amber-500: #f59e0b;
  --color-purple-600: #9333ea;

  /* Modo Claro - Superfícies & Cores */
  --bg-base: #f8fafc;
  --bg-card: #ffffff;
  --bg-elevated: #f1f5f9;
  --border-subtle: rgba(226, 232, 240, 0.85);
  --border-strong: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569; /* Contraste WCAG 2.1 AA >= 4.5:1 */
  --text-muted: #64748b;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(226, 232, 240, 0.8);
  --shadow-card: 0 10px 30px -6px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --theme-primary: #26619c;
  --theme-glow: rgba(38, 97, 156, 0.25);
}

.dark {
  /* Modo Escuro - Superfícies & Cores */
  --bg-base: #06070a;
  --bg-card: #0d0f17;
  --bg-elevated: #131622;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1; /* Contraste WCAG 2.1 AA >= 4.5:1 */
  --text-muted: #94a3b8;
  --glass-bg: rgba(12, 16, 28, 0.82);
  --glass-border: rgba(255, 255, 255, 0.09);
  --shadow-card: 0 16px 40px -8px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.07);
  --theme-primary: #3472ad;
  --theme-glow: rgba(38, 97, 156, 0.35);
}

html {
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* =========================================================================
   1. ACESSIBILIDADE WCAG 2.1 AA
   ========================================================================= */

/* Foco Visível para Navegação por Teclado */
:focus-visible {
  outline: 2px solid var(--theme-primary, #2563eb) !important;
  outline-offset: 3px !important;
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -60px;
  left: 14px;
  background: var(--color-royal-600, #2563eb);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 13px;
  z-index: 9999;
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.5);
  transition: top 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}
.skip-link:focus {
  top: 14px;
}

/* Suporte RTL (Árabe) */
[dir="rtl"] {
  font-family: 'Noto Sans Arabic', 'Plus Jakarta Sans', sans-serif;
  text-align: right;
}
[dir="rtl"] .rtl-flip {
  transform: scaleX(-1);
}

/* =========================================================================
   2. SONA UI: COMPONENTES DE INTERFACE & SUPERFÍCIES
   ========================================================================= */

/* Floating Dock Header */
.floating-dock {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Fluid Nav Pill Container */
.fluid-nav-container {
  position: relative;
  display: flex;
  align-items: center;
}
.fluid-tab-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  pointer-events: none;
  transition: all 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 0;
}

/* Depth Tile 3D Tilt com Efeito Glow */
.depth-tile {
  position: relative;
  transform-style: preserve-3d;
  perspective: 1000px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  will-change: transform;
}
.depth-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.12), transparent 70%);
  z-index: 1;
}
.depth-tile:hover::before {
  opacity: 1;
}
.depth-tile:hover {
  box-shadow: 0 20px 40px -15px rgba(37, 99, 235, 0.18), 0 0 0 1px var(--theme-primary, rgba(37, 99, 235, 0.25));
}
.dark .depth-tile:hover {
  box-shadow: 0 24px 50px -15px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.15), 0 0 25px -5px var(--theme-glow, rgba(37, 99, 235, 0.3));
}

/* Marquee Máscara de Gradiente Suave (Fade nas bordas) */
.marquee-mask {
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

/* Aurora Gradient Border Effect para Cards em Destaque */
.aurora-border {
  position: relative;
  background-clip: padding-box;
}
.aurora-border::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.35), rgba(147, 51, 234, 0.25), rgba(37, 99, 235, 0.35));
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  pointer-events: none;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}
.aurora-border:hover::after {
  opacity: 1;
}

/* Sona UI: Cyber Card Smooth Elevation & Glow */
.cyber-card {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}
.cyber-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: 0 16px 36px -12px rgba(37, 99, 235, 0.12);
}
.dark .cyber-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.8), 0 0 20px -4px rgba(37, 99, 235, 0.25);
}

/* Sona UI: Ripple Button */
.btn-ripple {
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
}
.btn-ripple::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 10%, transparent 10.01%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10, 10);
  opacity: 0;
  transition: transform 0.5s, opacity 0.8s;
  pointer-events: none;
}
.btn-ripple:active::after {
  transform: scale(0, 0);
  opacity: 0.3;
  transition: 0s;
}

/* Sona UI: Morph Switch */
.sona-morph-switch {
  user-select: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.sona-morph-switch:hover {
  box-shadow: 0 0 16px -2px rgba(37, 99, 235, 0.3);
}
.sona-morph-switch-thumb {
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease;
}
.dark .sona-morph-switch-thumb {
  transform: translateX(20px);
}

/* Background Scanlines Sutis */
.dark .scanline-bg {
  background-image: linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 48px 48px;
}
.scanline-bg-light {
  background-image: linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* Canvas de esferas bio-digitais (células/sociedades) em background */
#interactive-bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: -20;
  opacity: 0.75;
  transition: opacity 0.5s ease;
}
.dark #interactive-bg-canvas {
  opacity: 0.88;
}

/* Scrollbar Personalizada e Discreta */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}
.dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}
.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* =========================================================================
   3. ANIMAÇÕES & MICRO-INTERAÇÕES (MARQUEE, EQUALIZER & TERMINAL)
   ========================================================================= */

/* Infinite Marquee */
@keyframes marqueeTrack {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marqueeTrack 38s linear infinite;
}
.marquee-container:hover .marquee-track {
  animation-play-state: paused;
}

/* Audio Briefing Waveform Equalizer */
@keyframes eqBarPulse {
  0% { height: 4px; }
  50% { height: 22px; }
  100% { height: 8px; }
}
.eq-bar.active:nth-child(odd) {
  animation: eqBarPulse 0.6s ease-in-out infinite alternate;
}
.eq-bar.active:nth-child(even) {
  animation: eqBarPulse 0.45s ease-in-out infinite alternate-reverse;
}

/* Terminal CLI Cursor Blink */
@keyframes termCursorBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
.term-cursor {
  animation: termCursorBlink 1s infinite;
}

/* =========================================================================
   4. RESPEITO A PREFERS REDUCED MOTION
   ========================================================================= */
@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;
  }
  .depth-tile {
    transform: none !important;
  }
  .cyber-card {
    transform: none !important;
  }
  .marquee-track {
    animation: none !important;
  }
  .eq-bar.active {
    animation: none !important;
  }
  #interactive-bg-canvas {
    display: none !important;
  }
}

/* =========================================================================
   5. ESTILOS DE IMPRESSÃO (CURRÍCULO EXECUTIVO A4)
   ========================================================================= */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  #main-header,
  #ai-concierge-container,
  #terminal-modal,
  .floating-dock,
  .skip-link,
  footer,
  button,
  #interactive-bg-canvas {
    display: none !important;
  }
  .print-page {
    page-break-after: always;
    box-shadow: none !important;
    border: none !important;
  }
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 80%;
    color: #555555;
  }
}
