/* ============================================================
   Cookbook PWA – Main Stylesheet
   iPad-first, touch-optimized, full-screen PWA
   ============================================================ */

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

html {
  height: 100%;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  height: 100dvh;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-base);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

img { display: block; max-width: 100%; }
button { border: none; background: none; cursor: pointer; font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ── App Shell Layout ────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--color-base);
  transition: background 0.3s ease;
}

/* ── Header ──────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 60px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0);
  background: var(--color-header-bg);
  border-bottom: 1px solid var(--color-header-border);
  flex-shrink: 0;
  z-index: 10;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.page-title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.3s ease;
}

/* Header in bold-family / dark-cook themes: invert text */
[data-theme="bold-family"] .page-title,
[data-theme="dark-cook"] .page-title { color: var(--color-text-on-primary); }

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: var(--color-primary);
  transition: background 0.15s ease, color 0.3s ease;
  flex-shrink: 0;
}
.header-btn:active { background: var(--color-accent); }
[data-theme="bold-family"] .header-btn,
[data-theme="dark-cook"] .header-btn { color: var(--color-text-on-primary); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── View Container ──────────────────────────────────────── */
.view-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--color-base);
  transition: background 0.3s ease;
}

/* ── Bottom Navigation ───────────────────────────────────── */
.bottom-nav {
  display: flex;
  align-items: flex-start;
  padding-top: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--color-nav-bg);
  border-top: 1px solid var(--color-border);
  box-shadow: var(--shadow-nav);
  flex-shrink: 0;
  z-index: 10;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  color: var(--color-text-light);
  border-radius: 12px;
  transition: color 0.2s ease;
  min-height: 48px;
}
.nav-item svg { width: 22px; height: 22px; stroke-width: 1.8; }
.nav-item span { font-size: 11px; font-weight: 500; line-height: 1; }
.nav-item.active { color: var(--color-primary); }
.nav-item:active { opacity: 0.7; }

/* Bold-family has dark nav – make inactive items visible */
[data-theme="bold-family"] .nav-item { color: rgba(255,255,255,0.45); }
[data-theme="bold-family"] .nav-item.active { color: var(--color-accent); }
[data-theme="dark-cook"] .nav-item { color: var(--color-text-light); }
[data-theme="dark-cook"] .nav-item.active { color: var(--color-primary); }

/* ── Section Layout ──────────────────────────────────────── */
.section { padding: 20px 16px; }
.section + .section { padding-top: 0; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
}
.section-link {
  font-size: 14px;
  color: var(--color-primary);
  font-weight: 500;
}

/* ── Recipe Grid ─────────────────────────────────────────── */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ── Recipe Card ─────────────────────────────────────────── */
.recipe-card {
  background: var(--color-card);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  border: 1px solid var(--color-border);
  position: relative;
}
.recipe-card:active { transform: scale(0.97); }

.recipe-card-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--color-accent);
  display: block;
}

.recipe-card-body { padding: 12px 14px 14px; }

.recipe-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recipe-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text-secondary);
  font-size: 12px;
  margin-bottom: 8px;
}
.recipe-card-meta-item {
  display: flex;
  align-items: center;
  gap: 3px;
}
.recipe-card-meta svg { width: 13px; height: 13px; }

.recipe-card-fav {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,0.90);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 6px rgba(0,0,0,0.12);
  backdrop-filter: blur(4px);
}
.recipe-card-fav svg { width: 16px; height: 16px; }
.recipe-card-fav.active svg { stroke: var(--color-fav); fill: var(--color-fav); }

/* ── Tags ────────────────────────────────────────────────── */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.tag-teen {
  background: #FFF3CD;
  color: #7A5800;
}

/* ── Category Pills ──────────────────────────────────────── */
.category-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 4px;
  scrollbar-width: none;
}
.category-pills::-webkit-scrollbar { display: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--color-accent);
  color: var(--color-text-secondary);
  border: 1.5px solid transparent;
  transition: all 0.15s ease;
  flex-shrink: 0;
  min-height: 40px;
}
.pill svg { width: 16px; height: 16px; }
.pill.active {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  border-color: var(--color-primary);
}
.pill:active { opacity: 0.75; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.15s ease;
  min-height: 48px;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(0.97); opacity: 0.85; }

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  box-shadow: 0 2px 8px rgba(var(--color-primary-rgb), 0.30);
}
.btn-secondary {
  background: var(--color-accent);
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
}
.btn-danger {
  background: #FEE2E2;
  color: #B91C1C;
}
.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  padding: 10px 14px;
}
.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
}
.btn-full { width: 100%; }

