/*
 * ─────────────────────────────────────────────────────
 * RecetarIA — style-overrides.css
 * Mejoras visuales sobre style.css (no modificar style.css)
 *
 * Para activar: añadir en app.php, DESPUÉS de style.css:
 *   <link rel="stylesheet" href="style-overrides.css">
 * Para desactivar: eliminar esa línea. Sin riesgo.
 * ─────────────────────────────────────────────────────
 */

/* ──────────────────────────────────────────────────────
   1. TOKENS — sustituye Inter por Instrument Serif en
   títulos y unifica el color terra
   ────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap');

:root {
  /* Un único terra para todo — antes había variaciones */
  --terra: #C4562A;
  --terra-light: #F7EDE7;

  /* Fondo ligeramente más cálido */
  --bg: #ECEAE2;
  --paper: #F5F2EC;
  --paper2: #EDEAE2;
}


/* ──────────────────────────────────────────────────────
   2. WORDMARK — tipografía con personalidad
   ────────────────────────────────────────────────────── */

.wordmark-logo span:first-child {
  font-family: 'Instrument Serif', Georgia, serif !important;
  font-weight: 400 !important;
  font-size: inherit;
  letter-spacing: -0.02em;
  color: var(--ink) !important;
}
.wordmark-logo span:last-child {
  font-family: 'Instrument Serif', Georgia, serif !important;
  font-style: italic;
  font-weight: 400 !important;
  color: var(--terra) !important;
}


/* ──────────────────────────────────────────────────────
   3. SIDEBAR — más refinado, avatar con más peso
   ────────────────────────────────────────────────────── */

.sidebar {
  background: #EAE6DE;
  border-right: 1px solid rgba(44,42,36,0.08);
  padding: 24px 0;
}

.sidebar .wordmark-logo {
  padding: 0 20px;
  margin-bottom: 24px;
  font-size: 20px;
}

.bni.active {
  background: var(--ink);
}
.bni.active svg {
  stroke: #F5F2EC;
}
.bni.active span {
  color: #F5F2EC;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(44,42,36,0.07);
  margin-top: auto;
}

.user-avatar-fallback {
  width: 28px;
  height: 28px;
  font-size: 12px;
  font-weight: 600;
  background: var(--terra);
  color: #fff;
  border: none;
}

.user-name {
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 500;
}


/* ──────────────────────────────────────────────────────
   4. HOME HERO — titular con más jerarquía tipográfica
   ────────────────────────────────────────────────────── */

.home-hero {
  background: var(--terra-light);
  border: 1px solid rgba(196,86,42,0.10);
  border-radius: 14px;
  padding: 32px 28px 28px;
}

.home-headline {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 20px;
}

@media (min-width: 769px) {
  .home-headline {
    font-size: 38px;
  }
}

.home-add-btn {
  border-radius: 100px;
  padding: 12px 22px;
  font-size: 13.5px;
  letter-spacing: 0.01em;
  background: var(--ink);
  gap: 8px;
}
.home-add-btn:hover {
  background: #3A3830;
  transform: translateY(-1px);
}
.home-add-btn:active {
  transform: scale(0.98);
}

.home-widget {
  border-radius: 12px;
  padding: 18px 20px;
}

.hw-value {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.hw-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  margin-top: 2px;
}


/* ──────────────────────────────────────────────────────
   5. TARJETAS — bordes más suaves, hover más sutil
   ────────────────────────────────────────────────────── */

.popular-card,
.recent-card,
.recipe-card {
  border-radius: 12px;
  border-color: rgba(44,42,36,0.08);
  background: #FAFAF7;
}

.popular-card:hover,
.recent-card:hover,
.recipe-card:hover {
  border-color: rgba(44,42,36,0.14);
  box-shadow: 0 6px 20px rgba(44,42,36,0.07);
  transform: translateY(-2px);
}

.pop-title {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
}

.rc-title {
  font-size: 13.5px;
  font-weight: 500;
}

.rc-source-badge,
.pop-source-badge {
  border-radius: 7px;
  width: 26px;
  height: 26px;
  background: rgba(255,255,255,0.92);
}


/* ──────────────────────────────────────────────────────
   6. PANTALLA AÑADIR RECETA
   ────────────────────────────────────────────────────── */

.s1h {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  .s1h {
    font-size: 26px;
  }
}

.url-field {
  border-radius: 10px;
  border-color: rgba(44,42,36,0.14);
  background: #FAFAF7;
  font-size: 14px;
  padding: 14px 16px;
}
.url-field:focus {
  border-color: var(--terra);
  box-shadow: 0 0 0 3px rgba(196,86,42,0.08);
}

.btn-dark {
  border-radius: 100px;
  letter-spacing: 0.01em;
}
.btn-dark:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(44,42,36,0.15);
}
.btn-dark:active:not(:disabled) {
  transform: scale(0.98);
}
.btn-dark:disabled {
  border-radius: 100px;
}


/* ──────────────────────────────────────────────────────
   7. LISTA DE RECETAS
   ────────────────────────────────────────────────────── */

