/* ============================================
   MY RECIPE BOOK — styles.css
   Tablet-first, warm terracotta & cream palette
   ============================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  --terracotta: #C1694F;
  --terracotta-light: #D98B72;
  --terracotta-dark: #A0523A;
  --cream: #FFF8F0;
  --cream-dark: #F5EDE3;
  --warm-brown: #5C3D2E;
  --warm-brown-light: #7A5A4A;
  --soft-gold: #D4A76A;
  --soft-gold-light: #E8C99B;
  --white: #FFFFFF;
  --text-primary: #3B2519;
  --text-secondary: #7A5A4A;
  --text-muted: #A08878;
  --border: #E8D8CC;
  --shadow-sm: 0 1px 3px rgba(92,61,46,0.08);
  --shadow-md: 0 4px 12px rgba(92,61,46,0.10);
  --shadow-lg: 0 8px 24px rgba(92,61,46,0.14);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 999px;
  --nav-height: 72px;
  --font-body: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Merriweather', Georgia, serif;
  --transition: 0.25s ease;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 18px; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100dvh;
  width: 100%;
}
h1, h2, h3 { font-family: var(--font-heading); font-weight: 700; line-height: 1.3; }
a { color: var(--terracotta); text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font-body); border: none; background: none; }
input, textarea, select { font-family: var(--font-body); font-size: 1rem; }
textarea { resize: vertical; }
hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ---------- Utility ---------- */
.required { color: var(--terracotta); }

/* ---------- Loading Splash ---------- */
#loading-splash {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  z-index: 9999;
  gap: 1rem;
}
#loading-splash .login-logo {
  font-size: 3rem;
  color: var(--terracotta);
}
.loading-splash-text {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--text-secondary);
}

/* ---------- Views ---------- */
.view {
  position: absolute;
  inset: 0;
  bottom: var(--nav-height);
  display: none;
  flex-direction: column;
  background: var(--cream);
  z-index: 1;
}
.view.active { display: flex; }
.view.sub-view { z-index: 10; }
.page-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem 1.5rem;
  padding-bottom: 2rem;
  -webkit-overflow-scrolling: touch;
}

/* View transitions */
.view.slide-in { animation: slideIn 0.3s ease forwards; }
.view.slide-out { animation: slideOut 0.3s ease forwards; }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slideOut { from { transform: translateX(0); } to { transform: translateX(100%); } }

/* ---------- Login View ---------- */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
  text-align: center;
}
.login-logo {
  font-size: 3.5rem;
  color: var(--terracotta);
  margin-bottom: 1rem;
}
.login-title {
  font-size: 2rem;
  color: var(--warm-brown);
  margin-bottom: 0.5rem;
}
.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  font-size: 1.1rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius-full);
  font-size: 1rem;
  font-weight: 600;
  transition: all var(--transition);
  min-height: 48px;
  min-width: 48px;
}
.btn-primary {
  background: var(--terracotta);
  color: var(--white);
}
.btn-primary:hover, .btn-primary:active { background: var(--terracotta-dark); }
.btn-outline {
  border: 2px solid var(--border);
  color: var(--text-primary);
  background: var(--white);
}
.btn-outline:hover { border-color: var(--terracotta-light); }
.btn-danger {
  background: #D9534F;
  color: var(--white);
}
.btn-danger:hover { background: #C9302C; }
.btn-google {
  background: var(--white);
  color: var(--text-primary);
  border: 2px solid var(--border);
  padding: 0.9rem 2rem;
  font-size: 1.05rem;
  box-shadow: var(--shadow-sm);
}
.btn-google:hover { box-shadow: var(--shadow-md); border-color: var(--terracotta-light); }
.google-icon { width: 22px; height: 22px; }
.btn-admin-login {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.82rem;
  color: var(--terracotta);
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  padding: 0.25rem 0.5rem;
  transition: color var(--transition);
}
.btn-admin-login:hover { color: var(--terracotta-dark); }

/* ---------- Admin View ---------- */
.admin-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-top: 0.5rem;
}
.admin-section {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}
.admin-section-title {
  font-size: 1.05rem;
  color: var(--warm-brown);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.admin-section-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}
