/* ============================================================
   comida-app · prototipo — estética "Vibrant Zest"
   (lima eléctrico + crema + charcoal · Lexend/Inter)
   Tailwind (CDN) hace el grueso; aquí solo lo que no cubre.
   ============================================================ */

* { -webkit-tap-highlight-color: transparent; }
@keyframes bootpulse { 0%,100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.08); opacity: 1; } }
/* CRÍTICO: varios contenedores (.auth-screen, .app-frame...) tienen display:flex,
   que pisa el atributo [hidden]. Sin esto, la pantalla de login NO se oculta al
   entrar y tapa la app. Esto garantiza que [hidden] siempre oculte. */
[hidden] { display: none !important; }
.auth-error-action { background: none; border: none; padding: 0; margin-left: 4px;
  color: #506600; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* Base type — explicit so it never falls back to serif (independent of Tailwind CDN) */
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; }
/* Wordmark del logo: Lexend (igual que el design system) */
.auth-card h1 { font-family: 'Lexend', system-ui, sans-serif; font-weight: 700; letter-spacing: -0.02em; }

html, body { height: 100%; }
body {
  margin: 0;
  background: #d9dcc6;
  -webkit-font-smoothing: antialiased;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}

/* ============================================================
   PLATAFORMA: Ropavieja es solo para MÓVIL (y tablet como máximo).
   No está diseñada para escritorio; en pantallas anchas se muestra
   centrada como un marco de teléfono + aviso (#desktop-note).
   ============================================================ */
#desktop-note { display: none; }
@media (min-width: 1000px) {
  #desktop-note {
    display: block; position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
    z-index: 10000; background: #1c1c1c; color: #ccff00;
    font-family: 'Inter', system-ui, sans-serif; font-size: 13px; font-weight: 600;
    padding: 8px 16px; border-radius: 9999px; box-shadow: 0 6px 20px rgba(0,0,0,.18);
    max-width: 90vw; text-align: center;
  }
}

/* ---------- phone frame ---------- */
.app-frame {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  height: 100dvh;
  background: #f9fbe5;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.22);
}
@media (min-width: 460px) {
  body { padding: 20px 0; }
  .app-frame { height: calc(100dvh - 40px); }  /* sin esquinas redondeadas en escritorio */
}

/* ---------- screens ---------- */
.screen { display: none; animation: fade .25s ease; }
.screen.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

/* ---------- elevation ---------- */
.bento-card { box-shadow: 0 4px 20px rgba(0,0,0,.04); transition: transform .2s ease, box-shadow .2s ease; }
.bento-card:active { transform: scale(.98); box-shadow: none; }
.recipe-card { box-shadow: 0 4px 20px rgba(0,0,0,.05); transition: transform .2s ease; cursor: pointer; }
.recipe-card:active { transform: scale(.98); }

