/* ==========================================================================
   Cocina Saludable Premium — Design System
   ========================================================================== */

:root {
  --color-cream: #FBF6EC;
  --color-offwhite: #FDFBF7;
  --color-beige: #EFE3CC;
  --color-olive: #7C8B5A;
  --color-olive-dark: #5C6B3E;
  --color-soft-green: #A9BF8C;
  --color-terracotta: #C97B4A;
  --color-terracotta-dark: #A85F32;
  --color-chocolate: #4A3728;
  --color-text: #3A2E22;
  --color-text-muted: #7A6C5D;
  --color-border: #E4D7BE;
  --color-danger: #B3492F;

  --font-head: "Fraunces", "Georgia", serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 8px rgba(74, 55, 40, 0.08);
  --shadow-md: 0 8px 24px rgba(74, 55, 40, 0.12);
  --shadow-lg: 0 16px 40px rgba(74, 55, 40, 0.16);

  --nav-height: 64px;
  --header-height: 56px;
  --max-width: 480px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--color-cream);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  color: var(--color-chocolate);
  margin: 0 0 8px;
  line-height: 1.15;
  font-weight: 600;
}

p { margin: 0 0 12px; line-height: 1.55; color: var(--color-text); }
a { color: var(--color-olive-dark); text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* Layout shell */
#app-shell {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--color-offwhite);
  position: relative;
  padding-bottom: calc(var(--nav-height) + 12px);
  box-shadow: 0 0 60px rgba(74,55,40,0.06);
}

.top-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(253, 251, 247, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--color-border);
}

.top-header .brand {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--color-chocolate);
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-header .brand .leaf {
  width: 22px; height: 22px;
  background: var(--color-olive);
  border-radius: 40% 60% 60% 40% / 50% 40% 60% 50%;
}

.icon-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--color-beige);
  color: var(--color-chocolate);
  font-size: 18px;
}

main.view {
  padding: 16px 16px 8px;
  animation: fadeIn .25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  height: var(--nav-height);
  background: var(--color-offwhite);
  border-top: 1px solid var(--color-border);
  display: flex;
  z-index: 30;
  box-shadow: 0 -4px 16px rgba(74,55,40,0.06);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 600;
}

.bottom-nav a .nav-icon { font-size: 20px; line-height: 1; }
.bottom-nav a.active { color: var(--color-olive-dark); }
.bottom-nav a.active .nav-icon { transform: translateY(-1px); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 15px;
  border: none;
  min-height: 48px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--color-olive-dark); color: var(--color-offwhite); box-shadow: var(--shadow-sm); }
.btn-secondary { background: var(--color-beige); color: var(--color-chocolate); }
.btn-terracotta { background: var(--color-terracotta); color: var(--color-offwhite); }
.btn-outline { background: transparent; border: 1.5px solid var(--color-olive-dark); color: var(--color-olive-dark); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 8px 16px; font-size: 13px; }

/* Cards */
.card {
  background: var(--color-offwhite);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-media { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--color-beige); }
.card-body { padding: 14px; }
.card-title { font-size: 16px; margin-bottom: 4px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }

.tag {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-soft-green);
  color: var(--color-olive-dark);
  white-space: nowrap;
}
.tag.terracotta { background: #F3D9CC; color: var(--color-terracotta-dark); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.recipe-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.hero-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-md);
  margin-bottom: 18px;
}
.hero-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.hero-card .hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(74,55,40,0) 40%, rgba(58,46,34,0.72) 100%);
  display: flex; align-items: flex-end;
  padding: 18px;
}
.hero-card .hero-overlay h1 { color: #fff; font-size: 22px; margin-bottom: 4px; }
.hero-card .hero-overlay p { color: rgba(255,255,255,0.9); font-size: 13px; margin: 0; }

/* Search / filters */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--color-beige);
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  margin-bottom: 12px;
}
.search-bar input {
  border: none; background: transparent; outline: none;
  font-size: 15px; width: 100%; color: var(--color-text); font-family: var(--font-body);
}

