/* === APP CHROME === */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 64px;
  background: rgba(10,15,13,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-brand:hover { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: 8px;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover, .nav-active {
  color: var(--fg);
  background: var(--surface);
}

.nav-divider {
  color: var(--border);
  font-size: 0.9rem;
  padding: 0 4px;
}

.nav-user {
  color: var(--fg-muted);
  font-size: 0.85rem;
  padding: 0 8px;
}

.nav-logout {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 0.85rem;
  font-family: var(--font-body);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: color 0.15s;
}
.nav-logout:hover { color: var(--fg); }

/* === BUTTONS === */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 28px;
  background: var(--accent);
  color: #0a0f0d;
  border: none;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: -0.01em;
}
.btn-primary:hover { opacity: 0.88; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-full { width: 100%; justify-content: center; }

.btn-hero { padding: 14px 36px; font-size: 1rem; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg-muted);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.btn-ghost:hover { border-color: var(--fg-muted); color: var(--fg); }

.btn-sm { padding: 6px 16px; font-size: 0.85rem; }

/* === AUTH PAGES === */
.auth-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
}

.auth-header { margin-bottom: 28px; text-align: center; }

.auth-header h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

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

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

.auth-switch {
  margin-top: 20px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--fg-muted);
}
.auth-switch a { color: var(--accent); text-decoration: none; font-weight: 500; }
.auth-switch a:hover { text-decoration: underline; }

/* === FORM ELEMENTS === */
.field-group { display: flex; flex-direction: column; gap: 6px; }

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

.field-group input,
.field-group select {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

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

.field-group input::placeholder { color: var(--fg-muted); }

.field-hint {
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin-top: 2px;
}

/* === ALERTS === */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.alert-success {
  background: var(--accent-glow);
  border: 1px solid var(--accent-dark);
  color: var(--accent);
}

/* === APP MAIN === */
.app-main {
  flex: 1;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  padding: 48px 24px 80px;
}

.page-header { margin-bottom: 40px; }

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 8px 0;
}

.page-sub {
  color: var(--fg-muted);
  font-size: 0.95rem;
  margin-top: 6px;
  line-height: 1.6;
}

/* === PREFERENCES FORM === */
.pref-form { display: flex; flex-direction: column; gap: 40px; }

.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.section-sub {
  color: var(--fg-muted);
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.checkbox-item:has(input:checked) {
  border-color: var(--accent-dark);
  background: var(--accent-glow);
}

.checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.checkbox-label {
  font-size: 0.88rem;
  font-weight: 500;
}

.form-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

/* === DASHBOARD === */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.empty-icon { font-size: 3rem; margin-bottom: 16px; }

.empty-state h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.empty-state p {
  color: var(--fg-muted);
  font-size: 0.95rem;
  max-width: 400px;
  margin: 0 auto 28px;
  line-height: 1.6;
}

.btn-generate { font-size: 1rem; padding: 14px 32px; }

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.list-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--fg-muted);
}

.list-count, .list-total { color: var(--fg); font-weight: 600; }

.list-divider { color: var(--border); }

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

.category-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}

.category-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 14px;
}

.item-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.grocery-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-alt);
  transition: background 0.1s;
}
.grocery-item:hover { background: rgba(74,222,128,0.06); }

.item-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }

.item-name {
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-qty { font-size: 0.78rem; color: var(--fg-muted); }

.item-price {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.list-footer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 28px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
  margin-bottom: 16px;
}

.total-amount {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--accent);
}

.budget-bar-wrap { display: flex; flex-direction: column; gap: 6px; }

.budget-bar {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.budget-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.5s ease;
}

.budget-label { font-size: 0.82rem; color: var(--fg-muted); }

/* === RESPONSIVE === */
@media (max-width: 640px) {
  .app-nav { padding: 0 16px; }
  .app-main { padding: 32px 16px 60px; }
  .auth-card { padding: 28px 24px; }
  .two-col { grid-template-columns: 1fr; }
  .grocery-grid { grid-template-columns: 1fr; }
  .nav-user { display: none; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .btn-ghost { text-align: center; justify-content: center; }
}