/* FAB – floating action button */
.fab {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(var(--color-primary-rgb), 0.40);
  z-index: 20;
  transition: transform 0.2s ease;
}
.fab svg { width: 24px; height: 24px; }
.fab:active { transform: scale(0.92); }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px 14px;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 12px;
  font-size: 16px; /* 16px prevents iOS zoom */
  color: var(--color-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
  min-height: 48px;
  user-select: text;
  -webkit-user-select: text;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.12);
}
.form-textarea { min-height: 100px; resize: vertical; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* Ingredient / Step rows */
.ingredient-row,
.step-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.ingredient-row .form-input { flex: 1; }
.step-row .form-textarea { flex: 1; }
.remove-row-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 48px;
  color: #B91C1C;
  border-radius: 10px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.remove-row-btn:active { background: #FEE2E2; }

.add-row-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-primary);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 0;
}

/* ── Hero Section (Home) ─────────────────────────────────── */
.hero {
  padding: 28px 20px 20px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: var(--color-text-on-primary);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero-greeting {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.80;
  margin-bottom: 4px;
}
.hero-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
}
.hero-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.20);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 12px 16px;
  color: rgba(255,255,255,0.90);
  cursor: pointer;
  border: 1.5px solid rgba(255,255,255,0.25);
  transition: background 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}
.hero-search:active { background: rgba(255,255,255,0.28); }
.hero-search svg { width: 18px; height: 18px; flex-shrink: 0; }
.hero-search span { font-size: 15px; }

/* ── Recipe Detail ───────────────────────────────────────── */
.recipe-hero-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--color-accent);
  display: block;
}

.recipe-detail-body { padding: 20px 20px 32px; }

.recipe-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 10px;
  line-height: 1.2;
}

.recipe-meta-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.recipe-meta-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--color-accent);
  border-radius: 10px;
  font-size: 13px;
  color: var(--color-text-secondary);
  font-weight: 500;
}
.recipe-meta-chip svg { width: 15px; height: 15px; color: var(--color-primary); }

/* Tab switcher (Ingredients / Steps) */
.tab-bar {
  display: flex;
  background: var(--color-accent);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 20px;
  gap: 4px;
}
.tab-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-align: center;
  transition: all 0.2s ease;
}
.tab-btn.active {
  background: var(--color-card);
  color: var(--color-primary);
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

/* Ingredient check-off list */
.ingredient-list { display: flex; flex-direction: column; gap: 2px; }
.ingredient-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.ingredient-item:last-child { border-bottom: none; }
.ingredient-item.checked { opacity: 0.4; }
.ingredient-item.checked .ingredient-text { text-decoration: line-through; }
.ingredient-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.ingredient-item.checked .ingredient-check {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.ingredient-check svg { width: 13px; height: 13px; color: white; }
.ingredient-text { font-size: 15px; color: var(--color-text); }
.ingredient-amount {
  font-size: 13px;
  color: var(--color-text-secondary);
  font-weight: 500;
  margin-left: auto;
  flex-shrink: 0;
}

/* Steps list */
.steps-list { display: flex; flex-direction: column; gap: 16px; }
.step-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.step-number {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.step-text {
  font-size: 16px;
  color: var(--color-text);
  line-height: 1.55;
  flex: 1;
  padding-top: 5px;
}

/* Recipe action bar */
.recipe-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* ── Cook Mode ───────────────────────────────────────────── */
.cook-mode {
  position: fixed;
  inset: 0;
  background: var(--color-cook-bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top, 20px) 24px env(safe-area-inset-bottom, 24px);
}

.cook-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 24px;
}
.cook-header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-cook-accent);
}
.cook-progress { font-size: 14px; color: rgba(255,255,255,0.45); }

.cook-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cook-step-text {
  font-size: 28px;
  font-weight: 500;
  color: var(--color-cook-text);
  line-height: 1.5;
  text-align: center;
  max-width: 680px;
}

.cook-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 8px;
  gap: 16px;
}
.cook-nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 24px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  color: var(--color-cook-text);
  transition: background 0.15s ease;
  min-width: 120px;
  justify-content: center;
}
.cook-nav-btn:active { background: rgba(255,255,255,0.15); }
.cook-nav-btn.primary {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
}
.cook-exit {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.45);
  font-size: 14px;
}

/* ── Scale Modal ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  backdrop-filter: blur(4px);
}
.modal-sheet {
  background: var(--color-card);
  border-radius: 24px 24px 0 0;
  width: 100%;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
}
.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  margin: 0 auto 20px;
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }

/* ── Ask Claude View ─────────────────────────────────────── */
.ask-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ask-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.quick-prompts {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px 4px;
  scrollbar-width: none;
}
.quick-prompts::-webkit-scrollbar { display: none; }

.quick-prompt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--color-accent);
  border: 1.5px solid var(--color-border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}
.quick-prompt-btn svg { width: 14px; height: 14px; }
.quick-prompt-btn:active { background: var(--color-primary); color: var(--color-text-on-primary); border-color: var(--color-primary); }

