/* ============================================================
   KalorIA · Identidad visual — cálida, editorial, sin estridencias
   Terracota como color de marca, tonos de comida inspirados en
   ingredientes reales (miel, salvia, ciruela, pizarra). Sin fuentes
   ni assets externos: todo autoalojado.
   ============================================================ */

:root {
  /* Marca — terracota/arcilla, un único acento con carácter */
  --primary: #B5654A;
  --primary-dark: #96503A;
  --primary-light: #D79A80;
  --secondary: #6E8C6F;
  --secondary-dark: #55725A;
  --accent: #C6A15B;
  --accent-dark: #A88645;

  /* Fondos planos — sin degradados llamativos */
  --gradient-primary: var(--primary);
  --gradient-secondary: var(--secondary);
  --gradient-accent: var(--accent);
  --gradient-bg: var(--bg);

  /* Fondo y superficie */
  --bg: #FAF6F0;
  --bg-alt: #F2EAE0;
  --surface: #ffffff;
  --surface-hover: #FDFBF8;
  --border: #E6DDD0;
  --border-light: #EFE8DD;

  /* Texto */
  --text: #332C24;
  --text-secondary: #6B6055;
  --text-muted: #948A7D;
  --text-on-primary: #ffffff;

  /* Colores de las comidas — inspirados en ingredientes, sin saturar */
  --c-desayuno: #C99A54;
  --c-desayuno-bg: #F3E7D3;
  --c-comida: #7C9B76;
  --c-comida-bg: #E5EBE1;
  --c-merienda: #9C82A3;
  --c-merienda-bg: #EAE3EC;
  --c-cena: #6E8CA0;
  --c-cena-bg: #E1E8EC;

  /* Sombras — neutras y suaves, sin tinte de color */
  --shadow-sm: 0 1px 2px rgba(51, 44, 36, 0.05), 0 1px 1px rgba(51, 44, 36, 0.04);
  --shadow-md: 0 6px 20px rgba(51, 44, 36, 0.08);
  --shadow-lg: 0 12px 32px rgba(51, 44, 36, 0.10);
  --shadow-glow: var(--shadow-md);

  /* Radios */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 999px;

  /* Transiciones — suaves, sin rebote elástico */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration: 0.25s;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #211D18;
    --bg-alt: #29241E;
    --surface: #2C2721;
    --surface-hover: #342E27;
    --border: #40392F;
    --border-light: #383129;
    --text: #EEE7DB;
    --text-secondary: #B8AC9C;
    --text-muted: #8A8072;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-glow: var(--shadow-md);

    --primary-light: #C68A6E;

    --c-desayuno-bg: #332A1B;
    --c-comida-bg: #212A1F;
    --c-merienda-bg: #28222C;
    --c-cena-bg: #1D262C;
  }
}

/* Reset y base */
*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* ============================================================
   Layout — con margen para notch/Dynamic Island y home indicator
   ============================================================ */
.app-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 calc(16px + env(safe-area-inset-right)) calc(90px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}

/* ============================================================
   Header
   ============================================================ */
header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(20px + env(safe-area-inset-top)) 0 16px;
  margin-bottom: 8px;
}

header.top h1 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.3px;
}

/* Marca "KalorIA" — presente en todas las pantallas: icono de anillo
   (el mismo motivo del anillo de progreso) + wordmark. "Kalor" en
   tono neutro, "IA" en una píldora terracota para que resalte como
   su propia unidad. Usa la fuente redondeada del sistema (ui-rounded,
   SF Pro Rounded en iOS) para un trazo más cálido y "de marca". */
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  margin: 0 0 5px;
  font-family: ui-rounded, -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', sans-serif;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text);
}

.brand-icon {
  flex: none;
  display: block;
}

.brand-icon-track {
  stroke: var(--border);
}

.brand-icon-arc {
  stroke: var(--primary);
}

.brand-mark .brand-ia {
  color: var(--primary);
  background: rgba(181, 101, 74, 0.14);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-left: 1px;
}

@media (prefers-color-scheme: dark) {
  .brand-mark .brand-ia {
    background: rgba(198, 138, 110, 0.18);
  }
}