.filter-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 4px; scrollbar-width: none; }
.filter-scroll::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  background: var(--color-offwhite);
  border: 1.5px solid var(--color-border);
  font-size: 13px; font-weight: 600; color: var(--color-text-muted);
}
.filter-chip.active { background: var(--color-olive-dark); border-color: var(--color-olive-dark); color: #fff; }

/* Section headers */
.section-header { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 10px; }
.section-header h2 { font-size: 19px; }
.section-header a { font-size: 13px; font-weight: 700; color: var(--color-terracotta-dark); }

/* Access gate */
.access-screen {
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 32px 24px;
  background: linear-gradient(160deg, var(--color-beige) 0%, var(--color-cream) 55%, var(--color-soft-green) 130%);
  max-width: var(--max-width);
  margin: 0 auto;
}
.access-screen .logo-mark {
  width: 64px; height: 64px; border-radius: 22px;
  background: linear-gradient(135deg, var(--color-olive), var(--color-olive-dark));
  margin-bottom: 18px;
}
.access-screen h1 { font-size: 26px; margin-bottom: 8px; }
.access-screen p.lead { color: var(--color-text-muted); margin-bottom: 26px; }
.access-form input {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  font-size: 17px;
  letter-spacing: 1px;
  margin-bottom: 12px;
  text-transform: uppercase;
  background: var(--color-offwhite);
}
.access-error { color: var(--color-danger); font-size: 13px; font-weight: 600; margin: -4px 0 12px; min-height: 16px; }
.access-support { margin-top: 22px; font-size: 12.5px; color: var(--color-text-muted); text-align: center; }

/* Recipe detail */
.recipe-hero { border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 14px; box-shadow: var(--shadow-md); }
.recipe-hero img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.meta-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 16px; }
.meta-pill { background: var(--color-beige); border-radius: var(--radius-pill); padding: 7px 14px; font-size: 12.5px; font-weight: 700; color: var(--color-chocolate); display: flex; align-items: center; gap: 6px; }

.ingredient-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.ingredient-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--color-olive-dark); flex-shrink: 0; }
.ingredient-row label { flex: 1; font-size: 14.5px; }
.ingredient-row .add-btn { border: none; background: none; color: var(--color-olive-dark); font-size: 18px; padding: 4px 8px; }

.step-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px dashed var(--color-border); }
.step-num {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%;
  background: var(--color-olive-dark); color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.step-item p { margin: 0; }

.cooking-mode-bar {
  position: sticky; bottom: calc(var(--nav-height) + 12px);
  background: var(--color-chocolate); color: #fff;
  border-radius: var(--radius-pill);
  padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-lg);
  margin-top: 18px;
}
.cooking-mode-bar button { background: var(--color-terracotta); color: #fff; border: none; border-radius: var(--radius-pill); padding: 10px 16px; font-weight: 700; font-size: 13px; }

.floating-toast {
  position: fixed; bottom: calc(var(--nav-height) + 22px); left: 50%; transform: translateX(-50%);
  background: var(--color-chocolate); color: #fff; padding: 12px 20px; border-radius: var(--radius-pill);
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg); z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
  max-width: calc(100% - 48px); text-align: center;
}
.floating-toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* Shopping list */
.shop-item { display: flex; align-items: center; gap: 10px; background: var(--color-offwhite); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 8px; }
.shop-item.checked label { text-decoration: line-through; color: var(--color-text-muted); }
.shop-item label { flex: 1; font-size: 14.5px; }
.shop-item .remove-btn { background: none; border: none; color: var(--color-text-muted); font-size: 16px; }

/* Progress / challenges */
.progress-bar-track { background: var(--color-beige); border-radius: var(--radius-pill); height: 10px; overflow: hidden; margin: 8px 0 4px; }
.progress-bar-fill { background: linear-gradient(90deg, var(--color-olive), var(--color-terracotta)); height: 100%; border-radius: var(--radius-pill); transition: width .3s ease; }
.challenge-card { padding: 16px; }
.challenge-day-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
.day-dot { aspect-ratio: 1; border-radius: 50%; background: var(--color-beige); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--color-text-muted); border: 1px solid var(--color-border); }
.day-dot.done { background: var(--color-olive-dark); color: #fff; border-color: var(--color-olive-dark); }

/* Install page */
.step-card { display: flex; gap: 12px; padding: 16px; margin-bottom: 10px; }
.step-card .step-badge { width: 32px; height: 32px; border-radius: 50%; background: var(--color-terracotta); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.platform-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.platform-toggle button { flex: 1; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; color: var(--color-text-muted); }
.empty-state .emoji { font-size: 40px; margin-bottom: 12px; }

/* Support page */
.support-block { margin-bottom: 18px; }
.legal-note { font-size: 12px; color: var(--color-text-muted); background: var(--color-beige); padding: 12px 14px; border-radius: var(--radius-md); margin-top: 20px; }

/* Utility */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.hidden { display: none !important; }

@media (min-width: 520px) {
  #app-shell { border-left: 1px solid var(--color-border); border-right: 1px solid var(--color-border); }
}

.access-code-box {
  margin-top: 10px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #f7efe2;
  border: 1px solid rgba(92, 107, 62, 0.18);
  color: var(--color-olive-dark);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
}
