/**
 * SUMAS Theme for DaisyUI 4
 *
 * Sistema Universitario para la Mejora de Alimentación, Sueño y Salud
 * Concepto: "Templado primaveral mediterráneo"
 *
 * Colores principales:
 *   - Primary: Verde Bosque #2D5A4A
 *   - Secondary: Terracota Profundo #A2663C (WCAG AA)
 *   - Accent: Terracota Claro #E8A87C
 *   - Base: Crema cálido #FAF8F5
 *
 * Accesibilidad: Todos los colores cumplen WCAG AA (ratio ≥ 4.5:1)
 *
 * Formato: OKLCH (lightness chroma hue) - lightness en decimal 0-1
 */

[data-theme="sumas"] {
  color-scheme: light;

  /* ============================================
     PRIMARY: Verde Bosque #2D5A4A
     ============================================ */
  --p: 0.4473 0.06 163.51;
  --pf: 0.38 0.05 163.51;
  --pc: 1 0 0;

  /* ============================================
     SECONDARY: Terracota Profundo #A2663C
     (Corregido para WCAG AA - ratio 4.66:1)
     ============================================ */
  --s: 0.57 0.10 54;
  --sf: 0.51 0.08 54;
  --sc: 1 0 0;

  /* ============================================
     ACCENT: Terracota Claro #E8A87C
     ============================================ */
  --a: 0.76 0.1 55;
  --af: 0.70 0.1 55;
  --ac: 0.30 0.02 55;

  /* ============================================
     NEUTRAL: Gris Cálido #5C5650
     ============================================ */
  --n: 0.42 0.02 60;
  --nf: 0.35 0.02 60;
  --nc: 0.97 0.01 90;

  /* ============================================
     BASE: Crema / Arena (Fondos)
     ============================================ */
  --b1: 0.98 0.01 90;
  --b2: 0.95 0.015 85;
  --b3: 0.92 0.02 80;
  --bc: 0.28 0.02 60;

  /* ============================================
     ESTADOS SEMÁNTICOS
     (Corregidos para WCAG AA - todos ≥4.5:1)
     ============================================ */
  --su: 0.55 0.12 163;  /* #0B855C - ratio 4.64:1 */
  --suc: 1 0 0;

  --wa: 0.57 0.13 59;   /* #B16104 - ratio 4.58:1 */
  --wac: 1 0 0;

  --er: 0.58 0.17 28;   /* #CA493E - ratio 4.63:1 */
  --erc: 1 0 0;

  --in: 0.4473 0.06 163.51;
  --inc: 1 0 0;

  /* ============================================
     BORDES Y RADIOS
     ============================================ */
  --rounded-box: 0.5rem;
  --rounded-btn: 0.5rem;
  --rounded-badge: 9999px;

  --animation-btn: 0.25s;
  --animation-input: 0.2s;
  --btn-focus-scale: 0.98;
}

/* ================================================
   TIPOGRAFÍA
   ================================================ */
[data-theme="sumas"] {
  font-family: 'Source Sans 3', 'Source Sans Pro', ui-sans-serif, system-ui, sans-serif;
}

[data-theme="sumas"] h1,
[data-theme="sumas"] h2,
[data-theme="sumas"] h3,
[data-theme="sumas"] h4,
[data-theme="sumas"] h5,
[data-theme="sumas"] h6,
[data-theme="sumas"] .card-title,
[data-theme="sumas"] .font-heading {
  font-family: 'Outfit', ui-sans-serif, system-ui, sans-serif;
}

/* ================================================
   CLASES UTILITARIAS SUMAS
   ================================================ */

/* Sombras con tono cálido */
.shadow-sumas-sm {
  box-shadow: 0 1px 2px 0 rgb(61 56 51 / 0.05);
}
.shadow-sumas-md {
  box-shadow: 0 4px 6px -1px rgb(61 56 51 / 0.07),
              0 2px 4px -2px rgb(61 56 51 / 0.05);
}
.shadow-sumas-lg {
  box-shadow: 0 10px 15px -3px rgb(61 56 51 / 0.08),
              0 4px 6px -4px rgb(61 56 51 / 0.05);
}

/* Sistema semáforo Mini-ECCA (WCAG AA) */
.semaforo-adecuado {
  background-color: oklch(0.55 0.12 163);  /* Success corregido */
  color: white;
}
.semaforo-mejora {
  background-color: oklch(0.57 0.13 59);   /* Warning corregido */
  color: white;
}
.semaforo-inadecuado {
  background-color: oklch(0.58 0.17 28);   /* Error corregido */
  color: white;
}

/* ================================================
   TEMA OSCURO: sumas-dark
   Mediterráneo nocturno - cálido pero oscuro
   ================================================ */

