/* === AUTH GATE === */
.auth-gate {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #f8fdf9 0%, #e8f5e9 50%, #fff8e1 100%);
}

.auth-container {
  width: 100%; max-width: 380px;
  text-align: center;
}

.auth-logo {
  font-family: 'Playfair Display', serif;
  font-size: 2.8rem;
  color: #2E7D32;
  margin-bottom: 4px;
  animation: fadeDown 0.6s ease;
}

.auth-subtitle {
  color: #6B6B6B;
  margin-bottom: 32px;
  font-size: 1rem;
  animation: fadeDown 0.6s ease 0.1s both;
}

.auth-gate .auth-form { margin-bottom: 12px; animation: fadeDown 0.6s ease 0.2s both; }
.auth-gate .btn-google { margin-bottom: 16px; animation: fadeDown 0.6s ease 0.3s both; }
.auth-gate .auth-switch { font-size: 0.9rem; color: #6B6B6B; animation: fadeDown 0.6s ease 0.4s both; }
.auth-gate .auth-switch a { color: #2E7D32; font-weight: 600; text-decoration: none; }

.auth-lang { display: flex; gap: 4px; justify-content: center; margin-bottom: 16px; animation: fadeDown 0.6s ease 0.15s both; }

.text-muted { color: var(--text-light); font-style: italic; font-size: 0.9rem; }

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

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #FAFAFA;
  --bg-card: #FFFFFF;
  --text: #1A1A1A;
  --text-light: #777;
  --accent: #2E7D32;
  --accent-light: #E8F5E9;
  --accent-dark: #1B5E20;
  --orange: #FF6D00;
  --border: #EEEEEE;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --nav-height: 68px;
  --header-height: 56px;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-heading: 'Playfair Display', serif;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --bg-card: #1E1E1E;
    --text: #F5F5F5;
    --text-light: #AAA;
    --border: #2A2A2A;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
    --accent-light: #1B3D25;
  }
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  padding-top: var(--header-height);
  padding-bottom: var(--nav-height);
  -webkit-tap-highlight-color: transparent;
}

/* === HEADER === */
.header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: rgba(250,250,250,0.75);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-bottom: 1px solid rgba(0,0,0,0.04);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

@media (prefers-color-scheme: dark) {
  .header { background: rgba(18,18,18,0.75); border-bottom-color: rgba(255,255,255,0.06); }
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #2E7D32, #66BB6A);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.lang-toggle {
  display: flex;
  background: var(--border);
  border-radius: 20px;
  padding: 3px;
  border: none;
  cursor: pointer;
}

.lang-option {
  padding: 5px 12px;
  border-radius: 17px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-light);
  transition: all var(--transition);
}

.lang-option.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(46,125,50,0.3);
}

.user-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-light); padding: 4px;
  transition: color var(--transition);
}
.user-btn:hover { color: var(--accent); }

/* === MAIN === */
.main { padding: 20px; max-width: 1200px; margin: 0 auto; }
.section { animation: fadeIn 0.4s ease; }
.section-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  margin-bottom: 8px;
}
.section-desc { color: var(--text-light); margin-bottom: 20px; font-size: 0.9rem; }

.hidden { display: none !important; }

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

/* === RECIPE GRID === */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (min-width: 600px) { .recipe-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; } }
@media (min-width: 1024px) { .recipe-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; } }

.recipe-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  animation: cardIn 0.5s ease both;
  border: 1px solid rgba(0,0,0,0.03);
}

.recipe-card:nth-child(1) { animation-delay: 0s; }
.recipe-card:nth-child(2) { animation-delay: 0.05s; }
.recipe-card:nth-child(3) { animation-delay: 0.1s; }
.recipe-card:nth-child(4) { animation-delay: 0.15s; }
.recipe-card:nth-child(5) { animation-delay: 0.2s; }
.recipe-card:nth-child(6) { animation-delay: 0.25s; }
.recipe-card:nth-child(7) { animation-delay: 0.3s; }
.recipe-card:nth-child(8) { animation-delay: 0.35s; }
.recipe-card:nth-child(n+9) { animation-delay: 0.4s; }

