/* ============================================
   SUMART — Dashboard Styles
   assets/css/dashboard.css
   ============================================ */

/* ── Top Navigation Bar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  background: rgb(18, 18, 45);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Force topbar children to always use dark-mode colors */
.topbar .btn-ghost {
  color: rgba(255, 255, 255, 0.55);
}
.topbar .btn-ghost:hover,
.topbar .btn-ghost.active {
  background: rgba(48, 141, 241, 0.18);
  color: var(--azure);
}

.topbar .user-chip {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.topbar .theme-toggle {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
}
.topbar .theme-toggle:hover {
  background: rgba(48, 141, 241, 0.2);
  border-color: rgba(48, 141, 241, 0.4);
  color: var(--azure);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

/* SumartFull.png is a wide horizontal logo — size by height, let width be auto */
.topbar-logo {
  height: 44px;
  width: auto;
  object-fit: contain;
}

.topbar-nav {
  display: flex;
  gap: 4px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  border-radius: 30px;
  padding: 6px 14px 6px 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.user-chip:hover { background: rgba(255, 255, 255, 0.10); }

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
}

.user-caret {
  opacity: 0.35;
  font-size: 10px;
  margin-left: 2px;
}

/* ── Main Layout ── */
.dash-main {
  position: relative;
  z-index: 1;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* ── Insight Strip ── */
.insight-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  background: linear-gradient(135deg, rgba(60,85,246,0.18), rgba(162,76,237,0.12));
  border: 1px solid rgba(162, 76, 237, 0.22);
  border-radius: 14px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
  animation: fadeUp 0.6s ease both;
}

.insight-icon { font-size: 20px; flex-shrink: 0; }
.insight-highlight { color: var(--yellow); font-weight: 600; }

/* ── Stat Cards Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card { padding: 22px 24px; }

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.1px;
  font-weight: 600;
  margin-bottom: 10px;
}

.stat-amount {
  font-family: 'Syne', sans-serif;
  font-size: 30px;
  font-weight: 800;
  margin-bottom: 4px;
  line-height: 1;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.stat-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card.income .stat-amount   { color: var(--green); }
.stat-card.income .stat-bar-fill  { background: var(--green); width: 100%; }
.stat-card.bills .stat-amount    { color: var(--azure); }
.stat-card.bills .stat-bar-fill   { background: var(--azure); width: 65%; }
.stat-card.saved .stat-amount    { color: var(--yellow); }
.stat-card.saved .stat-bar-fill   { background: var(--yellow); width: 7%; }
.stat-card.remaining .stat-amount { color: var(--pink); }
.stat-card.remaining .stat-bar-fill { background: var(--pink); width: 28%; }

/* ── Lower Two-Column Grid ── */
.lower-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: start;
}

/* ── Full Calendar ── */
.calendar-card { padding: 26px; }

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.calendar-month {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 800;
}

.cal-nav-group { display: flex; gap: 8px; }

.cal-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  color: #fff;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.cal-nav-btn:hover { background: rgba(255, 255, 255, 0.12); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  text-align: center;
}

.cal-dow {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 0 10px;
}

.cal-day {
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 7px 4px 4px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  min-height: 52px;
  position: relative;
}
.cal-day:hover { background: rgba(255, 255, 255, 0.07); }
.cal-day.today {
  background: rgba(48, 141, 241, 0.16);
  border: 1px solid rgba(48, 141, 241, 0.32);
  color: var(--azure);
  font-weight: 700;
}
.cal-day.empty { cursor: default; color: transparent; pointer-events: none; }

.cal-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  margin-top: 4px;
}
.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
}

/* ── Right Sidebar ── */
.sidebar { display: flex; flex-direction: column; gap: 18px; }

/* ── Bills List ── */
.bills-card { padding: 24px; }

.bill-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.bill-item:last-of-type { border-bottom: none; }

.bill-tag { width: 6px; height: 34px; border-radius: 3px; flex-shrink: 0; }
.bill-info { flex: 1; }
.bill-name { font-size: 13px; font-weight: 500; margin-bottom: 2px; color: var(--text-primary); }
.bill-date { font-size: 11px; color: var(--text-muted); }
.bill-amount { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; }

