/* ─── Brand Variables ──────────────────────────────────────────────────────── */
:root {
  --rose:        #C4918A;
  --rose-dark:   #A67066;
  --rose-pale:   #EDD5D0;
  --rose-light:  #F7EBE8;
  --sage:        #7B8E6E;
  --sage-dark:   #5C6B52;
  --sage-light:  #EAF0E6;
  --charcoal:    #2D2926;
  --warm-grey:   #F5F0EE;
  --mid-grey:    #9E9188;
  --light-grey:  #E8E0DC;
  --white:       #FFFFFF;

  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body:    'Inter', 'Helvetica Neue', Arial, sans-serif;

  --shadow-sm:   0 1px 3px rgba(45,41,38,0.08);
  --shadow-md:   0 4px 16px rgba(45,41,38,0.10);
  --shadow-lg:   0 8px 32px rgba(45,41,38,0.14);
  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   20px;
}

/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--warm-grey);
  color: var(--charcoal);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Typography ───────────────────────────────────────────────────────────── */
h1, h2, h3, h4 { font-family: var(--font-heading); line-height: 1.25; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.875rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; font-family: var(--font-body); font-weight: 600; }
p  { color: var(--mid-grey); line-height: 1.7; }

a { color: var(--rose); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--rose-dark); }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 12px 28px; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.9375rem; font-weight: 600;
  border: none; cursor: pointer; transition: all 0.2s; text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--rose); color: var(--white);
  box-shadow: 0 2px 8px rgba(196,145,138,0.35);
}
.btn-primary:hover { background: var(--rose-dark); color: var(--white); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(196,145,138,0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--white); color: var(--charcoal);
  border: 1.5px solid var(--light-grey);
}
.btn-secondary:hover { border-color: var(--rose); color: var(--rose); background: var(--rose-light); }
.btn-sage { background: var(--sage); color: var(--white); }
.btn-sage:hover { background: var(--sage-dark); color: var(--white); }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* ─── Form Elements ────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 0.875rem; font-weight: 600; color: var(--charcoal);
  letter-spacing: 0.01em;
}
.form-input {
  padding: 12px 16px; border: 1.5px solid var(--light-grey);
  border-radius: var(--radius-sm); font-family: var(--font-body);
  font-size: 0.9375rem; color: var(--charcoal); background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s; outline: none;
  width: 100%;
}
.form-input:focus { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(196,145,138,0.15); }
.form-input::placeholder { color: var(--mid-grey); }
.form-input.error { border-color: #e05c5c; }
.form-hint { font-size: 0.8125rem; color: var(--mid-grey); }
.form-error { font-size: 0.8125rem; color: #c94040; font-weight: 500; }

/* ─── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-body { padding: 24px; }
.card-header { padding: 20px 24px; border-bottom: 1px solid var(--light-grey); }

/* ─── Auth Pages (Login / Signup) ──────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex;
  background: linear-gradient(135deg, var(--rose-light) 0%, var(--warm-grey) 50%, var(--sage-light) 100%);
}
.auth-left {
  flex: 1; display: none; flex-direction: column; justify-content: center;
  align-items: center; padding: 60px;
  background: linear-gradient(160deg, var(--charcoal) 0%, #4a3f3a 100%);
  color: var(--white); position: relative; overflow: hidden;
}
.auth-left::before {
  content: ''; position: absolute; top: -100px; right: -100px;
  width: 400px; height: 400px; border-radius: 50%;
  background: rgba(196,145,138,0.15); pointer-events: none;
}
.auth-left::after {
  content: ''; position: absolute; bottom: -80px; left: -80px;
  width: 300px; height: 300px; border-radius: 50%;
  background: rgba(123,142,110,0.15); pointer-events: none;
}
@media (min-width: 900px) { .auth-left { display: flex; } }
.auth-left-content { position: relative; z-index: 1; max-width: 380px; }
.auth-left h2 { color: var(--white); margin-bottom: 16px; font-size: 2rem; }
.auth-left p { color: rgba(255,255,255,0.7); font-size: 1rem; margin-bottom: 40px; }
.auth-features { list-style: none; display: flex; flex-direction: column; gap: 16px; }
.auth-features li {
  display: flex; align-items: center; gap: 12px;
  color: rgba(255,255,255,0.85); font-size: 0.9375rem;
}
.auth-features li::before {
  content: '✦'; color: var(--rose); font-size: 0.75rem; flex-shrink: 0;
}

.auth-right {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; align-items: center; padding: 40px 24px;
  max-width: 100%;
}
@media (min-width: 900px) { .auth-right { max-width: 520px; } }

.auth-box { width: 100%; max-width: 420px; }
.auth-logo {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 40px; text-align: center;
}
.auth-logo-mark {
  width: 56px; height: 56px; background: var(--rose);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px; font-size: 1.5rem;
}
.auth-logo-brand {
  font-family: var(--font-heading); font-size: 1.125rem;
  color: var(--charcoal); font-weight: 700; letter-spacing: 0.02em;
}
.auth-logo-sub { font-size: 0.8125rem; color: var(--mid-grey); letter-spacing: 0.04em; text-transform: uppercase; margin-top: 2px; }

.auth-card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 40px 36px;
}
.auth-card h1 { margin-bottom: 6px; font-size: 1.75rem; }
.auth-card > p { margin-bottom: 28px; font-size: 0.9375rem; }

.auth-form { display: flex; flex-direction: column; gap: 20px; }
.auth-divider {
  display: flex; align-items: center; gap: 12px; margin: 4px 0;
  color: var(--mid-grey); font-size: 0.8125rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--light-grey);
}
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.875rem; color: var(--mid-grey); }

/* Alert / notification */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500; display: none;
}
.alert.show { display: block; }
.alert-error { background: #fef2f2; color: #c94040; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ─── App Layout (authenticated pages) ────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 260px; background: var(--charcoal); color: var(--white);
  display: flex; flex-direction: column; position: fixed;
  top: 0; left: 0; height: 100vh; z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-logo {
  padding: 28px 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo-text {
  font-family: var(--font-heading); font-size: 1rem; color: var(--white);
  line-height: 1.3;
}
.sidebar-logo-sub { font-size: 0.7rem; color: var(--rose); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 20px 0; overflow-y: auto; }
.sidebar-section-label {
  padding: 12px 24px 6px; font-size: 0.6875rem; font-weight: 700;
  color: rgba(255,255,255,0.3); text-transform: uppercase; letter-spacing: 0.1em;
}
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 24px; color: rgba(255,255,255,0.65); font-size: 0.9rem;
  text-decoration: none; transition: all 0.15s; border-left: 3px solid transparent;
}
.sidebar-link:hover { color: var(--white); background: rgba(255,255,255,0.05); }
.sidebar-link.active {
  color: var(--white); background: rgba(196,145,138,0.15);
  border-left-color: var(--rose);
}
.sidebar-link .icon { width: 18px; text-align: center; font-size: 1rem; flex-shrink: 0; }

.sidebar-footer {
  padding: 20px 24px; border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.sidebar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--rose); display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 0.875rem; color: var(--white);
  flex-shrink: 0; overflow: hidden;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-name { font-size: 0.875rem; font-weight: 600; color: var(--white); }
.sidebar-user-email { font-size: 0.75rem; color: var(--mid-grey); }
.sidebar-signout {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,0.45); font-size: 0.8125rem; cursor: pointer;
  background: none; border: none; padding: 0; transition: color 0.2s;
}
.sidebar-signout:hover { color: var(--rose); }

/* Main content area */
.main {
  flex: 1; margin-left: 260px; display: flex; flex-direction: column; min-height: 100vh;
}
.topbar {
  background: var(--white); border-bottom: 1px solid var(--light-grey);
  padding: 16px 32px; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 1.125rem; font-weight: 700; color: var(--charcoal); }
.topbar-week {
  display: flex; align-items: center; gap: 8px;
  background: var(--rose-light); color: var(--rose-dark);
  padding: 6px 14px; border-radius: 20px; font-size: 0.8125rem; font-weight: 600;
}
.page-content { padding: 32px; flex: 1; max-width: 1100px; width: 100%; }

/* ─── Dashboard ────────────────────────────────────────────────────────────── */
.welcome-banner {
  background: linear-gradient(135deg, var(--charcoal) 0%, #4a3f3a 100%);
  border-radius: var(--radius-lg); padding: 32px 36px; color: var(--white);
  margin-bottom: 28px; position: relative; overflow: hidden;
}
.welcome-banner::before {
  content: ''; position: absolute; top: -60px; right: -60px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(196,145,138,0.2); pointer-events: none;
}
.welcome-banner::after {
  content: ''; position: absolute; bottom: -40px; right: 100px;
  width: 150px; height: 150px; border-radius: 50%;
  background: rgba(123,142,110,0.15); pointer-events: none;
}
.welcome-banner h1 { color: var(--white); margin-bottom: 6px; font-size: 1.75rem; }
.welcome-banner p { color: rgba(255,255,255,0.7); margin-bottom: 20px; }
.welcome-meta {
  display: flex; gap: 20px; flex-wrap: wrap; position: relative; z-index: 1;
}
.welcome-badge {
  background: rgba(255,255,255,0.12); border-radius: 8px;
  padding: 8px 16px; display: flex; flex-direction: column; gap: 2px;
}
.welcome-badge-label { font-size: 0.6875rem; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.08em; }
.welcome-badge-value { font-size: 0.9375rem; font-weight: 700; color: var(--white); }

/* Progress bar */
.progress-bar-wrap {
  background: var(--white); border-radius: var(--radius); padding: 20px 24px;
  box-shadow: var(--shadow-sm); margin-bottom: 28px;
}
.progress-bar-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
}
.progress-bar-title { font-weight: 700; font-size: 0.9375rem; }
.progress-bar-count { font-size: 0.875rem; color: var(--mid-grey); }
.progress-bar-track {
  height: 10px; background: var(--light-grey); border-radius: 10px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--rose), var(--rose-dark));
  border-radius: 10px; transition: width 0.8s cubic-bezier(.4,0,.2,1);
}