.list-header {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.search-field {
  border-radius: 10px;
  border-color: rgba(44,42,36,0.12);
  background: #FAFAF7;
  font-size: 13.5px;
  padding: 12px 14px 12px 42px;
}
.search-field:focus {
  border-color: var(--terra);
  box-shadow: 0 0 0 3px rgba(196,86,42,0.08);
}

.filter-select {
  border-radius: 8px;
  border-color: rgba(44,42,36,0.12);
  background-color: #FAFAF7;
  font-size: 11.5px;
  padding: 8px 28px 8px 12px;
}

.filter-chip {
  border-radius: 100px;
  padding: 5px 12px;
  font-size: 11px;
}


/* ──────────────────────────────────────────────────────
   8. LISTA DE COMPRA
   ────────────────────────────────────────────────────── */

.shop-subtitle {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink3);
}

#screenShop .btn-dark {
  max-width: 360px;
  margin-top: 24px;
}

.shop-toggle {
  border-radius: 8px;
  font-size: 11.5px;
  padding: 7px 16px;
  transition: all 0.15s;
}
.shop-toggle.active {
  background: var(--ink);
  border-color: var(--ink);
}

.shop-section-header {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom-color: rgba(44,42,36,0.08);
}

.ing.shop {
  padding: 12px 14px;
  min-height: 52px;
  border-radius: 10px;
  border-color: rgba(44,42,36,0.10);
}
.ing.shop:hover {
  border-color: rgba(44,42,36,0.16);
}

.ing-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid rgba(44,42,36,0.18);
  flex-shrink: 0;
}
.ing.shop.checked .ing-check {
  background: var(--green);
  border-color: var(--green);
  border-radius: 6px;
}
.ing.shop.checked .ing-check::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: 1.5px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(42deg) translateY(-1px);
  margin: auto;
}


/* ──────────────────────────────────────────────────────
   9. DETALLE DE RECETA
   ────────────────────────────────────────────────────── */

.rec-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.rec-hero {
  border-radius: 12px;
}

.saved-badge {
  border-radius: 100px;
  padding: 6px 16px;
  font-size: 10.5px;
}

.tag {
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 10.5px;
}

.porciones-row {
  border-radius: 10px;
  border-color: rgba(44,42,36,0.10);
  background: #FAFAF7;
}
.por-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border-color: rgba(44,42,36,0.14);
  font-size: 18px;
  font-weight: 300;
  transition: all 0.12s;
}
.por-btn:hover {
  background: var(--terra-light);
  border-color: rgba(196,86,42,0.2);
  color: var(--terra);
}

.ing {
  border-radius: 8px;
  border-color: rgba(44,42,36,0.10);
  background: #FAFAF7;
}
.ing:hover {
  border-color: rgba(44,42,36,0.16);
}


/* ──────────────────────────────────────────────────────
   10. PANTALLA AUTH
   ────────────────────────────────────────────────────── */

.auth-container {
  padding: 60px 24px;
}

.auth-logo {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 32px;
  letter-spacing: -0.02em;
}

.auth-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink2);
  max-width: 340px;
}

.btn-google {
  border-radius: 100px;
  padding: 14px 28px;
  border-color: rgba(44,42,36,0.14);
  font-size: 14px;
  transition: all 0.15s;
}
.btn-google:hover {
  border-color: rgba(44,42,36,0.24);
  box-shadow: 0 4px 14px rgba(44,42,36,0.10);
  transform: translateY(-1px);
}


/* ──────────────────────────────────────────────────────
   11. PANTALLA PROCESANDO
   ────────────────────────────────────────────────────── */

.proc-h {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.step {
  border-radius: 8px;
}
.step.done {
  background: var(--green-light);
}
.step.active {
  background: var(--ink);
}
.sdot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border-color: rgba(44,42,36,0.14);
}
.step.active .sdot {
  background: var(--terra);
  border-color: var(--terra);
}

#btnCancel {
  border-radius: 100px;
  font-size: 11px;
  color: var(--ink3);
  border-color: rgba(44,42,36,0.12);
}
#btnCancel:hover {
  color: var(--ink);
  border-color: rgba(44,42,36,0.2);
  background: var(--paper2);
}


/* ──────────────────────────────────────────────────────
   12. MOBILE — ajustes responsive específicos
   ────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .sidebar {
    background: var(--paper);
    border-top: 1px solid rgba(44,42,36,0.08);
  }

  .bni.active {
    background: transparent;
  }
  .bni.active svg {
    stroke: var(--terra);
  }
  .bni.active span {
    color: var(--terra);
  }

  .home-headline {
    font-size: 26px;
  }

  .main-scroll {
    padding: 20px 16px 88px;
  }

  .home-section-header {
    font-size: 17px;
  }

  .popular-card,
  .recent-card {
    border-radius: 10px;
  }
}


/* ──────────────────────────────────────────────────────
   13. TOPBAR MOBILE
   ────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .topbar {
    margin-bottom: 20px;
  }

  .topbar .wordmark-logo {
    font-size: 18px;
  }

  .topbar-avatar-fallback {
    background: var(--terra);
    color: #fff;
    border: none;
    width: 30px;
    height: 30px;
    font-size: 13px;
  }
}


/* ──────────────────────────────────────────────────────
   14. MICRO-DETALLES — empty states, skeletons
   ────────────────────────────────────────────────────── */

