/* =========================================================
   DengueCare — Design System v2.3
   Tokens unificados, breakpoints, utilidades base
   ---------------------------------------------------------
   Se carga DESPUÉS de styles.css para extender sin romper.
   ========================================================= */

/* ---------------------------------------------------------
   Breakpoints — fuente única de verdad
   sm  ≥ 640px (móvil grande)
   md  ≥ 768px (tablet)
   lg  ≥ 1024px (laptop)
   xl  ≥ 1280px (desktop)
   2xl ≥ 1536px (ancho)
   --------------------------------------------------------- */
:root {
  --bp-sm: 640px;
  --bp-md: 768px;
  --bp-lg: 1024px;
  --bp-xl: 1280px;
  --bp-2xl: 1536px;

  /* z-index scale — predecible */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-overlay: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-toast: 700;
  --z-tooltip: 800;

  /* Espaciado fluido extra */
  --spacing-2xs: 4px;
  --spacing-2xl: 64px;
  --spacing-3xl: 96px;

  /* Header heights — referencia compartida */
  --header-h: 64px;
  --header-h-mobile: 56px;

  /* Sidebar widths */
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 72px;

  /* Container widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1200px;

  /* Focus ring institucional */
  --focus-ring: 0 0 0 3px rgba(192, 24, 42, 0.25);
  --focus-ring-offset: 2px;
}

[data-theme="dark"] {
  --focus-ring: 0 0 0 3px rgba(232, 51, 74, 0.30);
}

/* ---------------------------------------------------------
   Accesibilidad — focus visible institucional
   --------------------------------------------------------- */
*:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 6px;
}

/* Sólo aplica focus visual en elementos que naturalmente lo necesitan */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---------------------------------------------------------
   Layout — Containers
   --------------------------------------------------------- */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(16px, 4vw, 32px);
  padding-right: clamp(16px, 4vw, 32px);
}
.container-sm { max-width: var(--container-sm); }
.container-md { max-width: var(--container-md); }
.container-lg { max-width: var(--container-lg); }
.container-xl { max-width: var(--container-xl); }

/* ---------------------------------------------------------
   Iconografía SVG (reemplaza emojis)
   --------------------------------------------------------- */
.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.icon-xs { width: 12px; height: 12px; }
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }
.icon-2xl { width: 40px; height: 40px; }
.icon-3xl { width: 56px; height: 56px; }

.icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--color-accent-glow);
  color: var(--color-accent);
  border: 1px solid var(--color-red-border);
}
.icon-tile.lg { width: 52px; height: 52px; }
.icon-tile.xl { width: 64px; height: 64px; border-radius: 14px; }
.icon-tile.neutral {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border-color: var(--color-border);
}
.icon-tile.success {
  background: var(--color-green-bg);
  color: var(--color-green);
  border-color: var(--color-green-border);
}
.icon-tile.warning {
  background: var(--color-yellow-bg);
  color: var(--color-yellow);
  border-color: var(--color-yellow-border);
}
.icon-tile.danger {
  background: var(--color-red-bg);
  color: var(--color-red);
  border-color: var(--color-red-border);
}

/* ---------------------------------------------------------
   Tipografía — escala consistente
   --------------------------------------------------------- */
.text-xs   { font-size: 0.72rem; line-height: 1.4; }
.text-sm   { font-size: 0.85rem; line-height: 1.5; }
.text-base { font-size: 0.95rem; line-height: 1.6; }
.text-lg   { font-size: 1.05rem; line-height: 1.55; }
.text-xl   { font-size: 1.2rem;  line-height: 1.4; }
.text-2xl  { font-size: 1.5rem;  line-height: 1.3; }
.text-3xl  { font-size: 1.875rem; line-height: 1.2; }
.text-4xl  { font-size: 2.25rem; line-height: 1.15; }

.text-muted { color: var(--color-text-muted); }
.text-dim   { color: var(--color-text-dim); }
.text-accent { color: var(--color-accent); }
.text-success { color: var(--color-green); }
.text-warning { color: var(--color-yellow); }
.text-danger { color: var(--color-red); }

.font-display { font-family: var(--font-display); }
.font-body    { font-family: var(--font-body); }
.font-mono    { font-family: var(--font-mono); }

.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

/* ---------------------------------------------------------
   Badges institucionales (sin emojis)
   --------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.4;
  white-space: nowrap;
}
.badge .icon { width: 12px; height: 12px; }
.badge-accent {
  background: var(--color-accent-glow);
  border-color: var(--color-red-border);
  color: var(--color-accent);
}
.badge-success {
  background: var(--color-green-bg);
  border-color: var(--color-green-border);
  color: var(--color-green);
}
.badge-warning {
  background: var(--color-yellow-bg);
  border-color: var(--color-yellow-border);
  color: var(--color-yellow);
}
.badge-danger {
  background: var(--color-red-bg);
  border-color: var(--color-red-border);
  color: var(--color-red);
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-dot.pulse { animation: pulse 2s ease infinite; }

/* ---------------------------------------------------------
   Tarjetas institucionales (clinical card)
   --------------------------------------------------------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
}
.card.compact { padding: 16px; }
.card.spacious { padding: 32px; }
.card.elevated { box-shadow: var(--shadow-sm); }
.card.interactive {
  cursor: pointer;
}
.card.interactive:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}
.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
}
.card-subtitle {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ---------------------------------------------------------
   Stack & cluster helpers
   --------------------------------------------------------- */
.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: var(--stack-gap, 12px); }
.stack-xs { --stack-gap: 6px; }
.stack-sm { --stack-gap: 10px; }
.stack-md { --stack-gap: 16px; }
.stack-lg { --stack-gap: 24px; }
.stack-xl { --stack-gap: 32px; }

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cluster-gap, 12px);
  align-items: center;
}
.cluster-sm { --cluster-gap: 8px; }
.cluster-lg { --cluster-gap: 20px; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-center  { display: flex; align-items: center; justify-content: center; gap: 12px; }

/* ---------------------------------------------------------
   Skeleton loading (UX médica — feedback)
   --------------------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg,
    var(--color-surface-2) 0%,
    var(--color-surface-3) 50%,
    var(--color-surface-2) 100%);
  background-size: 200% 100%;
  animation: skeletonShine 1.4s ease-in-out infinite;
  border-radius: 6px;
  color: transparent;
  pointer-events: none;
}
@keyframes skeletonShine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------------------------------------------------------
   Divider semántico
   --------------------------------------------------------- */
.divider {
  height: 1px;
  background: var(--color-border);
  border: none;
  margin: var(--spacing-md) 0;
}
.divider.vertical {
  width: 1px;
  height: auto;
  align-self: stretch;
  margin: 0 var(--spacing-md);
}

/* ---------------------------------------------------------
   Visibility helpers por breakpoint
   --------------------------------------------------------- */
.hide-mobile { display: initial; }
.hide-desktop { display: none; }

@media (max-width: 767px) {
  .hide-mobile  { display: none !important; }
  .hide-desktop { display: initial !important; }
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------
   Print — quitar elementos decorativos
   --------------------------------------------------------- */
@media print {
  .no-print, .navbar, .nav-landing, .nav-drawer-backdrop { display: none !important; }
  body::before { display: none; }
}