@keyframes cardIn {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.recipe-card:hover { transform: translateY(-8px) scale(1.02); box-shadow: 0 16px 40px rgba(0,0,0,0.12); }
.recipe-card:active { transform: scale(0.96); }

.recipe-card-img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  background: var(--border);
  transition: transform 0.6s ease;
}

.recipe-card:hover .recipe-card-img { transform: scale(1.05); }

.recipe-card-img-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
}

.recipe-card-time {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0,0,0,0.65);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.recipe-card-name {
  padding: 12px 14px;
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--text);
}

/* === RECIPE MODAL === */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.2s;
}

@media (min-width: 768px) { .modal { align-items: center; } }

.modal-content {
  background: var(--bg);
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  border-radius: 24px 24px 0 0;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 768px) {
  .modal-content { border-radius: var(--radius); max-height: 85vh; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-close {
  position: sticky; top: 0; float: right;
  background: var(--bg-card); border: none;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 1.4rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
  z-index: 10;
  transition: transform var(--transition);
}
.modal-close:hover { transform: rotate(90deg); }

.recipe-detail-img {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 16px;
  aspect-ratio: 16/10;
  object-fit: cover;
}

.recipe-detail-name {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.recipe-detail-time {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.recipe-detail-section { margin-bottom: 24px; }
.recipe-detail-section h3 {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent-light);
}

.recipe-detail-section ul { list-style: none; padding: 0; }
.recipe-detail-section ul li {
  padding: 10px 0 10px 28px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  position: relative;
}
.recipe-detail-section ul li::before {
  content: '•';
  position: absolute;
  left: 8px;
  color: var(--accent);
  font-weight: 700;
}

.recipe-detail-section ol { padding-left: 0; list-style: none; counter-reset: step; }
.recipe-detail-section ol li {
  padding: 12px 0 12px 40px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.5;
  position: relative;
  counter-increment: step;
}
.recipe-detail-section ol li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 12px;
  width: 26px;
  height: 26px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === FRIDGE === */
.fridge-input-wrap { margin-bottom: 20px; }
.fridge-input {
  width: 100%;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  resize: vertical;
  background: var(--bg-card);
  color: var(--text);
  margin-bottom: 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.fridge-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(46,125,50,0.1);
}

.fridge-results .match-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  display: flex; gap: 12px; align-items: center;
  transition: transform var(--transition), box-shadow var(--transition);
  animation: fadeIn 0.3s ease both;
  cursor: pointer;
}

.match-card:hover { transform: translateX(4px); box-shadow: var(--shadow); }

.match-card-img { width: 56px; height: 56px; border-radius: var(--radius-sm); object-fit: cover; }
.match-card-info { flex: 1; }
.match-card-name { font-weight: 600; font-size: 0.9rem; }
.match-card-missing { font-size: 0.8rem; color: var(--orange); margin-top: 3px; }
.match-card-badge {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

/* === MEAL PLAN === */
.wizard-step { display: none; }
.wizard-step.active { display: block; animation: fadeIn 0.4s ease; }

.wizard-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.wizard-step-num {
  width: 32px; height: 32px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
  margin-bottom: 12px;
}

.wizard-hint { color: var(--text-light); font-size: 0.85rem; margin-bottom: 12px; }

.meal-plan-result { }

.plan-hint { color: var(--text-light); font-size: 0.85rem; margin-bottom: 12px; text-align: center; }

.plan-days {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.day-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--transition);
  overflow: hidden;
}
.day-card:hover { transform: translateY(-4px); }

.day-card-header {
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 8px;
}

.day-card-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: 8px; }
.day-card-name { font-weight: 600; font-size: 0.8rem; }

.match-card-img { width: 56px; height: 56px; border-radius: var(--radius-sm); object-fit: cover; }

.shopping-list { margin-top: 20px; }
.shopping-list h3 { margin-bottom: 12px; font-size: 1rem; }

.plan-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.btn-sm { padding: 8px 14px; font-size: 0.8rem; min-height: 36px; width: auto; }

.history-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--transition);
}
.history-card:hover { transform: translateX(4px); }
.history-date { font-weight: 700; font-size: 0.8rem; color: var(--accent); margin-bottom: 4px; }
.history-meals { font-size: 0.85rem; color: var(--text-light); }
.shopping-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  transition: opacity var(--transition);
}

