/* ==========================================================================
   HealthExpress X — Sistema de Diseño HealthTech de Calma Clínica
   Codificación: UTF-8 (sin BOM)
   Paleta: Blancos Clínicos Cálidos · Verde Salvia Reconfortante · Azul Serenidad
   ========================================================================== */

:root {
  /* Superficies Clínicas Cálidas */
  --hx-bg-canvas: #F5F9F7;
  --hx-bg-surface: #FFFFFF;
  --hx-bg-subtle: #EEF5F1;

  /* Verde Salvia Reconfortante (Primario) */
  --hx-sage-50: #F2F7F4;
  --hx-sage-100: #E3EFE9;
  --hx-sage-200: #C8E0D5;
  --hx-sage-500: #528577;
  --hx-sage-600: #3E6E61;
  --hx-sage-700: #2F564B;

  /* Azul Suave de Serenidad (Telemedicina y Orientación) */
  --hx-sky-50: #EFF6FA;
  --hx-sky-100: #DCEBF5;
  --hx-sky-500: #4A82A6;
  --hx-sky-600: #396B8C;

  /* Tipografía y Contraste Suave (nunca negro puro agresivo) */
  --hx-ink-900: #1D2D28;
  --hx-ink-700: #3E524C;
  --hx-ink-500: #667B74;
  --hx-ink-300: #9EB0AA;

  /* Sombras Orgánicas Difusas */
  --hx-shadow-soft: 0 8px 28px -6px rgba(34, 68, 58, 0.06), 0 2px 8px -2px rgba(34, 68, 58, 0.04);
  --hx-shadow-elevated: 0 18px 42px -10px rgba(31, 64, 54, 0.11), 0 4px 14px -3px rgba(31, 64, 54, 0.05);
}

* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

html {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--hx-ink-900);
  background-color: var(--hx-bg-canvas);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: radial-gradient(circle at 15% 10%, #E7F2EC 0%, #F5F9F7 48%, #ECF4F8 100%);
  min-height: 100vh;
  min-height: 100dvh;
}

/* Números tabulares para horas exactas ("3:15 PM") y signos vitales ("118/76") */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Scrollbar sutil y limpio dentro del contenedor móvil en escritorio */
.hx-scroll {
  scrollbar-width: thin;
  scrollbar-color: #CBDCD4 transparent;
}

.hx-scroll::-webkit-scrollbar {
  width: 5px;
}

.hx-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.hx-scroll::-webkit-scrollbar-thumb {
  background-color: #CBDCD4;
  border-radius: 9999px;
}

/* Animación de entrada serena entre pantallas */
@keyframes hxFadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hx-animate-in {
  animation: hxFadeUp 0.34s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Respiración orgánica lenta para indicadores de estado estable */
@keyframes hxCalmPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.75;
  }
  50% {
    transform: scale(1.55);
    opacity: 0;
  }
}

.hx-calm-ping {
  animation: hxCalmPulse 3.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Latido cardíaco relajado (~68 lpm = 0.88s, muy sutil) */
@keyframes hxGentleHeart {
  0%, 100% {
    transform: scale(1);
  }
  18% {
    transform: scale(1.12);
  }
  34% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.07);
  }
  70% {
    transform: scale(1);
  }
}

.hx-heart-beat {
  animation: hxGentleHeart 1.76s ease-in-out infinite;
}

/* Indicador de escritura empático en el chat de triaje */
@keyframes hxTypingDot {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.hx-dot-1 { animation: hxTypingDot 1.3s infinite ease-in-out 0s; }
.hx-dot-2 { animation: hxTypingDot 1.3s infinite ease-in-out 0.18s; }
.hx-dot-3 { animation: hxTypingDot 1.3s infinite ease-in-out 0.36s; }

/* Línea suave de lectura óptica sobre el código QR dinámico */
@keyframes hxQrScan {
  0% {
    top: 8%;
    opacity: 0;
  }
  15% {
    opacity: 0.85;
  }
  85% {
    opacity: 0.85;
  }
  100% {
    top: 90%;
    opacity: 0;
  }
}

.hx-qr-scanline {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #3E6E61 25%, #56A38E 50%, #3E6E61 75%, transparent 100%);
  box-shadow: 0 0 10px rgba(62, 110, 97, 0.45);
  border-radius: 999px;
  pointer-events: none;
  animation: hxQrScan 3.6s ease-in-out infinite;
}

/* Trazo progresivo de gráficas SVG */
@keyframes hxDrawLine {
  from {
    stroke-dashoffset: 600;
  }
  to {
    stroke-dashoffset: 0;
  }
}

.hx-chart-line {
  stroke-dasharray: 600;
  animation: hxDrawLine 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Tarjetas con tacto sedoso */
.hx-card {
  background-color: var(--hx-bg-surface);
  box-shadow: var(--hx-shadow-soft);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.hx-card-interactive:hover {
  transform: translateY(-1.5px);
  box-shadow: var(--hx-shadow-elevated);
}

.hx-card-interactive:active {
  transform: translateY(0px) scale(0.992);
}

/* Soporte para notch / barra inferior en iOS y Android */
.pb-safe {
  padding-bottom: env(safe-area-inset-bottom, 0.5rem);
}