[data-theme="sumas-dark"] {
  color-scheme: dark;

  /* ============================================
     PRIMARY: Verde Bosque Luminoso #4A9080
     (Más brillante para contraste en fondo oscuro)
     ============================================ */
  --p: 0.58 0.08 165;
  --pf: 0.52 0.07 165;
  --pc: 0.15 0.02 165;

  /* ============================================
     SECONDARY: Terracota Luminoso #D4875A
     ============================================ */
  --s: 0.67 0.12 55;
  --sf: 0.60 0.11 55;
  --sc: 0.20 0.02 55;

  /* ============================================
     ACCENT: Terracota Suave #E8A87C
     ============================================ */
  --a: 0.76 0.1 55;
  --af: 0.70 0.1 55;
  --ac: 0.20 0.02 55;

  /* ============================================
     NEUTRAL: Piedra Clara #A8A29E
     ============================================ */
  --n: 0.70 0.01 60;
  --nf: 0.60 0.01 60;
  --nc: 0.15 0.01 60;

  /* ============================================
     BASE: Piedra Oscura Cálida (Fondos)
     #1C1917, #292524, #3D3733
     ============================================ */
  --b1: 0.15 0.01 50;   /* Fondo principal */
  --b2: 0.20 0.01 50;   /* Cards, secciones */
  --b3: 0.28 0.01 50;   /* Bordes, hover */
  --bc: 0.96 0.01 90;   /* Texto principal (crema claro) */

  /* ============================================
     ESTADOS SEMÁNTICOS (más brillantes para dark)
     ============================================ */
  --su: 0.65 0.20 145;  /* Verde brillante */
  --suc: 0.15 0.02 145;

  --wa: 0.70 0.17 70;   /* Ámbar brillante */
  --wac: 0.15 0.02 70;

  --er: 0.62 0.22 25;   /* Rojo brillante */
  --erc: 1 0 0;

  --in: 0.58 0.08 165;  /* Info = primary */
  --inc: 0.15 0.02 165;

  /* ============================================
     BORDES Y RADIOS (iguales que light)
     ============================================ */
  --rounded-box: 0.5rem;
  --rounded-btn: 0.5rem;
  --rounded-badge: 9999px;

  --animation-btn: 0.25s;
  --animation-input: 0.2s;
  --btn-focus-scale: 0.98;
}

/* Tipografía para dark mode */
[data-theme="sumas-dark"] {
  font-family: 'Source Sans 3', 'Source Sans Pro', ui-sans-serif, system-ui, sans-serif;
}

[data-theme="sumas-dark"] h1,
[data-theme="sumas-dark"] h2,
[data-theme="sumas-dark"] h3,
[data-theme="sumas-dark"] h4,
[data-theme="sumas-dark"] h5,
[data-theme="sumas-dark"] h6,
[data-theme="sumas-dark"] .card-title,
[data-theme="sumas-dark"] .font-heading {
  font-family: 'Outfit', ui-sans-serif, system-ui, sans-serif;
}

/* Sombras para dark mode (más sutiles) */
[data-theme="sumas-dark"] .shadow-sumas-sm {
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.3);
}
[data-theme="sumas-dark"] .shadow-sumas-md {
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.4),
              0 2px 4px -2px rgb(0 0 0 / 0.3);
}
[data-theme="sumas-dark"] .shadow-sumas-lg {
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.5),
              0 4px 6px -4px rgb(0 0 0 / 0.4);
}

/* ================================================
   ORGANIC ANIMATIONS — "Bienestar Cálido"
   ================================================ */

/* Blob breathing shapes */
@keyframes blob-breathe {
  0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  50%      { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
}
@keyframes blob-shape {
  0%, 100% { border-radius: 40% 60% 60% 40% / 70% 30% 70% 30%; }
  50%      { border-radius: 60% 40% 30% 70% / 40% 60% 40% 60%; }
}
@keyframes blob-shape-alt {
  0%, 100% { border-radius: 50% 50% 40% 60% / 40% 60% 50% 50%; }
  50%      { border-radius: 40% 60% 60% 40% / 60% 40% 40% 60%; }
}

.blob-breathe { animation: blob-breathe 8s ease-in-out infinite; }
.blob-shape { animation: blob-shape 10s ease-in-out infinite; }
.blob-shape-alt { animation: blob-shape-alt 12s ease-in-out infinite; }

/* Floating badge */
@keyframes float-gentle {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
.float-gentle { animation: float-gentle 4s ease-in-out infinite; }

/* Scroll reveal */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in-up {
  animation: fade-in-up 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }

/* Progress bar entrance */
@keyframes progress-fill {
  from { width: 0; }
}
.progress-fill { animation: progress-fill 1s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both; }

/* ================================================
   WARM SHADOWS (terracota + bosque tinted)
   ================================================ */
.shadow-warm {
  box-shadow: 0 4px 14px -3px oklch(0.57 0.05 54 / 0.15),
              0 2px 6px -2px oklch(0.45 0.03 163 / 0.08);
}
.shadow-warm-lg {
  box-shadow: 0 10px 25px -5px oklch(0.57 0.05 54 / 0.18),
              0 4px 10px -4px oklch(0.45 0.03 163 / 0.10);
}
[data-theme="sumas-dark"] .shadow-warm {
  box-shadow: 0 4px 14px -3px rgb(0 0 0 / 0.35),
              0 2px 6px -2px rgb(0 0 0 / 0.25);
}
[data-theme="sumas-dark"] .shadow-warm-lg {
  box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.45),
              0 4px 10px -4px rgb(0 0 0 / 0.30);
}

/* ================================================
   GRAIN OVERLAY (subtle noise texture)
   ================================================ */
.grain-overlay { position: relative; }
.grain-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.03;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
  z-index: 1;
}

