/*
 * FocusLedger — AdultingOS Design System
 * Trust Blue + Gold · "Peace of mind" palette
 * 2026
 *
 * This file loads AFTER page-level styles to override legacy tokens.
 */

/* ── Design Tokens ──────────────────────────────────────────────────── */
:root {
  /* Primary palette */
  --trust-blue:     #011e5c;
  --trust-blue-mid: #02287a;
  --trust-blue-lt:  #033099;
  --gold:           #c9a84c;
  --gold-dark:      #b8962f;

  /* Legacy token remaps — everything using --navy / --orange auto-updates */
  --navy:        #011e5c;
  --navy-mid:    #02287a;
  --navy-light:  #033099;
  --orange:      #c9a84c;
  --orange-light:#d4b56a;

  /* Text */
  --text-dark:   #1a1a1a;
  --text-muted:  #6b6b6b;

  /* Backgrounds */
  --cream:       #F8F7F4;
  --cream-dark:  #F2F1ED;
  --warm-white:  #fafaf8;
  --surface:     #ffffff;
  --border:      #e8e5e0;

  /* Lightweight pattern tokens */
  --app-card-radius: 12px;  /* Task cards: 12px per lightweight research */
  --app-btn-radius:  10px;  /* Buttons: 10-12px per lightweight research */

  /* Functional (unchanged) */
  --green:       #5BA4A4;
  --green-muted: #4A9292;
  --success:     #7DB87D;
  --warning:     #E07A5F;
  --error:       #E07A5F;
  --error-light: #FAEAE5;

  /* Typography */
  --font-serif: Georgia, "Times New Roman", serif;
  --font-sans:  Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Geometry — updated to match lightweight research patterns */
  --card-radius:  12px;
  --btn-radius:   10px;
  --card-shadow:  0 2px 8px rgba(0,0,0,0.06);
}

/* ── Base ───────────────────────────────────────────────────────────── */
body {
  font-family: var(--font-sans);
  background: var(--cream);
  color: var(--text-dark);
}

/* Serif headings */
h1, h2 {
  font-family: var(--font-serif) !important;
}
h3, h4, h5, h6 {
  font-family: var(--font-sans) !important;
}

/* ── Landing Page Nav (bare <nav> element) ──────────────────────────── */
body > nav {
  background: var(--trust-blue) !important;
  max-width: 100% !important;
  padding: 0 2rem !important;
  height: 64px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 200 !important;
}
body > nav .logo {
  color: white !important;
}
body > nav .logo-dot {
  background: var(--gold) !important;
}
body > nav > div a {
  color: rgba(255,255,255,0.82) !important;
}
body > nav > div a:hover {
  color: white !important;
}
/* Signup/CTA button in nav */
body > nav #navCtaLink,
body > nav a[href="/signup"] {
  background: var(--gold) !important;
  color: #1a1a1a !important;
  border-radius: var(--btn-radius) !important;
  box-shadow: none !important;
  font-weight: 600 !important;
  padding: 0.55rem 1.25rem !important;
}
body > nav #navCtaLink:hover,
body > nav a[href="/signup"]:hover {
  opacity: 0.9 !important;
  color: #1a1a1a !important;
}

/* ── Portal Nav ─────────────────────────────────────────────────────── */
.portal-nav {
  background: var(--trust-blue) !important;
  padding: 0 1.25rem !important;
  height: 56px !important;
  border-radius: 0 !important;
  margin: 0 !important;
  border-bottom: none !important;
  width: 100% !important;
}
.portal-logo,
.portal-logo * {
  color: white !important;
}
.portal-logo .logo-dot {
  background: var(--gold) !important;
}
.nav-link {
  color: rgba(255,255,255,0.75) !important;
  border-radius: 0 !important;
}
.nav-link:hover {
  background: rgba(255,255,255,0.1) !important;
  color: white !important;
}
.nav-link.active {
  background: transparent !important;
  color: white !important;
  border-bottom: 2px solid var(--gold) !important;
  border-radius: 0 !important;
}
.user-greeting {
  color: rgba(255,255,255,0.7) !important;
}
.logout-btn {
  color: rgba(255,255,255,0.7) !important;
}
.logout-btn:hover {
  color: var(--gold) !important;
  background: rgba(255,255,255,0.08) !important;
}

