/**
 * Plataforma NeuroTech TDAH Adulto
 * Design System Neuroergonômico Mobile & Tokens de Interface
 * 
 * Conformidade com WCAG 2.1 AAA, Atkinson Hyperlegible e Thumb Zone Ergonomics.
 */

:root {
  /* Paleta Base Charcoal (Low-Arousal, Anti-Halation para OLED) */
  --bg-charcoal: #16181A;
  --surface-elevated: #22252A;
  --surface-card: #2A2E35;
  --border-subtle: #3A3F47;
  
  /* Cores de Acento Funcionais */
  --accent-cyan: #00D2D3;
  --accent-emerald: #05C46B;
  --accent-amber: #FFA801;
  --accent-coral: #FF5E57;
  --accent-indigo: #6366F1;
  
  /* Tipografia & Contraste */
  --text-high-contrast: #F5F6FA;
  --text-muted: #A4B0BE;
  --text-dim: #94A3B8; /* Atualizado para conformidade WCAG AA/AAA */
  
  /* Ergonomia de Toque (Fitts's Law) */
  --touch-target-min: 48px;
  --touch-target-large: 56px;
  --touch-target-fab: 56px;
  --touch-radius-standard: 12px;
  --touch-radius-pill: 9999px;
  --bottom-nav-height: 64px;
}

/* 1. Alvos de Toque Seguros */
.touch-target {
  min-height: var(--touch-target-min);
  min-width: var(--touch-target-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.12s ease;
}

.touch-target:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.touch-target-lg {
  min-height: var(--touch-target-large);
  min-width: var(--touch-target-large);
}

/* 2. Botão Central Herói Integrado à Barra Inferior (Thumb Zone Ambidestro) */
.nav-fab-hero-notch {
  position: relative;
  top: -18px;
  width: var(--touch-target-fab);
  height: var(--touch-target-fab);
  border-radius: var(--touch-radius-pill);
  background: linear-gradient(135deg, #FF5E57 0%, #D63031 100%);
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(255, 94, 87, 0.55), 0 0 0 4px #16181A;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  border: 2px solid rgba(255, 255, 255, 0.4);
  animation: pulse-stuck-subtle 3s infinite ease-in-out;
  transition: transform 0.15s ease;
}

.nav-fab-hero-notch:active {
  transform: scale(0.94);
}

/* Fallback legado para o botão flutuante */
.fab-stuck-sovereign {
  position: fixed;
  bottom: 24px;
  right: 20px;
  width: var(--touch-target-fab);
  height: var(--touch-target-fab);
  border-radius: var(--touch-radius-pill);
  background: linear-gradient(135deg, #FF5E57 0%, #D63031 100%);
  color: #FFFFFF;
  box-shadow: 0 8px 24px rgba(255, 94, 87, 0.45), 0 0 0 4px #16181A;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  border: 2px solid rgba(255, 255, 255, 0.3);
  animation: pulse-stuck-subtle 3s infinite ease-in-out;
}

@keyframes pulse-stuck-subtle {
  0%, 100% {
    box-shadow: 0 8px 20px rgba(255, 94, 87, 0.55), 0 0 0 4px #16181A;
    transform: scale(1);
  }
  50% {
    box-shadow: 0 10px 28px rgba(255, 94, 87, 0.75), 0 0 0 4px #16181A;
    transform: scale(1.03);
  }
}

/* 2.1 Botões Padronizados do Design System */
.btn-primary {
  min-height: var(--touch-target-min);
  padding: 10px 20px;
  border-radius: var(--touch-radius-standard);
  background: linear-gradient(135deg, #00D2D3 0%, #00A8A9 100%);
  color: #0D0F11;
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1.25rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  border: none;
  box-shadow: 0 4px 14px rgba(0, 210, 211, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.12s ease, opacity 0.12s ease;
}

.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(0, 210, 211, 0.2);
  opacity: 0.95;
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  min-height: var(--touch-target-min);
  padding: 10px 20px;
  border-radius: var(--touch-radius-standard);
  background-color: var(--surface-elevated);
  color: var(--text-high-contrast);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.25rem;
  border: 1px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.12s ease, border-color 0.12s ease;
}

.btn-secondary:hover {
  background-color: var(--surface-card);
  border-color: #4A515D;
}

.btn-secondary:active {
  transform: scale(0.97);
  background-color: var(--surface-card);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* 3. Cards com Elevação Suave */
.neuro-card {
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--touch-radius-standard);
  padding: 16px;
  color: var(--text-high-contrast);
}

.neuro-card-highlight {
  background-color: var(--surface-card);
  border: 1.5px solid var(--accent-cyan);
}

/* 4. Animação Ressonante Vagal (0.10 Hz = ciclo de 10s) */
.animate-vagal-pulse {
  animation: vagal-respiration 10s infinite ease-in-out;
}

@keyframes vagal-respiration {
  0%   { transform: scale(0.85); opacity: 0.7; }
  50%  { transform: scale(1.15); opacity: 1.0; }
  100% { transform: scale(0.85); opacity: 0.7; }
}

/* 5. Layout Adaptativo Dual-Pane (Dobráveis e Tablets) */
.dual-pane-container {
  display: flex;
  flex-direction: column;
  width: 100%;
}

@media (min-width: 768px) {
  .dual-pane-container {
    flex-direction: row;
    gap: 20px;
  }
  .dual-pane-left {
    flex: 0 0 55%;
    max-width: 55%;
    overflow-y: auto;
  }
  .dual-pane-right {
    flex: 0 0 45%;
    max-width: 45%;
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
    overflow-y: auto;
  }
}

/* 6. Garantia Estrita de Ocultação de Modais e Drawers */
.hidden {
  display: none !important;
}

/* 7. Blindagem de Safe Areas para Android Gesture Navigation Bar & iOS */
#mobile-top-bar {
  padding-top: max(8px, env(safe-area-inset-top));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

#mobile-bottom-nav {
  height: calc(var(--bottom-nav-height) + max(8px, env(safe-area-inset-bottom)));
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  padding-left: max(8px, env(safe-area-inset-left));
  padding-right: max(8px, env(safe-area-inset-right));
}

#mobile-screen-slot {
  padding-bottom: calc(var(--bottom-nav-height) + max(8px, env(safe-area-inset-bottom)) + 24px);
}