/* Feature cards grid */
.cards-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.feature-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 24px; cursor: pointer;
  transition: all 0.2s; text-decoration: none; display: flex;
  flex-direction: column; gap: 12px; border: 2px solid transparent;
}
.feature-card:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-md);
  border-color: var(--rose-pale);
}
.feature-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 1.375rem;
}
.feature-icon.rose   { background: var(--rose-light); }
.feature-icon.sage   { background: var(--sage-light); }
.feature-icon.warm   { background: var(--warm-grey); border: 1px solid var(--light-grey); }
.feature-card h4 { color: var(--charcoal); font-size: 0.9375rem; }
.feature-card p { font-size: 0.8125rem; color: var(--mid-grey); }
.feature-card .arrow { margin-top: auto; color: var(--rose); font-size: 0.875rem; font-weight: 600; }

/* Intake form banner */
.intake-banner {
  background: linear-gradient(135deg, var(--sage-light), var(--warm-grey));
  border: 1.5px solid var(--sage); border-radius: var(--radius);
  padding: 20px 24px; display: flex; align-items: center;
  gap: 16px; margin-bottom: 28px;
}
.intake-banner-icon { font-size: 1.5rem; flex-shrink: 0; }
.intake-banner-text h4 { color: var(--charcoal); margin-bottom: 3px; }
.intake-banner-text p { font-size: 0.875rem; }
.intake-banner .btn { flex-shrink: 0; margin-left: auto; }