/* ── App Nav ────────────────────────────────────────────────────────── */
.app-nav {
  background: var(--trust-blue) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: none !important;
}
.app-nav .logo,
.app-nav .logo-dot {
  /* logo color handled by .logo being white when on dark bg */
}
.app-nav-inner .logo {
  color: white !important;
}
.app-nav-inner .logo .logo-dot {
  background: var(--gold) !important;
}
.app-nav-inner .back-link {
  color: rgba(255,255,255,0.72) !important;
}
/* Nav action icons / links */
.app-nav-inner > div a,
.app-nav-inner > div button {
  color: rgba(255,255,255,0.8) !important;
}
.app-nav-inner > div a:hover,
.app-nav-inner > div button:hover {
  color: white !important;
  background: rgba(255,255,255,0.08) !important;
}

/* App nav text elements on dark background */
.app-nav .user-name,
.app-nav .logout-btn,
.app-nav .back-link {
  color: rgba(255,255,255,0.75) !important;
}
.app-nav .logout-btn:hover,
.app-nav .back-link:hover {
  color: white !important;
}
.app-nav .pro-badge {
  background: var(--gold) !important;
  color: #1a1a1a !important;
  border-radius: 2px !important;
}
.app-nav .settings-link {
  color: rgba(255,255,255,0.75) !important;
}
.app-nav .settings-link:hover {
  color: white !important;
  background: rgba(255,255,255,0.08) !important;
}

/* ── Settings Nav ───────────────────────────────────────────────────── */
.settings-nav {
  background: var(--trust-blue) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: none !important;
}
.settings-nav-inner .logo {
  color: white !important;
}
.settings-nav-inner .logo .logo-dot {
  background: var(--gold) !important;
}
.settings-nav-inner .back-link,
.settings-nav-inner a {
  color: rgba(255,255,255,0.75) !important;
}

/* ── Bottom Tab Bar ─────────────────────────────────────────────────── */
.bottom-tabs {
  background: var(--trust-blue) !important;
  border-top: none !important;
}
.tab-btn {
  color: rgba(255,255,255,0.6) !important;
}
.tab-btn.active {
  color: var(--gold) !important;
}

/* ── Cards ──────────────────────────────────────────────────────────── */
.card,
.diff-card,
.hero-card,
.pricing-pill,
.news-card,
.cal-event {
  border-radius: var(--card-radius) !important;
}
.card {
  box-shadow: var(--card-shadow) !important;
}
.news-card:hover {
  transform: none !important;
}
.diff-card:hover {
  transform: none !important;
}

/* ── Buttons ────────────────────────────────────────────────────────── */
/* Primary CTA → gold */
.hero-cta-btn,
.hero-cta-link,
.final-cta-btn,
.closing-cta-link,
.auth-gate a {
  background: var(--gold) !important;
  color: #1a1a1a !important;
  border-radius: var(--btn-radius) !important;
  box-shadow: none !important;
}
.hero-cta-btn:hover,
.final-cta-btn:hover {
  transform: none !important;
  box-shadow: none !important;
  opacity: 0.88 !important;
}

/* Quick-add btn → trust blue */
.quick-add-btn {
  background: var(--trust-blue) !important;
  color: white !important;
  border-radius: var(--btn-radius) !important;
}
.quick-add-btn:hover {
  opacity: 0.88 !important;
}

/* Quick action buttons */
.qa-btn {
  border-radius: var(--btn-radius) !important;
}
.qa-btn:hover {
  border-color: var(--trust-blue) !important;
}