/* ---------- filter chips ---------- */
.chip { background: #edf0da; border: 1px solid #c4c9ac; color: #444933; cursor: pointer; }
.chip.is-on { background: #506600; border-color: #506600; color: #fff; }

/* ---------- bottom nav ---------- */
.navtab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 16px; border-radius: 9999px; cursor: pointer;
  color: #444933; background: transparent; border: none;
  transition: transform .2s ease;
}
.navtab .material-symbols-outlined { font-size: 24px; }
.navtab .nav-label { font-family: 'Inter'; font-size: 12px; font-weight: 500; letter-spacing: .04em; }
.navtab.is-on { background: #ccff00; color: #5b7300; }
.navtab:active { transform: scale(.9); }

/* ---------- bell badge ---------- */
.bell-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px;
  background: #ba1a1a; color: #fff; border-radius: 9999px; padding: 0 5px;
  font-family: 'Inter'; font-size: 11px; font-weight: 800; line-height: 18px;
  text-align: center; border: 2px solid #f9fbe5;
}

/* ---------- toggle switch ---------- */
.toggle {
  width: 48px; height: 28px; border-radius: 9999px; background: #c4c9ac;
  position: relative; border: none; cursor: pointer; transition: background .2s ease; flex: 0 0 auto;
}
.toggle .knob {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; transition: transform .2s ease;
}
.toggle.on { background: #506600; }
.toggle.on .knob { transform: translateX(20px); }

/* ---------- freshness bar ---------- */
.fresh-track { width: 100%; height: 10px; border-radius: 9999px; background: #e2e4cf; overflow: hidden; }
.fresh-track > i { display: block; height: 100%; border-radius: 9999px; }

/* ---------- scanner viewfinder ---------- */
.viewfinder { box-shadow: inset 0 0 60px rgba(0,0,0,.5); }
.receipt {
  width: 150px; background: #f4f1e8; border-radius: 6px; padding: 16px 14px;
  transform: rotate(-5deg); box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.receipt .r-line { height: 5px; background: #cfc9bb; border-radius: 3px; margin: 5px 0; width: 100%; }
.receipt .r-gap { height: 8px; }
.bracket { position: absolute; width: 26px; height: 26px; border: 3px solid #ccff00; }
.bracket.tl { top: 16px; left: 16px; border-right: 0; border-bottom: 0; border-top-left-radius: 8px; }
.bracket.tr { top: 16px; right: 16px; border-left: 0; border-bottom: 0; border-top-right-radius: 8px; }
.bracket.bl { bottom: 16px; left: 16px; border-right: 0; border-top: 0; border-bottom-left-radius: 8px; }
.bracket.br { bottom: 16px; right: 16px; border-left: 0; border-top: 0; border-bottom-right-radius: 8px; }
#scan-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #ba1a1a; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* detected item checkbox */
.det-check {
  width: 26px; height: 26px; border-radius: 8px; border: 2px solid #c4c9ac; flex: 0 0 auto;
  display: grid; place-items: center; color: transparent; cursor: pointer; transition: all .15s ease;
}
.det-check.on { background: #ccff00; border-color: #ccff00; color: #1a1d10; }

/* ---------- chart ---------- */
.bar { flex: 1; background: #c4c9ac; border-radius: 8px 8px 0 0; transition: height .3s ease; }
.bar.hot { background: #506600; }

/* ---------- recipe bottom sheet ---------- */
.sheet-overlay { position: absolute; inset: 0; background: rgba(26,29,16,.5); z-index: 50; display: flex; align-items: flex-end; }
.sheet {
  width: 100%; max-height: 88%; overflow-y: auto;
  background: #f9fbe5; border-radius: 28px 28px 0 0; padding: 10px 22px 26px;
  animation: rise .26s ease;
}
.sheet::-webkit-scrollbar { display: none; }
@keyframes rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
.grab { width: 42px; height: 5px; border-radius: 3px; background: #c4c9ac; margin: 6px auto 16px; }

/* ---------- auth ---------- */
.auth-screen {
  position: fixed; inset: 0; z-index: 100; background: #f9fbe5;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card { width: 100%; max-width: 380px; }
.auth-logo {
  width: 64px; height: 64px; border-radius: 20px; background: #1c1c1c;
  display: grid; place-items: center; margin-bottom: 20px;
}
.auth-logo .material-symbols-outlined { font-size: 36px; color: #506600; }
.auth-input {
  width: 100%; background: #f3f5df; border: 1.5px solid #c4c9ac; border-radius: 14px;
  padding: 14px 16px; font-family: 'Inter'; font-size: 16px; color: #1a1d10; margin-bottom: 12px;
  transition: border-color .15s ease;
}
.auth-input:focus { outline: none; border-color: #506600; }
.auth-input::placeholder { color: rgba(68,73,51,.55); }
.auth-btn {
  width: 100%; background: #ccff00; color: #5b7300; border: none; cursor: pointer;
  font-family: 'Inter'; font-weight: 700; font-size: 16px; padding: 15px; border-radius: 9999px;
  margin-top: 4px; transition: transform .15s ease;
}
.auth-btn:active { transform: scale(.97); }
.auth-toggle { text-align: center; margin-top: 18px; color: #444933; font-size: 14px; }
.auth-toggle button { background: none; border: none; color: #506600; font-weight: 700; cursor: pointer; font-size: 14px; }
.auth-error {
  background: #ffdad6; color: #93000a; font-size: 14px; font-weight: 600;
  padding: 10px 14px; border-radius: 12px; margin-bottom: 14px;
}

/* ---------- welcome / intro (primera pantalla para visitantes) ---------- */
.welcome-screen {
  position: fixed; inset: 0; z-index: 100; background: #f9fbe5;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; justify-content: center;
}
.welcome-inner { width: 100%; max-width: 400px; padding: 40px 24px 36px; }
.welcome-logo {
  width: 64px; height: 64px; border-radius: 20px; background: #1c1c1c;
  display: grid; place-items: center; margin-bottom: 18px;
}
.welcome-title {
  font-family: 'Lexend', system-ui, sans-serif; font-weight: 700;
  letter-spacing: -.02em; font-size: 40px; line-height: 1; color: #5b7300; margin: 0;
}
.welcome-tag { color: #444933; font-size: 16px; line-height: 1.4; margin: 12px 0 28px; }
.welcome-step { margin-bottom: 22px; }
.welcome-step-head { display: flex; align-items: center; gap: 10px; }
.welcome-num {
  flex: none; width: 28px; height: 28px; border-radius: 9999px; background: #ccff00;
  color: #5b7300; font-family: 'Inter', system-ui, sans-serif; font-weight: 800; font-size: 14px;
  display: grid; place-items: center;
}
.welcome-step-t { font-family: 'Lexend', system-ui, sans-serif; font-weight: 700; font-size: 17px; color: #1a1d10; }
.welcome-step-s { font-size: 14px; color: #444933; margin: 6px 0 0 38px; }
.welcome-shot {
  position: relative; margin: 12px 0 0; border-radius: 18px; overflow: hidden;
  aspect-ratio: 16 / 10; background: #edf0da;
}
.welcome-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.welcome-shot-ph {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; color: #9aa07f;
  font-family: 'Inter', system-ui, sans-serif; font-size: 13px; text-align: center; padding: 12px;
  border: 2px dashed #c4c9ac; border-radius: 18px;
}
.welcome-shot-ph .material-symbols-outlined { font-size: 28px; }
.welcome-cta { margin-top: 28px; }
.welcome-alt { text-align: center; margin-top: 16px; color: #444933; font-size: 14px; }
.welcome-alt button { background: none; border: none; color: #506600; font-weight: 700; cursor: pointer; font-size: 14px; }

/* ---------- loading overlay ---------- */
.loading {
  position: absolute; inset: 0; background: rgba(15,35,28,.55); z-index: 70;
  display: grid; place-items: center;
}
.loading .box { background: #fff; border-radius: 18px; padding: 26px 30px; text-align: center; max-width: 80%; }
.loading .spin {
  width: 40px; height: 40px; margin: 0 auto 14px; border-radius: 50%;
  border: 4px solid #e2e4cf; border-top-color: #506600; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toast ---------- */
.toast {
  position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(12px);
  background: #2f3223; color: #f0f3dd; font-family: 'Inter'; font-weight: 600; font-size: 14px;
  padding: 12px 18px; border-radius: 12px; z-index: 60; opacity: 0;
  transition: opacity .22s ease, transform .22s ease; max-width: 86%; text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
