/* ================================================================
   AUTH & DASHBOARD SPECIFIC STYLES
   ================================================================ */

/* ── AUTH LAYOUT ─────────────────────────────────────────────── */
.auth-body {
  background: var(--cream);
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  overflow: hidden;
}
.auth-layout {
  display: flex;
  width: 100%;
  max-width: 1100px;
  height: 700px;
  background: var(--white);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  overflow: hidden;
}

@media (max-width: 768px) {
  .auth-body {
    align-items: flex-start;
    padding-top: var(--sp-8);
    height: auto;
    min-height: 100vh;
  }
  .auth-layout {
    flex-direction: column;
    height: auto;
    min-height: 0;
    max-width: 100%;
    border-radius: var(--r-lg);
    margin: 0 var(--sp-2);
  }
  .auth-panel {
    padding: var(--sp-6);
  }
}

@media (max-width: 480px) {
  .auth-header h2 { font-size: var(--text-2xl); }
  .auth-panel { padding: var(--sp-5); }
}

/* Auth Form Panel */
.auth-panel {
  flex: 1;
  padding: var(--sp-8);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-y: auto;
}
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--cacao-light);
  margin-bottom: var(--sp-8);
  transition: color var(--tr);
}
.auth-back:hover { color: var(--forest); }
.auth-back svg { width: 16px; height: 16px; }

.auth-content {
  max-width: 380px;
  margin: auto;
  width: 100%;
}
.auth-header { margin-bottom: var(--sp-6); }
.auth-header h2 { font-size: var(--text-3xl); margin-bottom: var(--sp-2); }
.auth-header p { color: var(--cacao-light); font-size: var(--text-sm); }

.auth-google-btn { margin-bottom: var(--sp-4); }

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: var(--sp-5) 0;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--cream-dark);
}
.auth-divider span {
  padding: 0 var(--sp-3);
  color: var(--cacao-light);
  font-size: var(--text-xs);
  font-weight: 500;
}

.auth-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.auth-error {
  background: rgba(231,76,60,0.1);
  color: var(--danger);
  padding: var(--sp-3);
  border-radius: var(--r);
  font-size: var(--text-sm);
  text-align: center;
  border: 1px solid rgba(231,76,60,0.2);
}
.auth-submit { margin-top: var(--sp-2); }

.auth-footer {
  text-align: center;
  margin-top: var(--sp-6);
  font-size: var(--text-sm);
  color: var(--cacao-light);
}
.auth-footer a { color: var(--forest); font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

/* Auth Image Side */
.auth-image {
  flex: 1;
  background: url('https://images.unsplash.com/photo-1490645935967-10de6ba17061?q=80&w=1453&auto=format&fit=crop') center/cover no-repeat;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: var(--sp-12);
}
@media (max-width: 800px) { .auth-image { display: none; } }

.auth-image-overlay {
  position: relative;
  z-index: 2;
  color: var(--white);
  max-width: 400px;
}
.auth-image-overlay h1 { color: var(--white); font-size: var(--text-3xl); margin-bottom: var(--sp-3); text-shadow: 0 2px 10px rgba(0,0,0,0.3); }
.auth-image-overlay p { font-size: var(--text-lg); opacity: 0.9; text-shadow: 0 2px 10px rgba(0,0,0,0.3); }
.auth-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(44,94,59,0.9) 0%, rgba(44,94,59,0.2) 60%, transparent 100%);
}

/* ── SETUP WIZARD ────────────────────────────────────────────── */
.setup-body { background: var(--cream); min-height: 100vh; padding: var(--sp-8) var(--sp-4); display: flex; flex-direction: column; align-items: center; }
.setup-container {
  background: var(--white);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-md);
  max-width: 600px;
  width: 100%;
  padding: var(--sp-8);
  border: 1px solid var(--cream-dark);
}
.setup-header { text-align: center; margin-bottom: var(--sp-8); }
.setup-header h2 { font-size: var(--text-3xl); margin-bottom: var(--sp-2); }
.setup-header p { color: var(--cacao-light); }