.btn-large { padding: 1rem 2rem; font-size: 1.1rem; }
.btn-block { width: 100%; }
.btn-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.6rem 1rem;
  transition: color var(--transition);
}
.btn-text:hover { color: var(--terracotta); }
.btn-text i { margin-right: 0.3rem; }
.btn-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-size: 1.2rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--cream-dark); color: var(--terracotta); }
.btn-danger-icon { color: #D9534F; }
.btn-danger-icon:hover { background: #FDE8E7; }
.btn-ai {
  background: linear-gradient(135deg, var(--soft-gold), var(--terracotta-light));
  color: var(--white);
  margin-top: 0.75rem;
  font-size: 0.95rem;
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.3s ease;
}
.btn-ai:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

/* ---------- Home Header ---------- */
.home-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.welcome-text {
  font-size: 1.7rem;
  color: var(--warm-brown);
}
.date-text {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

/* ---------- Search Bar ---------- */
.search-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}
.search-bar-wrapper:hover { border-color: var(--terracotta-light); box-shadow: var(--shadow-md); }
.search-bar-icon { color: var(--terracotta); font-size: 1.1rem; }
.search-bar-placeholder {
  color: var(--text-muted);
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
}

/* ---------- Suggestions ---------- */
.suggestions-section { margin-bottom: 1.5rem; }
.suggestion-group { margin-bottom: 2rem; }
.suggestion-heading {
  font-size: 1.05rem;
  color: var(--warm-brown-light);
  font-family: var(--font-body);
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.suggestion-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.suggestion-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition);
  animation: fadeInUp 0.5s ease both;
}
.suggestion-card:nth-child(2) { animation-delay: 0.1s; }
.suggestion-card:nth-child(3) { animation-delay: 0.2s; }
.suggestion-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.suggestion-card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--cream-dark);
}
.suggestion-card-title {
  padding: 0.5rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.archive-link-wrapper {
  text-align: center;
  padding: 1rem 0 1rem;
}

/* Empty suggestions */
.empty-suggestions {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}
.empty-suggestions i {
  font-size: 3rem;
  color: var(--soft-gold);
  margin-bottom: 1rem;
}
.empty-suggestions h2 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--warm-brown);
}
.empty-suggestions p { margin-bottom: 1.5rem; }

/* ---------- Recipe Book Header ---------- */
.recipes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.recipes-header h1 {
  font-size: 1.5rem;
  color: var(--warm-brown);
}

/* ---------- Category Tabs ---------- */
.category-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--white);
  color: var(--text-secondary);
  border: 2px solid var(--border);
  transition: all var(--transition);
  min-height: 44px;
}
.cat-tab.active, .cat-tab:hover {
  background: var(--terracotta);
  color: var(--white);
  border-color: var(--terracotta);
}

/* ---------- Recipe Grid ---------- */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.recipe-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.recipe-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.recipe-card-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--cream-dark);
}
.recipe-card-body { padding: 0.75rem; }
.recipe-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.recipe-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}
.tag-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--cream-dark);
  color: var(--text-secondary);
}
.tag-pill.diet { background: #E8F5E9; color: #2E7D32; }
.time-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.time-badge i { font-size: 0.7rem; }

/* Empty recipes */
.empty-recipes {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}
.empty-recipes i {
  font-size: 3rem;
  color: var(--soft-gold);
  margin-bottom: 1rem;
  display: block;
}

/* FAB */
.fab {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--terracotta);
  color: var(--white);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition);
  z-index: 5;
}
.fab:hover { background: var(--terracotta-dark); transform: scale(1.05); }

/* ---------- Sub Header ---------- */
.sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.sub-header h1 {
  font-size: 1.3rem;
  color: var(--warm-brown);
  flex: 1;
  text-align: center;
}
.detail-actions { display: flex; gap: 0; }

/* ---------- Recipe Form ---------- */
.recipe-form { padding-bottom: 2rem; }
.form-group { margin-bottom: 1.5rem; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--warm-brown);
  font-size: 0.95rem;
}
.form-group input[type="text"],
.form-group textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color var(--transition);
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--terracotta-light);
}