/* ================================================
   ORGANIC COMPONENT CLASSES
   ================================================ */

/* Card with spring hover lift */
.card-organic {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s ease;
}
.card-organic:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px -6px oklch(0.57 0.05 54 / 0.15),
              0 6px 12px -4px oklch(0.45 0.03 163 / 0.08);
}
[data-theme="sumas-dark"] .card-organic:hover {
  box-shadow: 0 12px 28px -6px rgb(0 0 0 / 0.4),
              0 6px 12px -4px rgb(0 0 0 / 0.25);
}

/* Organic input with focus effect */
.input-organic {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input-organic:focus {
  border-color: oklch(var(--p));
  box-shadow: 0 0 0 3px oklch(var(--p) / 0.15);
  outline: 2px solid oklch(var(--p));
  outline-offset: 2px;
}

/* Gradient progress bar */
.progress-organic::-webkit-progress-value {
  background: linear-gradient(90deg, oklch(var(--p)), oklch(var(--s)));
  border-radius: 9999px;
}
.progress-organic::-moz-progress-bar {
  background: linear-gradient(90deg, oklch(var(--p)), oklch(var(--s)));
  border-radius: 9999px;
}

/* ================================================
   SEMAPHORE DOTS (dashboard summary)
   ================================================ */
.semaphore-dot {
  width: 12px;
  height: 12px;
  border-radius: 9999px;
  display: inline-block;
  flex-shrink: 0;
}
.dot-good     { background-color: oklch(0.55 0.12 163); }
.dot-moderate { background-color: oklch(0.57 0.13 59); }
.dot-severe   { background-color: oklch(0.58 0.17 28); }
.dot-neutral  { background-color: oklch(0.70 0.01 60); }

[data-theme="sumas-dark"] .dot-good     { background-color: oklch(0.65 0.20 145); }
[data-theme="sumas-dark"] .dot-moderate { background-color: oklch(0.70 0.17 70); }
[data-theme="sumas-dark"] .dot-severe   { background-color: oklch(0.62 0.22 25); }
[data-theme="sumas-dark"] .dot-neutral  { background-color: oklch(0.60 0.01 60); }

/* ================================================
   HERO GRADIENT BACKGROUNDS
   ================================================ */
.bg-gradient-hero {
  background: linear-gradient(135deg,
    oklch(var(--p)) 0%,
    oklch(var(--s)) 100%);
}
.bg-gradient-hero-soft {
  background: linear-gradient(135deg,
    oklch(var(--p) / 0.05) 0%,
    oklch(var(--s) / 0.08) 50%,
    oklch(var(--a) / 0.05) 100%);
}

/* ================================================
   SPLIT-SCREEN AUTH PANEL
   ================================================ */
.auth-panel-left {
  background: linear-gradient(160deg,
    oklch(var(--p)) 0%,
    oklch(0.38 0.05 163.51) 50%,
    oklch(var(--s) / 0.85) 100%);
}

/* ================================================
   STEP CONNECTOR LINE (landing page)
   ================================================ */
.step-connector {
  position: relative;
}
.step-connector::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -50%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, oklch(var(--p)), oklch(var(--s)));
  z-index: 0;
}
.step-connector:last-child::after {
  display: none;
}

/* ================================================
   ACCESSIBILITY: Focus Visible
   ================================================ */
:focus-visible {
  outline: 2px solid oklch(var(--p));
  outline-offset: 2px;
}

/* Keyboard focus indicator for custom radio button labels */
.option-btn:focus-within {
  outline: 2px solid oklch(var(--p));
  outline-offset: 2px;
}

/* ================================================
   ACCESSIBILITY: Reduced Motion
   ================================================ */
@media (prefers-reduced-motion: reduce) {
  .blob-breathe,
  .blob-shape,
  .blob-shape-alt,
  .float-gentle,
  .fade-in-up,
  .progress-fill {
    animation: none;
  }

  .card-organic {
    transition: none;
  }

  .fade-in-up {
    opacity: 1;
    transform: none;
  }
}