/* ── Inputs ─────────────────────────────────────────────────────────── */
.quick-add-input,
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  border-radius: var(--btn-radius) !important;
  min-height: 44px !important;
}
.quick-add-input:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--trust-blue) !important;
  outline-color: var(--trust-blue) !important;
}

/* ── Pricing pill featured ──────────────────────────────────────────── */
.pricing-pill.featured {
  border-color: var(--trust-blue) !important;
}
.pricing-pill.featured .plan-name {
  color: var(--trust-blue) !important;
}

/* ── Landing section headers ────────────────────────────────────────── */
.solution-header h2,
.pricing-teaser h2,
.final-cta h2,
.problem-inner h2 {
  font-family: var(--font-serif) !important;
}

/* ── Hero sub-card accent ───────────────────────────────────────────── */
.hero-card .hero-card-header h3 {
  font-family: var(--font-sans) !important;
}
.hero-card .pill {
  background: rgba(1,30,92,0.08) !important;
  color: var(--trust-blue) !important;
  border-radius: 2px !important;
}
.money-card {
  background: var(--trust-blue) !important;
  border-radius: var(--card-radius) !important;
}
.money-card .subtext {
  color: var(--gold) !important;
}

/* ── Scrollbar ──────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ============================================================
   MOBILE NAV HAMBURGER
   ============================================================ */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: rgba(255,255,255,0.8);
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}
.nav-hamburger:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}
.nav-hamburger svg { width: 22px; height: 22px; }

.nav-mobile-dropdown {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  background: white;
  z-index: 9999;
  box-shadow: -4px 0 24px rgba(45,42,38,0.15);
  flex-direction: column;
  padding: 1.5rem 1rem 2rem;
  overflow-y: auto;
}
.nav-mobile-dropdown.open { display: flex; }

.nav-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9998;
}
.nav-mobile-overlay.open { display: block; }

.nav-mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.nav-mobile-header .logo {
  color: var(--trust-blue) !important;
}
.nav-mobile-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 1.2rem;
}
.nav-mobile-close:hover { color: var(--navy); background: var(--cream-dark); }

.nav-mobile-items { display: flex; flex-direction: column; gap: 0.25rem; }
.nav-mobile-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-dark);
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  min-height: 48px;
}
.nav-mobile-item:hover { background: var(--cream-dark); color: var(--navy); }
.nav-mobile-item.pro-item { color: var(--navy); font-weight: 700; }
.nav-mobile-divider { height: 1px; background: var(--border); margin: 0.75rem 0; }
.nav-mobile-logout {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  min-height: 48px;
}
.nav-mobile-logout:hover { background: #FEF2F2; color: #E07A5F; }

/* Mobile: show hamburger, hide inline nav items */
@media (max-width: 768px) {
  .nav-hamburger { display: flex; }
  .app-nav .nav-right > *:not(.nav-hamburger) {
    display: none;
  }
  .app-nav-inner {
    justify-content: space-between !important;
  }
}
/* Landing nav: kill double-padding on mobile (body > nav + .nav-inner both pad) */
@media (max-width: 600px) {
  body > nav {
    padding: 0 !important;
  }
}

/* ============================================================
   AI SUGGESTIONS — Card-based layout with paired buttons
   ============================================================ */
.ai-suggestions-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem 1.5rem;
}
.ai-suggestions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.ai-suggestions-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ai-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, var(--gold), var(--orange-light));
  color: white;
  padding: 2px 6px;
  border-radius: 5px;
}
.ai-suggestions-refresh-btn {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  cursor: pointer;
  min-height: 36px;
  transition: border-color 0.15s, color 0.15s;
}
.ai-suggestions-refresh-btn:hover { border-color: var(--gold); color: var(--gold); }