/* Chat bubbles */
.chat-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--color-chat-user-bg);
  color: var(--color-chat-user-text);
  border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--color-chat-ai-bg);
  color: var(--color-chat-ai-text);
  border-bottom-left-radius: 4px;
}
.chat-bubble.typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 16px;
}
.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-light);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

.save-recipe-btn {
  margin-top: 10px;
  align-self: flex-start;
}

/* Ask input bar */
.ask-input-bar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--color-card);
  border-top: 1px solid var(--color-border);
}
.ask-input {
  flex: 1;
  padding: 12px 14px;
  background: var(--color-accent);
  border: 1.5px solid var(--color-border);
  border-radius: 14px;
  font-size: 16px;
  color: var(--color-text);
  outline: none;
  resize: none;
  max-height: 120px;
  min-height: 48px;
  user-select: text;
  -webkit-user-select: text;
}
.ask-input:focus { border-color: var(--color-primary); }
.ask-send-btn {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.ask-send-btn:disabled { opacity: 0.4; }
.ask-send-btn svg { width: 20px; height: 20px; }

/* ── Settings ────────────────────────────────────────────── */
.settings-section {
  background: var(--color-card);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  margin-bottom: 20px;
}
.settings-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 16px 4px;
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.15s;
}
.settings-row:last-child { border-bottom: none; }
.settings-row:active { background: var(--color-accent); }
.settings-row-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.settings-row-icon svg { width: 17px; height: 17px; }
.settings-row-label { flex: 1; font-size: 15px; font-weight: 500; }
.settings-row-value { font-size: 14px; color: var(--color-text-secondary); }
.settings-row-chevron { color: var(--color-text-light); }
.settings-row-chevron svg { width: 16px; height: 16px; }

/* Theme swatches */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 4px;
}
@media (min-width: 600px) {
  .theme-grid { grid-template-columns: repeat(5, 1fr); }
}
.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.15s;
  border: 2px solid transparent;
}
.theme-swatch.active { border-color: var(--color-primary); background: var(--color-accent); }
.theme-swatch:active { opacity: 0.75; }
.swatch-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.08);
}
.swatch-label { font-size: 11px; font-weight: 500; color: var(--color-text-secondary); text-align: center; }

/* ── Search ──────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 16px;
}
.search-bar svg { width: 18px; height: 18px; color: var(--color-text-light); flex-shrink: 0; }
.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--color-text);
  user-select: text;
  -webkit-user-select: text;
}
.search-bar input::placeholder { color: var(--color-text-light); }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  text-align: center;
  gap: 12px;
}
.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.empty-state-icon svg { width: 30px; height: 30px; color: var(--color-primary); }
.empty-state h3 { font-size: 18px; font-weight: 700; }
.empty-state p { font-size: 14px; color: var(--color-text-secondary); line-height: 1.5; }

/* ── Loading Spinner ─────────────────────────────────────── */
.spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Toast Notifications ─────────────────────────────────── */
.toast-container {
  position: fixed;
  top: calc(70px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 480px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  animation: toast-in 0.3s ease forwards;
  pointer-events: all;
}
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast.success { background: #D1FAE5; color: #065F46; }
.toast.error   { background: #FEE2E2; color: #991B1B; }
.toast.info    { background: var(--color-accent); color: var(--color-text); border: 1px solid var(--color-border); }
.toast.out { animation: toast-out 0.3s ease forwards; }

/* ── Lock Screen ─────────────────────────────────────────── */
.lock-screen {
  position: fixed;
  inset: 0;
  background: var(--color-primary);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lock-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: white;
  text-align: center;
}
.lock-icon svg { width: 48px; height: 48px; color: rgba(255,255,255,0.7); }
.lock-content h2 { font-size: 24px; font-weight: 700; }
.lock-content p  { font-size: 14px; opacity: 0.7; }
.pin-dots { display: flex; gap: 16px; margin: 8px 0; }
.pin-dots .dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  transition: background 0.15s;
}
.pin-dots .dot.filled { background: white; border-color: white; }
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 80px);
  gap: 12px;
  margin-top: 8px;
}
.pin-key {
  height: 72px;
  border-radius: 16px;
  background: rgba(255,255,255,0.15);
  color: white;
  font-size: 24px;
  font-weight: 600;
  transition: background 0.15s;
}
.pin-key:active { background: rgba(255,255,255,0.30); }
.pin-clear { font-size: 16px; }

/* ── Utility ─────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--color-text-secondary); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.p-4 { padding: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--color-border); margin: 8px 0; }

/* ── Animations ──────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-10px); }
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fade-in 0.25s ease forwards; }

/* ── Responsive ──────────────────────────────────────────── */
@media (min-width: 768px) {
  .recipe-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .hero-title  { font-size: 32px; }
  .cook-step-text { font-size: 36px; }
}
@media (min-width: 1024px) {
  .recipe-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}
