/* ─── App & Auth styles — extends theme.css ─── */

/* ── Auth page ── */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.auth-wrap {
  width: 100%;
  max-width: 420px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.auth-logo {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--fg);
  text-decoration: none;
  margin-bottom: 8px;
}

.auth-card {
  width: 100%;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-warm);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 28px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--cream);
  color: var(--fg);
  box-shadow: 0 1px 4px rgba(44,37,32,0.08);
}

.auth-form { display: none; flex-direction: column; gap: 18px; }
.auth-form.active { display: flex; }

.form-error {
  color: #c0392b;
  font-size: 0.875rem;
  font-weight: 500;
  background: rgba(192,57,43,0.08);
  border-radius: 8px;
  padding: 10px 14px;
  display: none;
}
.form-error:not(:empty) { display: block; }

.auth-back { font-size: 0.85rem; color: var(--fg-muted); }
.auth-back a { color: var(--fg-muted); text-decoration: none; }
.auth-back a:hover { color: var(--accent); }

/* ── Shared form fields ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: 0.01em;
}

.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=number] {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--fg);
  background: var(--bg);
  transition: border-color 0.2s;
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
}

.field-hint {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* ── Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary:hover { background: #b04f33; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-full { width: 100%; justify-content: center; }

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  background: transparent;
  color: var(--fg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-outline:hover { border-color: var(--fg); background: var(--bg-warm); }

.btn-ghost {
  padding: 8px 14px;
  background: transparent;
  border: none;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--fg-muted);
  cursor: pointer;
  transition: color 0.2s;
}
.btn-ghost:hover { color: var(--fg); }

/* ── App shell ── */
.app-body {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--cream);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-nav-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--fg);
  text-decoration: none;
}

.app-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-nav-user {
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.app-shell {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ── Sidebar ── */
.app-sidebar {
  width: 200px;
  flex-shrink: 0;
  padding: 24px 12px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.sidebar-btn:hover { background: var(--bg-warm); color: var(--fg); }
.sidebar-btn.active { background: var(--accent-glow); color: var(--accent); font-weight: 600; }

.sidebar-icon { font-size: 1.1rem; }

/* ── Main content ── */
.app-main {
  flex: 1;
  overflow-y: auto;
  padding: 36px 40px;
}

.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 20px;
  flex-wrap: wrap;
}

.view-title {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--fg);
  margin-bottom: 4px;
}

.view-subtitle {
  font-size: 0.95rem;
  color: var(--fg-muted);
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--fg-muted);
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 20px;
}

.empty-state h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--fg);
  margin-bottom: 10px;
}

.empty-state p {
  max-width: 360px;
  margin: 0 auto 24px;
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ── Plan meta ── */
.plan-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg-muted);
}

.meta-chip.green { background: rgba(139,158,126,0.12); border-color: var(--sage-light); color: #5a7050; }
.meta-chip.accent { background: var(--accent-glow); border-color: var(--accent-light); color: var(--accent); }

/* ── Days grid ── */
.days-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.day-card {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.day-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(44,37,32,0.07);
}

.day-card-header {
  padding: 16px 20px 12px;
  background: var(--bg-warm);
  border-bottom: 1px solid var(--border);
}

.day-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--fg);
}

.day-meals {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.meal-item {}

.meal-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 3px;
}

.meal-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--fg);
  margin-bottom: 2px;
}

.meal-desc {
  font-size: 0.82rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

.meal-cost {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  margin-top: 4px;
}

/* ── Grocery ── */
.cost-banner {
  background: linear-gradient(135deg, var(--fg) 0%, #3d3028 100%);
  color: var(--bg);
  border-radius: 14px;
  padding: 20px 28px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.cost-banner-label {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 4px;
}

.cost-banner-amount {
  font-family: var(--font-display);
  font-size: 2rem;
}

.cost-banner-note {
  font-size: 0.875rem;
  opacity: 0.7;
  max-width: 400px;
}

.grocery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.grocery-category {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.grocery-cat-header {
  padding: 14px 20px;
  background: var(--bg-warm);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.grocery-items {
  padding: 8px 0;
}

.grocery-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 9px 20px;
  gap: 12px;
  border-bottom: 1px solid rgba(229,221,212,0.5);
}

.grocery-item:last-child { border-bottom: none; }

.grocery-item-name {
  font-size: 0.9rem;
  color: var(--fg);
  flex: 1;
}

.grocery-item-amount {
  font-size: 0.8rem;
  color: var(--fg-muted);
  flex-shrink: 0;
}

.grocery-item-cost {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  min-width: 40px;
  text-align: right;
}

/* ── Settings ── */
.settings-form {
  max-width: 620px;
}

.settings-section {
  margin-bottom: 40px;
}

.settings-section h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  background: var(--cream);
}

.check-item:hover { border-color: var(--accent-light); }
.check-item input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.check-item:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

.settings-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.form-success {
  font-size: 0.875rem;
  color: #2d6a4f;
  font-weight: 600;
  background: rgba(45,106,79,0.1);
  border-radius: 8px;
  padding: 10px 14px;
  display: none;
}
.form-success:not(:empty) { display: block; }

/* ── Generating spinner ── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

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

/* ── Hero CTA (landing page additions) ── */
.hero-cta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.hero-cta .btn-primary {
  padding: 16px 32px;
  font-size: 1.05rem;
  border-radius: 12px;
}

.hero-cta .btn-outline {
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: 12px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .app-sidebar { display: none; }
  .app-main { padding: 20px; }
  .view-header { flex-direction: column; align-items: stretch; }
  .days-grid { grid-template-columns: 1fr; }
  .grocery-grid { grid-template-columns: 1fr; }
  .cost-banner { flex-direction: column; }
  .app-nav { padding: 14px 20px; }
}

@media print {
  .app-nav, .app-sidebar { display: none; }
  .cost-banner { background: #eee !important; color: #000 !important; }
  #printBtn { display: none; }
}