.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
  margin-bottom: var(--sp-6);
}
@media (max-width: 500px) { .setup-grid { grid-template-columns: 1fr; } }

.setup-actions {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--cream-dark);
  padding-top: var(--sp-6);
}

.setup-step[hidden] { display: none !important; }

.setup-notif-card {
  text-align: center;
  padding: var(--sp-2) 0 var(--sp-4);
}

.setup-notif-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--sp-5);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(44, 94, 59, 0.12), rgba(126, 159, 61, 0.18));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--forest);
}

.setup-notif-icon svg {
  width: 36px;
  height: 36px;
}

.setup-notif-card h2 {
  font-size: var(--text-2xl);
  margin-bottom: var(--sp-3);
  line-height: 1.25;
}

.setup-notif-card > p {
  color: var(--cacao-light);
  line-height: 1.65;
  margin-bottom: var(--sp-5);
  text-align: left;
}

.setup-notif-perks {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--sp-6);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.setup-notif-perks li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  font-size: var(--text-sm);
  color: var(--cacao);
  font-weight: 500;
}

.setup-notif-perks li::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--matcha);
  margin-top: 7px;
  flex-shrink: 0;
}

.setup-notif-yes {
  width: 100%;
  justify-content: center;
  margin-bottom: var(--sp-3);
}

.setup-notif-skip {
  background: none;
  border: none;
  color: var(--cacao-light);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: var(--sp-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.setup-notif-skip:hover {
  color: var(--cacao);
}

/* ── DASHBOARD LAYOUT ────────────────────────────────────────── */
.dash-layout {
  background: var(--cream);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.dash-layout > main { flex: 1; }
.dash-header {
  background: var(--white);
  border-bottom: 1px solid var(--cream-dark);
  position: sticky;
  top: 0;
  z-index: 100;
}
.dash-header__inner {
  display: flex;
  align-items: center;
  height: 68px;
  padding: 0 var(--sp-6);
  max-width: 1280px;
  margin: 0 auto;
}

/* Push the navigation + user group to the right on desktop */
.dash-nav {
  margin-left: auto;
}
.dash-nav { display: flex; gap: var(--sp-6); align-items: center; }
.dash-nav a { font-weight: 500; color: var(--cacao-light); transition: color var(--tr); }
.dash-nav a:hover, .dash-nav a.active { color: var(--forest); }
.dash-user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-left: var(--sp-6);
  border-left: 1px solid var(--cream-dark);
}
.dash-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--matcha);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-sm);
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.dash-avatar.has-image {
  background-image: var(--avatar-image);
  color: transparent;
  font-size: 0;
}

.dash-main { max-width: 1280px; margin: 0 auto; padding: var(--sp-8) var(--sp-6); }
.dash-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--sp-6);
  align-items: start;
}
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

@media (max-width: 480px) {
  .dash-main { padding: var(--sp-6) var(--sp-4); }
  .progress-grid { grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
  .dash-card { padding: var(--sp-4); margin-bottom: var(--sp-4); }
  .dash-header__inner { padding: 0 var(--sp-4); }
  .dash-nav { gap: var(--sp-3); font-size: var(--text-xs); }
}

/* ── DASHBOARD MOBILE MENU ────────────────────────────────────── */
.dash-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--cacao);
  padding: var(--sp-2);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.dash-menu-btn svg,
.dash-menu-btn i {
  width: 24px;
  height: 24px;
}