header.top .greeting {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

header.top .date {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 14px;
  transition: box-shadow var(--duration) var(--ease-out), border-color var(--duration) var(--ease-out);
}

.card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-md);
}

.card-highlight {
  border: 1px solid var(--border);
  position: relative;
}

.card-glow {
  box-shadow: var(--shadow-md);
}

/* ============================================================
   Anillo de progreso
   ============================================================ */
.ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 20px;
  position: relative;
  overflow: hidden;
}

#ring {
  filter: drop-shadow(0 2px 6px rgba(51, 44, 36, 0.10));
}

#ring circle {
  transition: stroke-dasharray 0.6s ease;
}

.ring-center-text {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -1px;
}

.ring-center-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
}

/* ============================================================
   Comidas (meal sections)
   ============================================================ */
.meal-section {
  position: relative;
  overflow: hidden;
}

.meal-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: 0 2px 2px 0;
}

.meal-section[data-meal="desayuno"]::before { background: var(--c-desayuno); }
.meal-section[data-meal="comida"]::before { background: var(--c-comida); }
.meal-section[data-meal="merienda"]::before { background: var(--c-merienda); }
.meal-section[data-meal="cena"]::before { background: var(--c-cena); }

.meal-section h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 4px;
}

.meal-section h2 .meal-icon {
  font-size: 1.3rem;
}

.meal-section h2 .kcal-total {
  margin-left: auto;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-alt);
  padding: 2px 10px;
  border-radius: var(--radius-full);
}

/* ============================================================
   Entries (filas de alimentos)
   ============================================================ */
.entry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0 10px 4px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.88rem;
  transition: background var(--duration);
}

.entry-row:last-child { border-bottom: none; }

.entry-row .name {
  font-weight: 600;
  color: var(--text);
}

.entry-row .meta {
  color: var(--text-muted);
  font-size: 0.76rem;
  margin-top: 1px;
}

.entry-row .kcal-badge {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--primary-dark);
  background: rgba(181, 101, 74, 0.10);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* ============================================================
   Quick add
   ============================================================ */
.quick-add {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-light);
}

.quick-add .row {
  display: flex;
  gap: 8px;
}

.quick-add .row > * { flex: 1; }
.quick-add .row input[type="number"] { max-width: 75px; flex: none; }

.suggestions {
  font-size: 0.8rem;
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ============================================================
   Botones
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  padding: 11px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.97);
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Primary */
.btn-primary {
  background: var(--primary);
  color: var(--text-on-primary);
  box-shadow: 0 2px 8px rgba(181, 101, 74, 0.22);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(181, 101, 74, 0.28);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.97);
}

/* Secondary */
.btn-secondary {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--primary-light);
  background: var(--surface-hover);
}

/* Small */
.btn-small {
  padding: 7px 12px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

/* Danger */
.btn-danger {
  background: #A8583D;
  color: white;
  border: none;
}

/* Full width */
.btn-full {
  width: 100%;
}

/* ============================================================
   Formularios
   ============================================================ */
input, select, textarea {
  font-family: inherit;
  /* 16px minimo: por debajo de esto Safari en iOS hace zoom automatico al enfocar */
  font-size: 16px;
  padding: 11px 13px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border-light);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(181, 101, 74, 0.10);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 5px;
  letter-spacing: 0.2px;
}

.field { margin-bottom: 14px; }

.row {
  display: flex;
  gap: 10px;
}

.row > * { flex: 1; }

/* ============================================================
   Ingredient rows (recetas)
   ============================================================ */
.ingredient-row {
  display: grid;
  grid-template-columns: 1fr 80px 36px;
  gap: 8px;
  align-items: start;
  margin-bottom: 10px;
  padding: 10px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  transition: background 0.2s;
}

.ingredient-row:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}

.ingredient-row input {
  background: var(--surface);
}

.ing-suggestions {
  font-size: 0.75rem;
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ============================================================
   Chips / tags
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--c-comida-bg);
  color: var(--text-secondary);
  transition: box-shadow 0.2s, transform 0.2s;
}

.chip-clickable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.chip-clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(51, 44, 36, 0.10);
}

.chip-success {
  background: var(--c-comida-bg);
  color: var(--secondary-dark);
  font-weight: 600;
}