/* Image upload */
.image-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--white);
}
.image-upload-area:hover { border-color: var(--terracotta-light); }
.image-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}
.image-upload-placeholder i { font-size: 2rem; color: var(--terracotta-light); }
.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.image-preview-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1;
}
.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Tag chips */
.tag-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--white);
  color: var(--text-secondary);
  border: 2px solid var(--border);
  transition: all var(--transition);
  min-height: 44px;
  display: flex;
  align-items: center;
}
.chip.selected {
  background: var(--terracotta);
  color: var(--white);
  border-color: var(--terracotta);
}

/* Serving size */
.serving-size-wrapper {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
}
.serving-size-input {
  width: 100%;
  padding: 0.85rem 3rem 0.85rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color var(--transition);
  -moz-appearance: textfield;
  appearance: textfield;
}
.serving-size-input::-webkit-outer-spin-button,
.serving-size-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.serving-size-input:focus {
  outline: none;
  border-color: var(--terracotta-light);
}
.serving-size-dropdown {
  position: absolute;
  right: 2px;
  top: 2px;
  bottom: 2px;
}
.serving-size-toggle {
  height: 100%;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
}
.serving-size-options {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  width: 80px;
}
.serving-size-options.open { display: block; }
.serving-size-option {
  display: block;
  width: 100%;
  padding: 0.55rem 1rem;
  text-align: center;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition);
}
.serving-size-option:hover {
  background: var(--cream-dark);
  color: var(--terracotta);
}

/* Time picker */
.time-picker-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.time-display {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--terracotta);
  text-align: center;
}
.time-display span { font-size: 2.2rem; }
.radial-picker-container {
  width: 260px;
  height: 260px;
  touch-action: none;
}
#radial-picker { cursor: pointer; }

/* Form actions */
.form-actions { padding-top: 1rem; }

/* ---------- Recipe Detail ---------- */
.detail-images {
  margin: 0 -1.5rem;
  margin-top: -0.5rem;
}
.detail-hero-img {
  width: 100%;
  max-height: 350px;
  object-fit: cover;
}
.detail-extra-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding: 0.5rem 1.5rem 0;
}
.detail-extra-img {
  border-radius: var(--radius-sm);
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  cursor: pointer;
}
.detail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1rem 0;
}
.detail-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.detail-time {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.95rem;
}
.detail-time i { color: var(--terracotta); }
.detail-servings {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.95rem;
}
.detail-servings i { color: var(--terracotta); }
.detail-section { margin-bottom: 1.5rem; }
.detail-section h2 {
  font-size: 1.15rem;
  color: var(--warm-brown);
  margin-bottom: 0.75rem;
  font-family: var(--font-body);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.detail-section h2 i { color: var(--terracotta); font-size: 1rem; }

/* Ingredient checklist */
.ingredient-checklist { list-style: none; padding-left: 0; }
.checklist-item label {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0; cursor: pointer;
}
.checklist-item input[type="checkbox"] {
  width: 1.15rem; height: 1.15rem; accent-color: var(--terracotta);
  flex-shrink: 0; cursor: pointer;
}
.checklist-item input[type="checkbox"]:checked + span {
  text-decoration: line-through; opacity: 0.5;
}
.detail-section div {
  color: var(--text-primary);
  line-height: 1.7;
  white-space: pre-wrap;
}

.detail-actions-row {
  display: grid;
  gap: 0.65rem;
  margin-top: 1.25rem;
  margin-bottom: 1.5rem;
}

.btn-vegan-convert {
  border-color: #B8D8BE;
  color: #2E7D32;
  background: #F2FBF3;
  font-weight: 700;
}

.btn-vegan-convert:hover {
  border-color: #8CC89A;
  background: #E8F7EA;
}

.btn-vegan-convert:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-low-sodium-convert {
  border-color: #B9DAE7;
  color: #1A6A84;
  background: #F2FAFD;
  font-weight: 700;
}

.btn-low-sodium-convert:hover {
  border-color: #8BC3D8;
  background: #E9F6FB;
}

.btn-low-sugar-convert {
  border-color: #E7D4B0;
  color: #7B5B18;
  background: #FDF9F1;
  font-weight: 700;
}

.btn-low-sugar-convert:hover {
  border-color: #DDBE86;
  background: #FBF4E8;
}

.btn-low-calcium-convert {
  border-color: #D4E8D4;
  color: #2A6B3A;
  background: #F3FAF3;
  font-weight: 700;
}

.btn-low-calcium-convert:hover {
  border-color: #A8D4A8;
  background: #E9F5E9;
}

.btn-low-sodium-convert:disabled,
.btn-low-sugar-convert:disabled,
.btn-low-calcium-convert:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ---------- Archive ---------- */
.archive-list { display: block; }
.archive-day {
  margin-bottom: 1.5rem;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.archive-day-date {
  font-weight: 700;
  color: var(--warm-brown);
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
}
.archive-group-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  margin-top: 0.5rem;
}
.archive-recipes {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.archive-recipe-chip {
  padding: 0.35rem 0.75rem;
  background: var(--cream-dark);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
}
.archive-recipe-chip:hover { background: var(--terracotta-light); color: var(--white); }

/* ---------- Modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(59,37,25,0.4);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.modal.active { display: flex; }
.modal-content { background: var(--white); border-radius: var(--radius-xl); overflow: hidden; }
.modal-fullscreen {
  width: 100%;
  height: 100%;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}
.modal-panel {
  width: 90%;
  max-width: 420px;
  padding: 1.5rem;
}
.modal-dialog {
  width: 85%;
  max-width: 380px;
  padding: 1.75rem;
  text-align: center;
}
.modal-dialog h2 { margin-bottom: 0.5rem; }
.modal-dialog p { color: var(--text-secondary); margin-bottom: 1.25rem; }
.dialog-actions { display: flex; gap: 0.75rem; justify-content: center; }
.modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { flex: 1; font-size: 1.15rem; color: var(--warm-brown); }

/* Search modal */
.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.05rem;
  background: transparent;
  color: var(--text-primary);
}
.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}
.search-result-item:hover { background: var(--cream-dark); }
.search-result-img {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--cream-dark);
  flex-shrink: 0;
}
.search-result-info { flex: 1; min-width: 0; }
.search-result-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-tags {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.search-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* Settings modal */
.settings-body { padding-top: 0.5rem; }
.settings-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
}
.settings-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--terracotta-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
}
.settings-name { font-weight: 700; font-size: 1.05rem; }
.settings-email { font-size: 0.85rem; color: var(--text-muted); }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
}
.settings-row-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--cream-dark);
  border-radius: 26px;
  cursor: pointer;
  transition: background 0.25s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-switch input:checked + .toggle-slider { background: var(--terracotta); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }

/* AI loading */
.ai-loading-dialog {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.ai-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--cream-dark);
  border-top-color: var(--terracotta);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Bottom Navbar ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
  box-shadow: 0 -2px 8px rgba(92,61,46,0.06);
}
.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.5rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  transition: color var(--transition);
  min-height: 48px;
  justify-content: center;
}
.nav-btn i { font-size: 1.3rem; }
.nav-btn.active { color: var(--terracotta); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--warm-brown);
  color: var(--white);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
  pointer-events: none;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* ====================================
   RESPONSIVE — Tablet-first (768px+)
   ==================================== */

/* Mobile (<768px) */
@media (max-width: 767px) {
  html { font-size: 16px; }
  .page-scroll { padding: 1rem 1rem 1.5rem; }
  .suggestion-cards { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
  .suggestion-card-title { font-size: 0.7rem; padding: 0.4rem; }
  .recipe-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .welcome-text { font-size: 1.5rem; }
  .fab { width: 56px; height: 56px; font-size: 1.3rem; }
  .detail-hero-img { max-height: 260px; }
  .image-preview-grid { grid-template-columns: repeat(3, 1fr); }
  .radial-picker-container { width: 230px; height: 230px; }
  #radial-picker { width: 230px; height: 230px; }
}

/* Desktop (>1024px) */
@media (min-width: 1025px) {
  .view {
    max-width: 900px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
  .bottom-nav {
    max-width: 900px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
  .recipe-grid { grid-template-columns: repeat(3, 1fr); }
  .suggestion-cards { gap: 1rem; }
  .modal-fullscreen {
    width: 900px;
    height: 90%;
    border-radius: var(--radius-xl);
    margin: auto;
  }
}

/* ---------- Image Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.lightbox img {
  max-width: 95%;
  max-height: 90%;
  object-fit: contain;
  border-radius: var(--radius-md);
}