/* AI Suggestion Cards — distinct card with clear visual boundaries */
.ai-suggestion-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 2px 12px rgba(45,42,38,0.04);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.ai-suggestion-card:hover {
  border-color: rgba(201,168,76,0.3);
  box-shadow: 0 4px 16px rgba(45,42,38,0.08);
}
.ai-suggestion-value-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.ai-suggestion-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.4;
  margin-bottom: 0.6rem;
}
.ai-suggestion-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.ai-suggestion-steps li {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  background: var(--cream-dark);
  border-radius: 6px;
  border-left: 3px solid var(--gold);
  line-height: 1.4;
}
/* Action buttons — visually inside the card, clear pairing */
.ai-suggestion-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.ai-sugg-btn {
  flex: 1;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}
.ai-sugg-btn.add {
  background: var(--gold);
  color: white;
}
.ai-sugg-btn.add:hover { background: var(--gold-dark); }
.ai-sugg-btn.add:active { transform: scale(0.97); }
.ai-sugg-btn.dismiss {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.ai-sugg-btn.dismiss:hover { border-color: #B0ADA8; color: var(--navy); }

/* Show more / Show less */
.ai-show-more-btn {
  display: block;
  width: 100%;
  padding: 0.65rem;
  background: var(--cream-dark);
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-align: center;
}
.ai-show-more-btn:hover { background: #F0ECE5; border-color: var(--gold); color: var(--gold); }

/* Loading, empty, cap banner states */
.ai-suggestions-loading { padding: 2rem; text-align: center; color: var(--text-muted); }
.ai-suggestions-empty { text-align: center; padding: 1.5rem; color: var(--text-muted); font-size: 0.88rem; }
.ai-suggestions-empty a { color: var(--gold); font-weight: 600; text-decoration: none; }
.ai-suggestions-cap-banner {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: white;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.ai-cap-text { flex: 1; font-size: 0.85rem; line-height: 1.4; }
.ai-cap-upgrade-btn {
  background: var(--gold);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
}
.ai-cap-upgrade-btn:hover { background: var(--gold-dark); }
.ai-daily-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 500;
}

/* Hidden overflow — collapsed state */
.ai-suggestion-card.collapsed { display: none; }

/* ============================================================
   RECURRING BILLS — Merchant name formatting
   ============================================================ */
.recurring-bills-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}
.recurring-bills-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.75rem;
}
.bill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  gap: 0.75rem;
}
.bill-row:last-child { border-bottom: none; }
.bill-row-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}
.bill-type-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.bill-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.bill-raw-name {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  display: block;
}
.bill-toggle-btn {
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: 'DM Sans', sans-serif;
  min-height: 32px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.bill-toggle-btn.active {
  background: #D4EDEC;
  color: var(--green-muted);
}
.bill-toggle-btn.disabled-state {
  background: var(--cream-dark);
  color: var(--text-muted);
}

/* ============================================================
   DASHBOARD VISUAL HIERARCHY
   ============================================================ */
/* AI suggestions section gets a clear visual separation */
.ai-suggestions-section::before {
  content: '';
  display: block;
  height: 1px;
  background: var(--border);
  margin-bottom: 1.5rem;
}

/* Spoke section title gets uppercase treatment + letter-spacing */
.spoke-section-title {
  font-family: 'Space Grotesk', sans-serif !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  color: var(--text-muted) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.1em !important;
  margin-bottom: 0.85rem !important;
  margin-top: 2rem !important; /* visual separator from content above */
}

/* ============================================================
   MOBILE POLISH — 375px / 390px / 428px widths
   ============================================================ */
@media (max-width: 480px) {
  .ai-suggestions-section { padding: 0 0.75rem 1.25rem; }
  .ai-suggestion-card { padding: 0.9rem 1rem; }
  .ai-suggestion-actions { flex-direction: column; }
  .ai-sugg-btn { width: 100%; }
  .recurring-bills-section { padding: 0 0.75rem; }
  .bill-raw-name { display: none; } /* hide raw name on tiny screens */
}

@media (max-width: 375px) {
  .ai-suggestion-title { font-size: 0.88rem; }
  .spoke-section { padding: 0 0.5rem 1rem !important; }
  .app-nav-inner { padding: 0.65rem 0.75rem !important; }
}