/* ============================================================
   Empty state
   ============================================================ */
.empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 24px 0;
}

/* ============================================================
   Dicte card (recetas)
   ============================================================ */
.dictate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.dictate-card .input-wrap {
  position: relative;
}

.dictate-card .mic-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ============================================================
   Macro bars
   ============================================================ */
.macro-bar-wrap {
  margin-bottom: 12px;
}

.macro-bar-wrap:last-child {
  margin-bottom: 0;
}

.macro-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 5px;
}

.macro-label span:first-child {
  font-weight: 600;
}

.macro-label .macro-value {
  color: var(--text-muted);
  font-weight: 500;
}

.macro-track {
  background: var(--bg);
  border-radius: var(--radius-full);
  height: 10px;
  overflow: hidden;
  position: relative;
}

.macro-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-out);
  position: relative;
}

.macro-fill-protein {
  background: var(--c-comida);
}

.macro-fill-carbs {
  background: var(--c-merienda);
}

.macro-fill-fat {
  background: var(--c-cena);
}

/* ============================================================
   Tab bar (navegación inferior estilo iOS)
   ============================================================ */
nav.tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.85);
  border-top: none;
  box-shadow: 0 -0.5px 0 rgba(51, 44, 36, 0.08);
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding: 8px 0 calc(6px + env(safe-area-inset-bottom));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 100;
}

@media (prefers-color-scheme: dark) {
  nav.tabs {
    background: rgba(33, 29, 24, 0.92);
    box-shadow: 0 -0.5px 0 rgba(255,255,255,0.06);
  }
}

nav.tabs a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  border-radius: 0;
  transition: color 0.2s var(--ease);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

/* Botón circular con relieve (efecto "embossed") */
.tab-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  box-shadow:
    -3px -3px 6px rgba(255, 255, 255, 0.8),
    3px 4px 8px rgba(150, 130, 110, 0.28);
  transition: box-shadow 0.15s var(--ease), transform 0.15s var(--ease), background 0.2s var(--ease);
}

@media (prefers-color-scheme: dark) {
  .tab-icon-circle {
    box-shadow:
      -3px -3px 6px rgba(255, 255, 255, 0.05),
      3px 4px 8px rgba(0, 0, 0, 0.45);
  }
}

nav.tabs a svg.tab-icon {
  width: 21px;
  height: 21px;
  display: block;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  transition: stroke-width 0.2s var(--ease);
}

nav.tabs a span.tab-label {
  font-size: 0.55rem;
  line-height: 1.2;
  opacity: 0.65;
  transition: opacity 0.2s var(--ease);
}

/* Efecto "pulsado": el botón se hunde al tocarlo, como un relieve físico */
nav.tabs a:active .tab-icon-circle {
  transform: scale(0.92);
  box-shadow:
    inset 2px 2px 5px rgba(150, 130, 110, 0.32),
    inset -2px -2px 5px rgba(255, 255, 255, 0.7);
}

@media (prefers-color-scheme: dark) {
  nav.tabs a:active .tab-icon-circle {
    box-shadow:
      inset 2px 2px 5px rgba(0, 0, 0, 0.55),
      inset -2px -2px 5px rgba(255, 255, 255, 0.05);
  }
}

/* Pestaña activa (página actual): mismo color teja que el resto de
   casillas de selección activas de la app (food-mode-btn, period-mode…) */
nav.tabs a.active {
  color: var(--primary);
}

nav.tabs a.active .tab-icon-circle {
  background: var(--primary);
  box-shadow:
    -2px -2px 5px rgba(255, 255, 255, 0.2),
    3px 4px 10px rgba(150, 80, 58, 0.45),
    inset 1px 1px 2px rgba(255, 255, 255, 0.25);
}

nav.tabs a.active svg.tab-icon {
  stroke: #fff;
  stroke-width: 2;
}

nav.tabs a.active span.tab-label {
  opacity: 1;
}