.btn-add-bill {
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed rgba(48, 141, 241, 0.4);
  background: rgba(48, 141, 241, 0.05);
  color: var(--vivid-blue);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-add-bill:hover {
  background: rgba(48, 141, 241, 0.12);
  border-color: var(--vivid-blue);
}

/* ── Spending Breakdown ── */
.breakdown-card { padding: 24px; }

.expense-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
}
.expense-row:last-child { margin-bottom: 0; }
.expense-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.expense-name { font-size: 12px; color: var(--text-sub); flex: 1; min-width: 80px; }
.expense-bar-track { flex: 2; height: 5px; background: rgba(255,255,255,0.07); border-radius: 3px; overflow: hidden; }
.expense-bar-fill { height: 100%; border-radius: 3px; transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1); }
.expense-amount { font-size: 12px; font-weight: 600; min-width: 48px; text-align: right; color: rgba(255,255,255,0.88); }

/* ── Add Bill Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 30, 0.88);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-box {
  background: #1a1a42;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 22px;
  padding: 36px;
  width: 100%;
  max-width: 460px;
  transform: translateY(20px);
  transition: transform 0.25s;
}
.modal-overlay.open .modal-box { transform: translateY(0); }

.modal-title { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.modal-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }
.modal-footer { display: flex; gap: 10px; margin-top: 24px; }

.btn-cancel {
  flex: 1; padding: 13px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--card-border);
  border-radius: 10px; color: var(--text-sub); font-size: 14px; transition: background 0.2s;
}
.btn-cancel:hover { background: rgba(255,255,255,0.09); }

.btn-save {
  flex: 2; padding: 13px;
  background: linear-gradient(135deg, var(--blue), var(--vivid-blue)); border: none;
  border-radius: 10px; color: #fff; font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 14px; box-shadow: 0 6px 20px rgba(60,85,246,0.3); transition: opacity 0.2s;
}
.btn-save:hover { opacity: 0.88; }

/* ── Category Selector ── */
.category-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 6px; }