.empty-state {
  padding: 48px 20px;
}
.empty-state .empty-emoji {
  font-size: 36px;
  margin-bottom: 14px;
}
.empty-state .empty-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.empty-state .empty-hint {
  font-size: 13px;
  line-height: 1.6;
  max-width: 280px;
  margin: 6px auto 18px;
}
.empty-state .btn {
  border-radius: 100px;
}

.skeleton {
  background: var(--paper3);
  background: linear-gradient(
    90deg,
    var(--paper3) 25%,
    var(--paper2) 50%,
    var(--paper3) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}


/* ──────────────────────────────────────────────────────
   15. HOME REDISEÑADO
   ────────────────────────────────────────────────────── */

.home-hero {
  margin-bottom: 32px;
  padding: 0;
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.home-hero-text {
  padding-top: 8px;
}

.home-greeting {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--terra);
  opacity: 1;
  margin-bottom: 8px;
}

.home-headline {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 42px;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--ink);
  margin-bottom: 0;
}
.home-headline em {
  font-style: italic;
  color: var(--terra);
}

.home-hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.home-add-btn {
  border-radius: 100px !important;
  padding: 11px 20px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  letter-spacing: 0.01em !important;
  white-space: nowrap;
  flex-shrink: 0;
}

.home-stats-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.home-widget {
  background: rgba(44,42,36,0.06) !important;
  border: none !important;
  border-radius: 100px !important;
  padding: 10px 22px !important;
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  min-width: 160px;
  white-space: nowrap;
  transition: background 0.15s;
  box-shadow: none !important;
  cursor: pointer;
}

.home-widget .hw-icon,
.home-widget .hw-value,
.home-widget .hw-label {
  margin: 0 !important;
}
.home-widget:hover {
  background: rgba(44,42,36,0.10) !important;
  transform: none !important;
  box-shadow: none !important;
}

.home-widget .hw-icon {
  font-size: 14px;
  margin: 0;
  line-height: 1;
}
.home-widget .hw-value {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 16px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1;
}
.home-widget .hw-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink2);
  line-height: 1;
}
.home-widget .hw-sub {
  display: none;
}

.home-widget-shop.empty {
  background: rgba(44,42,36,0.04) !important;
}
.home-widget-shop {
  background: rgba(45,74,30,0.08) !important;
}
.home-widget-shop:hover {
  background: rgba(45,74,30,0.13) !important;
}

.home-top {
  display: block !important;
}

.home-section {
  margin-bottom: 36px;
}
.home-section-header {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

@media (min-width: 769px) {
  .home-hero {
    flex-direction: row !important;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid rgba(44,42,36,0.08) !important;
  }
  .home-headline {
    font-size: 52px !important;
  }
  .home-hero-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    flex-shrink: 0;
  }
  .home-stats-pills {
    justify-content: flex-end;
  }
}

@media (max-width: 768px) {
  .home-headline {
    font-size: 36px !important;
  }
  .home-hero {
    margin-bottom: 28px !important;
  }
}

/* ── Pantalla Añadir: reequilibrio ── */
#screenAdd {
  max-width: 480px;
}
.url-wrap {
  max-width: 100%;
}
#screenAdd .btn {
  max-width: 100%;
  width: 100%;
  display: block;
}
#screenAdd .btn-hint {
  text-align: center;
}

/* ── Auth: contexto receta pendiente ── */
.auth-pending-context {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--paper2);
  border: 1px solid rgba(44,42,36,0.10);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  text-align: left;
}
.apc-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--paper3);
  flex-shrink: 0;
  overflow: hidden;
}
.apc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.apc-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--terra);
  margin-bottom: 4px;
}
.apc-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
}

/* ── Placeholders SVG ── */
.pop-thumb-placeholder,
.rc-thumb-placeholder,
.rec-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F0EDE6;
}

/* ── Micro-feedback receta añadida a compra ── */
.recipe-feedback-bar {
  font-size: 12px;
  color: var(--ink2);
  padding: 10px 14px;
  background: var(--paper2);
  border: 1px solid rgba(44,42,36,0.09);
  border-radius: 8px;
  margin-top: 10px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.recipe-feedback-bar.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.recipe-feedback-bar a {
  color: var(--terra);
  text-decoration: underline;
  cursor: pointer;
}

/* ── Menú según estado de auth ── */
body.logged-out .bni[data-nav="home"],
body.logged-out .bni[data-nav="recipes"],
body.logged-out .bni[data-nav="shop"] {
  display: none !important;
}
body.logged-in .bni[data-nav="auth"] {
  display: none !important;
}
