/* ─────────────────────────────────────────────
   BASE — CocinarIA
   Reset, estructura del shell y clases
   de utilidad compartidas entre pantallas.
   ───────────────────────────────────────────── */

/* ── Reset ───────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100svh;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  height: 100svh;
  overflow: hidden;
  background: var(--color-bg-app);
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  color: var(--color-text-primary);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: transparent;
  font: inherit;
}

button:active { opacity: 0.82; }

input,
textarea,
select {
  font: inherit;
}

input:focus,
textarea:focus,
select:focus { outline: none; }

img,
svg { display: block; }

::-webkit-scrollbar { width: 0; }

/* ── Shell del teléfono ──────────────────── */
/* Centra la app en escritorio manteniendo el ancho de móvil */
#app-shell {
  display: flex;
  justify-content: center;
  height: 100svh;
  background: var(--color-bg-app);
  overflow: hidden;
}

#app-root {
  width: 100%;
  max-width: var(--phone-max-width);
  height: 100svh;
  background: var(--color-bg-surface);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Screen outlet ───────────────────────── */
#screen-outlet {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
}

/* ── Pantallas ───────────────────────────── */
.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.screen--full {
  min-height: 100%;
}

.screen--scrollable {
  overflow-y: auto;
}

/* ── Contenedor con padding estándar ─────── */
.content-pad {
  padding-inline: var(--screen-padding);
}

/* ── Cabecera de sección ──────────────────── */
.section-header {
  background: var(--color-bg-elevated);
  padding: 56px var(--screen-padding) var(--space-6);
  border-bottom: 1px solid var(--color-border-subtle);
}

.section-header__eyebrow {
  font-size: var(--text-label-md);
  font-weight: var(--fw-medium);
  color: var(--color-brand-primary-light);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}

.section-header__title {
  font-family: var(--font-display);
  font-size: var(--text-display-md);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-tight);
  line-height: var(--lh-heading);
  color: var(--color-text-primary);
}

.section-header__subtitle {
  font-size: var(--text-body-md);
  line-height: var(--lh-relaxed);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

/* ── Botón primario ──────────────────────── */
.btn-primary {
  width: 100%;
  background: var(--color-brand-primary);
  color: var(--color-text-inverse);
  padding: 18px;
  border-radius: var(--radius-lg);
  font-size: var(--text-heading-sm);
  font-weight: var(--fw-semibold);
  box-shadow: var(--shadow-brand);
  transition: opacity var(--duration-fast) var(--ease-standard);
}

.btn-primary:hover { opacity: 0.9; }

/* ── Botón IA (dorado) ───────────────────── */
.btn-ai {
  background: var(--color-ai-golden);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-ai);
}

/* ── Chip / pill ─────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 9px 16px;
  border-radius: var(--radius-chip);
  font-size: var(--text-label-lg);
  font-weight: var(--fw-medium);
  transition:
    background var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard);
}

.chip--default {
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
}

.chip--selected {
  background: var(--color-brand-primary);
  color: var(--color-text-inverse);
}

.chip--ai-selected {
  background: var(--color-ai-golden);
  color: var(--color-text-primary);
}

/* ── Tarjeta ─────────────────────────────── */
.card {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* ── Icono contenedor ────────────────────── */
.icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--radius-md);
}

.icon-wrap--brand {
  background: var(--color-brand-primary-soft);
  color: var(--color-brand-primary);
}

.icon-wrap--terracotta {
  background: var(--color-accent-terracotta-soft);
  color: var(--color-accent-terracotta);
}

.icon-wrap--ai {
  background: var(--color-ai-golden-soft);
  color: var(--color-ai-golden-dark);
}

/* ── Control numérico (±) ────────────────── */
.num-ctrl {
  display: flex;
  align-items: center;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-1);
  box-shadow: var(--shadow-md);
  width: fit-content;
}

.num-ctrl__btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  font-size: 20px;
  font-weight: var(--fw-semibold);
  color: var(--color-brand-primary);
}

.num-ctrl__value {
  width: 48px;
  text-align: center;
  font-size: 20px;
  font-weight: var(--fw-bold);
  color: var(--color-text-primary);
}

/* ── Separador ───────────────────────────── */
.divider {
  height: 1px;
  background: var(--color-border-subtle);
}

/* ── Label de sección (uppercase) ────────── */
.label-section {
  font-size: var(--text-label-md);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-4);
}

/* ── Spinner de carga ────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: var(--radius-circle);
  animation: spin 0.8s linear infinite;
}

/* ── Estado vacío (empty state) ──────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px var(--screen-padding);
  gap: var(--space-4);
  flex: 1;
}

.empty-state__icon {
  font-size: 48px;
  animation: sgFloat 3s ease-in-out infinite;
}

.empty-state__title {
  font-family: var(--font-display);
  font-size: var(--text-heading-lg);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
}

.empty-state__body {
  font-size: var(--text-body-md);
  color: var(--color-text-muted);
  line-height: var(--lh-relaxed);
  max-width: 280px;
}

/* ── Barra de navegación inferior ────────── */
.navbar {
  height: var(--nav-h);
  background: var(--color-bg-elevated);
  border-top: 1px solid var(--color-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-shrink: 0;
  position: relative;
  z-index: var(--z-sticky);
}

.navbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--space-2) var(--space-4);
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  justify-content: center;
  color: var(--color-text-subtle);
  transition: color var(--duration-fast) var(--ease-standard);
}

.navbar__item.is-active {
  color: var(--color-brand-primary);
}

.navbar__label {
  font-size: var(--text-caption);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
}

/* ── FAB (botón flotante) ────────────────── */
.fab {
  position: fixed;
  bottom: var(--fab-bottom);
  right: var(--screen-padding);
  width: var(--ctrl-fab);
  height: var(--ctrl-fab);
  border-radius: var(--radius-circle);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-overlay);
  transition: transform var(--duration-fast) var(--ease-spring);
}

.fab:active { transform: scale(0.93); }

/* ── Snackbar / toast ────────────────────── */
.snackbar {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--space-4));
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text-primary);
  color: var(--color-text-inverse);
  padding: 12px 20px;
  border-radius: var(--radius-chip);
  font-size: var(--text-body-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  z-index: var(--z-toast);
  animation: toastIn var(--duration-standard) var(--ease-spring) both;
  pointer-events: none;
}

/* ── Bottom sheet ────────────────────────── */
.bottom-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--color-bg-overlay-dark);
  z-index: var(--z-core-backdrop);
  animation: fadeIn var(--duration-standard) var(--ease-standard) both;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--phone-max-width);
  background: var(--color-bg-surface);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  z-index: var(--z-bottom-sheet);
  animation: slideUp var(--duration-standard) var(--ease-spring) both;
  overflow: hidden;
}

.bottom-sheet__handle {
  width: 40px;
  height: 4px;
  background: var(--color-border-medium);
  border-radius: var(--radius-chip);
  margin: 12px auto var(--space-4);
}

/* ── Barra de progreso de pasos ──────────── */
.step-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: var(--space-2) var(--screen-padding) var(--space-4);
  flex-shrink: 0;
}

.step-dot {
  height: 4px;
  border-radius: var(--radius-chip);
  transition:
    width var(--duration-standard) var(--ease-spring),
    background var(--duration-standard) var(--ease-standard);
}

/* ── Utilidades de visibilidad ───────────── */
.hidden { display: none !important; }

/* ── Shimmer skeleton ────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-muted) 25%,
    var(--color-bg-elevated) 37%,
    var(--color-bg-muted) 63%
  );
  background-size: 400px 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