.cat-chip {
  padding: 9px 6px; border-radius: 10px; border: 1px solid var(--card-border);
  background: var(--card-bg); font-size: 12px; text-align: center; cursor: pointer;
  transition: all 0.18s; color: var(--text-sub);
}
.cat-chip:hover { border-color: rgba(255,255,255,0.2); color: #fff; }
.cat-chip.selected { border-color: var(--vivid-blue); background: rgba(48,141,241,0.14); color: #fff; }

/* ── Plaid Connect Card ── */
.plaid-connect-card { padding: 22px; }

.plaid-empty-state { text-align: center; padding: 16px 0; }
.plaid-empty-icon  { font-size: 32px; margin-bottom: 8px; }
.plaid-empty-text  { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.plaid-btn-group { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }

.btn-plaid-connect {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 12px;
  font-size: 13px; font-weight: 500;
  transition: all 0.2s; width: 100%; cursor: pointer;
}
.btn-plaid-connect.bank {
  border: 1px dashed rgba(115,234,114,0.4);
  background: rgba(115,234,114,0.05);
  color: var(--green);
}
.btn-plaid-connect.card {
  border: 1px dashed rgba(48,141,241,0.4);
  background: rgba(48,141,241,0.05);
  color: var(--vivid-blue);
}
.btn-plaid-connect.credit-score {
  border: 1px dashed rgba(162,76,237,0.4);
  background: rgba(162,76,237,0.05);
  color: var(--lavender);
}
.btn-plaid-connect:hover { filter: brightness(1.15); }

.btn-plaid-icon   { font-size: 18px; }
.btn-plaid-label  { flex: 1; }
.btn-plaid-suffix { margin-left: auto; opacity: 0.5; font-size: 11px; }
.btn-plaid-badge  { margin-left: auto; font-size: 10px; padding: 2px 7px; border-radius: 10px; background: rgba(253,236,131,0.15); color: var(--yellow); }

.plaid-security-note {
  margin-top: 14px; padding: 10px 12px; border-radius: 10px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--card-border);
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--text-muted); line-height: 1.4;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .stats-row         { grid-template-columns: repeat(2, 1fr); }
  .lower-grid        { grid-template-columns: 1fr; }
  .topbar            { padding: 14px 20px; }
  .dash-main         { padding: 24px 20px; }
  .credit-lower-grid { grid-template-columns: 1fr; }
  .factors-grid      { grid-template-columns: repeat(2, 1fr); }
  .credit-hero       { flex-direction: column; align-items: flex-start; gap: 24px; padding: 24px; }
}

@media (max-width: 640px) {
  html, body { overflow-x: hidden; }

  .stats-row    { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-amount  { font-size: 22px; }

  .topbar       { padding: 12px 16px; }
  .topbar-nav   { display: none; }
  .topbar-logo  { height: 32px; }

  .theme-toggle .theme-toggle-label { display: none; }
  .theme-toggle { padding: 7px 10px; }

  .user-chip  { padding: 5px 10px 5px 6px; font-size: 12px; }
  .user-name  { display: none; }

  .dash-main  { padding: 16px; gap: 16px; }

  .insight-strip { font-size: 12px; padding: 12px 14px; gap: 10px; }

  .calendar-card  { padding: 16px; }
  .cal-day        { font-size: 11px; min-height: 40px; padding: 5px 2px 2px; }
  .cal-dow        { font-size: 9px; }
  .cal-dot        { width: 4px; height: 4px; }
  .calendar-month { font-size: 15px; }

  .bills-card   { padding: 16px; }
  .bill-name    { font-size: 12px; }
  .bill-date    { font-size: 10px; }
  .bill-amount  { font-size: 13px; }

  .breakdown-card { padding: 16px; }
  .expense-name   { font-size: 11px; min-width: 60px; }
  .expense-amount { font-size: 11px; min-width: 40px; }

  .modal-overlay  { align-items: flex-end; }
  .modal-box      { border-radius: 22px 22px 0 0; padding: 28px 20px; max-width: 100%; width: 100%; }
  .category-grid  { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .cat-chip       { font-size: 11px; padding: 8px 4px; }

  .score-ring-wrap   { width: 140px; height: 140px; margin: 0 auto; }
  .score-number      { font-size: 32px; }
  .credit-hero       { padding: 18px; gap: 16px; }
  .credit-hero-title { font-size: 18px; }
  .factors-grid      { grid-template-columns: 1fr 1fr; gap: 10px; }
  .factor-card       { padding: 14px; }
  .factor-value      { font-size: 16px; }
  .accounts-list, .recs-list { padding: 16px; }
  .account-name  { font-size: 13px; }
  .rec-title     { font-size: 12px; }
  .rec-desc      { font-size: 11px; }
  .rec-impact    { font-size: 10px; white-space: normal; }
}

/* ── Plaid Credit Banner (on credit page) ── */
.plaid-credit-banner {
  padding: 18px 22px;
  background: linear-gradient(135deg, rgba(162,76,237,0.12), rgba(60,85,246,0.10));
  border-color: rgba(162,76,237,0.25);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.plaid-credit-banner-icon  { font-size: 28px; flex-shrink: 0; }
.plaid-credit-banner-body  { flex: 1; min-width: 200px; }
.plaid-credit-banner-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 3px;
}
.plaid-credit-banner-desc  { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.plaid-credit-banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-plaid-credit-connect {
  padding: 10px 18px; border-radius: 10px;
  background: linear-gradient(135deg, var(--lavender), var(--blue));
  border: none; color: #fff;
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 13px;
  cursor: pointer; transition: opacity 0.2s; white-space: nowrap;
}
.btn-plaid-credit-connect:hover { opacity: 0.88; }
.btn-plaid-credit-dismiss {
  padding: 10px 14px; border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--card-border);
  color: var(--text-muted); font-size: 12px; cursor: pointer;
}
.plaid-credit-banner-footer {
  width: 100%;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.text-yellow { color: var(--yellow); }