nav.tabs a.active:active .tab-icon-circle {
  transform: scale(0.92);
  box-shadow:
    inset 2px 2px 5px rgba(90, 45, 30, 0.55),
    inset -1px -1px 3px rgba(255, 255, 255, 0.15);
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s var(--ease);
  z-index: 200;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(51, 44, 36, 0.18);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.toast-success {
  background: var(--secondary-dark);
  color: white;
}

.toast.toast-error {
  background: #A8583D;
  color: white;
}

/* ============================================================
   Animaciones globales — sutiles, sin rebote
   ============================================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.card {
  animation: fadeInUp 0.35s var(--ease-out) both;
}

.card:nth-child(2) { animation-delay: 0.04s; }
.card:nth-child(3) { animation-delay: 0.08s; }
.card:nth-child(4) { animation-delay: 0.12s; }
.card:nth-child(5) { animation-delay: 0.16s; }

/* ============================================================
   Scrollbar personalizada
   ============================================================ */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

/* ============================================================
   Utilidades
   ============================================================ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* ============================================================
   Photo drop (legacy — oculto pero preservado)
   ============================================================ */
.photo-drop {
  display: none;
}

/* ============================================================
   Macros card highlight
   ============================================================ */
#macrosCard {
  position: relative;
}

#macrosCard .macro-icon-row {
  display: flex;
  justify-content: space-around;
  margin-bottom: 14px;
}

#macrosCard .macro-icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

#macrosCard .macro-icon-item .icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* ============================================================
   Recipe log card
   ============================================================ */
#logCard .row {
  align-items: end;
}

#logCard select, #logCard input {
  flex: 1;
}

#logCard .btn {
  flex: none;
}

/* ============================================================
   Settings page
   ============================================================ */
.settings-group {
  margin-bottom: 16px;
}

.settings-group:last-child {
  margin-bottom: 0;
}

.settings-group h3 {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  margin: 0 0 10px;
}

/* ============================================================
   Historial
   ============================================================ */
.period-nav .period-mode {
  background: var(--bg-alt);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  font-weight: 500;
  transition: all 0.2s;
}
.period-nav .period-mode.active-mode {
  background: var(--primary);
  color: white;
  border-color: transparent;
}
.period-prev, .period-next {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}
.period-prev:hover, .period-next:hover {
  background: var(--bg-alt);
}

/* Indicadores de color por día — reutilizan la paleta de comidas para
   que todo el sistema de color se sienta como una única familia */
.day-indicator {
  transition: transform 0.2s;
}
.day-row:hover .day-indicator {
  transform: scale(1.3);
}
.day-empty { background: var(--border-light); }
.day-low { background: #B5654A; }
.day-mid { background: var(--c-desayuno); }
.day-good { background: var(--c-comida); }
.day-over { background: var(--c-cena); }

.day-row {
  border-bottom: 1px solid var(--border-light);
}
.day-row:last-child {
  border-bottom: none;
}
.day-row:hover {
  background: var(--surface-hover) !important;
}
.day-row.selected {
  background: var(--bg-alt) !important;
}

/* ============================================================
   Dictado rápido en las tarjetas de comida
   ============================================================ */
.dictate-ing-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding: 6px 8px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}
.dictate-ing-row:hover {
  background: var(--surface-hover);
}
.dictate-ing-row .dictate-food-match {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex: 1;
  text-align: right;
}
.dictate-ing-row .dictate-food-option {
  font-size: 0.68rem;
}

/* ============================================================
   Compatibilidad con clases generadas por JS
   ============================================================ */
.btn.secondary {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn.secondary:hover {
  border-color: var(--primary-light);
  background: var(--surface-hover);
}
.btn.small {
  padding: 7px 12px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

/* ============================================================
   Búsqueda de valores estándar (USDA FoodData Central)
   ============================================================ */
.usda-inline {
  margin: 0 4px 6px;
}

.usda-card {
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.usda-card:hover {
  background: var(--surface-hover);
  border-color: var(--primary-light);
}

.usda-card:active {
  transform: scale(0.98);
}

.usda-card-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 3px;
  text-transform: capitalize;
}

.usda-card-macros {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.usda-tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--secondary-dark);
  background: var(--c-comida-bg);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  margin-left: 4px;
  vertical-align: middle;
}

/* Toggle de modo alimento (por 100g / por unidad) */
.food-mode-btn {
  background: var(--bg-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.food-mode-btn.active-mode {
  background: var(--primary);
  color: white;
  border-color: transparent;
}