/* Week cards */
.weeks-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.week-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px; display: flex;
  flex-direction: column; gap: 8px; transition: all 0.2s;
  border: 2px solid transparent; text-decoration: none;
}
.week-card:not(.locked):hover {
  transform: translateY(-2px); box-shadow: var(--shadow-md);
  border-color: var(--rose-pale);
}
.week-card.locked { opacity: 0.5; cursor: not-allowed; }
.week-card.current { border-color: var(--rose); }
.week-number { font-size: 0.75rem; font-weight: 700; color: var(--rose); text-transform: uppercase; letter-spacing: 0.08em; }
.week-title-text { font-weight: 700; font-size: 0.9375rem; color: var(--charcoal); line-height: 1.3; }
.week-theme { font-size: 0.8rem; color: var(--mid-grey); font-style: italic; }
.week-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.75rem; font-weight: 600; padding: 3px 10px;
  border-radius: 20px; margin-top: 4px; width: fit-content;
}
.week-status.current-status { background: var(--rose-light); color: var(--rose-dark); }
.week-status.completed-status { background: var(--sage-light); color: var(--sage-dark); }
.week-status.locked-status { background: var(--warm-grey); color: var(--mid-grey); }

/* ─── Loader ────────────────────────────────────────────────────────────────── */
.loader {
  position: fixed; inset: 0; background: var(--warm-grey);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; transition: opacity 0.3s;
}
.loader-spinner {
  width: 40px; height: 40px; border: 3px solid var(--light-grey);
  border-top-color: var(--rose); border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader.hidden { opacity: 0; pointer-events: none; }

/* ─── Mobile responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .page-content { padding: 20px 16px; }
  .auth-card { padding: 28px 20px; }
  .welcome-banner { padding: 24px 20px; }
  .cards-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── Utilities ────────────────────────────────────────────────────────────── */
.text-rose    { color: var(--rose); }
.text-sage    { color: var(--sage); }
.text-grey    { color: var(--mid-grey); }
.text-center  { text-align: center; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