.shopping-item input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.shopping-item.checked { opacity: 0.4; }
.shopping-item.checked span { text-decoration: line-through; }

/* === AUTH === */
.auth-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.input {
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(46,125,50,0.1); }

.profile-card {
  text-align: center;
  padding: 32px 24px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.profile-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.5rem; font-weight: 700;
}

/* === BUTTONS === */
.btn {
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  width: 100%;
  box-shadow: 0 4px 12px rgba(46,125,50,0.25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(46,125,50,0.35); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  width: 100%;
}
.btn-secondary:hover { background: var(--accent-light); }

.btn-google {
  background: var(--bg-card);
  color: var(--text);
  border: 2px solid var(--border);
  width: 100%;
}
.btn-google:hover { border-color: var(--text-light); }

/* === BOTTOM NAV === */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: rgba(250,250,250,0.85);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-top: 1px solid rgba(0,0,0,0.04);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}

@media (prefers-color-scheme: dark) {
  .bottom-nav { background: rgba(18,18,18,0.85); border-top-color: rgba(255,255,255,0.06); }
}

.nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  background: none; border: none;
  color: var(--text-light);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: color var(--transition), transform var(--transition);
  padding: 8px 4px;
  position: relative;
}

.nav-item.active { color: var(--accent); }
.nav-item.active svg { stroke: var(--accent); }
.nav-item:active { transform: scale(0.9); }

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
}

/* === FAB === */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  right: 16px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), #FF8F00);
  color: white;
  border: none;
  box-shadow: 0 4px 16px rgba(255,109,0,0.35);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 90;
  transition: transform var(--transition), box-shadow var(--transition);
}

.fab:hover { transform: scale(1.1) rotate(90deg); box-shadow: 0 6px 24px rgba(255,109,0,0.45); }
.fab:active { transform: scale(0.9); }

/* === UPLOAD === */
.upload-form { display: flex; flex-direction: column; gap: 12px; }
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  color: var(--text-light);
  transition: all var(--transition);
  position: relative;
}

.upload-area:hover { border-color: var(--accent); background: var(--accent-light); }
.upload-area.has-file { border-color: var(--accent); border-style: solid; padding: 8px; }
.upload-preview { width: 100%; border-radius: var(--radius-sm); }

/* === LOADING === */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(250,250,250,0.92);
  backdrop-filter: blur(8px);
  z-index: 300;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* === TOAST === */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 20px);
  left: 50%; transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 400;
  animation: toastIn 0.3s ease;
  box-shadow: var(--shadow-lg);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* === CHECKBOX === */
.checkbox-label {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0;
  font-size: 0.95rem;
  cursor: pointer;
}

.checkbox-label input { width: 20px; height: 20px; accent-color: var(--accent); }

.pref-group { margin-bottom: 16px; }
.pref-label { font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; display: block; }
.pref-persons { display: flex; gap: 8px; margin-top: 8px; }
.person-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-card);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
}
.person-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* === GRILL === */
.grill-basics { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip-label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}
.chip-label:has(input:checked) { border-color: var(--accent); background: var(--accent-light); }
.chip-label input { display: none; }

.grill-dishes { display: flex; flex-direction: column; gap: 10px; }
.grill-dish {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex; gap: 12px; align-items: flex-start;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.grill-dish:hover { transform: translateX(4px); box-shadow: var(--shadow); }
.grill-dish-icon { font-size: 1.5rem; }
.grill-dish-info { flex: 1; }
.grill-dish-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; }
.grill-dish-desc { font-size: 0.8rem; color: var(--text-light); line-height: 1.4; }
.grill-dish-arrow { color: var(--text-light); font-size: 1.5rem; align-self: center; }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