@media (max-width: 640px) {
  .dash-header__inner {
    position: relative;
  }

  /* On mobile: logo | user | hamburger   -- the 3 links are in dropdown */
  .dash-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--cream-dark);
    padding: var(--sp-4) var(--sp-6);
    gap: var(--sp-2);
    box-shadow: var(--sh-sm);
    z-index: 100;
  }

  .dash-nav.open {
    display: flex;
    animation: slideDown 0.2s ease;
  }

  .dash-nav a {
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--cream-dark);
    font-size: var(--text-sm);
    color: var(--cacao);
  }

  .dash-nav a:last-of-type {
    border-bottom: none;
  }

  /* Keep user info always visible on the right in header on mobile */
  .dash-user {
    margin-left: auto;
    padding-left: var(--sp-3);
    border-left: 1px solid var(--cream-dark);
    gap: var(--sp-2);
  }

  .dash-menu-btn {
    display: flex;
    margin-left: var(--sp-2);
  }

  /* Backdrop for nicer mobile menu experience (matching main nav) */
  body.dash-nav-open::before {
    content: '';
    position: fixed;
    inset: 0;
    top: var(--header-h, 68px);
    background: rgba(0, 0, 0, 0.25);
    z-index: 90;
    animation: fadeIn 0.15s ease;
  }

  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}

/* Dashboard Cards */
.dash-card {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  border: 1px solid var(--cream-dark);
  box-shadow: var(--sh-sm);
  margin-bottom: var(--sp-6);
}
.dash-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--cream-dark);
}
.dash-card__title { font-family: var(--font-heading); font-size: var(--text-lg); display: flex; align-items: center; gap: var(--sp-2); }
.dash-card__title svg { width: 18px; height: 18px; color: var(--forest); }

/* Progress Rings */
.progress-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.progress-item { display: flex; flex-direction: column; align-items: center; text-align: center; }
.progress-ring { position: relative; width: 80px; height: 80px; margin-bottom: var(--sp-2); }
.progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-ring circle { fill: none; stroke-width: 6; }
.progress-ring .bg { stroke: var(--cream-dark); }
.progress-ring .fill { stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.progress-ring--cal .fill { stroke: var(--forest); }
.progress-ring--pro .fill { stroke: #3498db; }
.progress-ring--crb .fill { stroke: var(--honey); }
.progress-ring--fat .fill { stroke: #e67e22; }
.progress-value { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; font-weight: 700; font-size: var(--text-sm); }
.progress-label { font-size: var(--text-xs); color: var(--cacao-light); font-weight: 600; }
.progress-sub { font-size: 10px; color: var(--cacao-light); margin-top: -2px; }

/* Meal History List */
.history-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-4);
  background: var(--cream);
  border-radius: var(--r);
  border: 1px solid var(--cream-dark);
  transition: transform var(--tr-fast);
}
.history-item:hover { transform: translateX(4px); border-color: var(--cream-darker); }
.history-item__main { display: flex; flex-direction: column; gap: 2px; }
.history-item__name { font-weight: 600; color: var(--cacao); }
.history-item__date { font-size: var(--text-xs); color: var(--cacao-light); }
.history-item__stats { display: flex; align-items: center; gap: var(--sp-4); }
.history-item__cal { font-weight: 700; color: var(--forest); font-family: var(--font-heading); font-size: var(--text-lg); }

/* Empty States */
.dash-empty {
  text-align: center;
  padding: var(--sp-8);
  color: var(--cacao-light);
}
.dash-empty i { font-size: 2rem; margin-bottom: var(--sp-3); display: block; opacity: 0.5; }

/* Recommendations */
.rec-card {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r);
  margin-bottom: var(--sp-3);
  background: var(--cream);
  border-left: 4px solid var(--honey);
}
.rec-card--alert { border-left-color: var(--danger); background: rgba(231,76,60,0.05); }
.rec-card--good { border-left-color: var(--forest); background: rgba(44,94,59,0.05); }
.rec-icon { font-size: 1.25rem; margin-top: 2px; }
.rec-text { font-size: var(--text-sm); line-height: 1.5; color: var(--cacao); }

/* ── Tablet & phone polish ───────────────────────────────────── */
@media (max-width: 768px) {
  .setup-body { padding: var(--sp-5) var(--sp-3); }
  .setup-container { padding: var(--sp-6); }
  .auth-content { max-width: 100%; }
  .history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-2);
  }
  .history-item__stats { width: 100%; justify-content: space-between; }
}

@media (max-width: 480px) {
  .setup-container { padding: var(--sp-5); border-radius: var(--r-lg); }
  .setup-header h2 { font-size: var(--text-2xl); }
}
