/* ═══════════════════════════════════════════════
   Esra & Yusuf — Lovable Design (1:1 Port)
   Fonts: Fraunces (display) + Manrope (body)
   ═══════════════════════════════════════════════ */

:root {
  --radius: 0.875rem;
  --background: #faf7f4;
  --foreground: #3d232c;
  --card: #ffffff;
  --card-foreground: #3d232c;
  --primary: #7a3b52;
  --primary-foreground: #faf7f4;
  --secondary: #f3ebe4;
  --secondary-foreground: #4a2a35;
  --muted: #f3ebe4;
  --muted-foreground: #8c737b;
  --accent: #f3c978;
  --accent-foreground: #3d232c;
  --destructive: #c94a4a;
  --destructive-foreground: #faf7f4;
  --border: #e7ddd6;
  --input: #e7ddd6;
  --ring: #7a3b52;
  --chart-1: #d67fa3;
  --chart-2: #7b9ad4;
  --chart-3: #f3c978;
  --success: #2f9d6a;
  --violet: #7b4fd4;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
h1, h2, h3, h4, h5, h6, p { margin: 0; padding: 0; }
body {
  font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
  background: radial-gradient(circle at top left, #fff1f5 0%, var(--background) 40%, var(--background) 100%);
  color: var(--foreground);
  min-height: 100vh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  -webkit-font-smoothing: antialiased;
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.font-display {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.page { display: none; }
.page.active { display: block; }

.container {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ═══════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
}
.login-box {
  width: 100%;
  max-width: 22rem;
  text-align: center;
}
.love-icon {
  width: 3.5rem; height: 3.5rem;
  margin: 0 auto;
  border-radius: 9999px;
  background: rgba(122,59,82,0.10);
  display: grid;
  place-items: center;
}
.love-icon svg { width: 1.5rem; height: 1.5rem; color: var(--primary); fill: currentColor; }
.login-title { margin-top: 1.25rem; font-size: 2.5rem; line-height: 1; }
.login-sub { margin-top: 0.5rem; font-size: 0.875rem; color: var(--muted-foreground); }

.user-toggle {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  background: var(--secondary);
  border-radius: 1rem;
  padding: 0.375rem;
}
.user-toggle button {
  border: none;
  background: transparent;
  border-radius: 0.75rem;
  padding: 0.625rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: 0.15s;
  font-family: inherit;
}
.user-toggle button.active { background: var(--card); color: var(--foreground); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }

.pin-label {
  margin-top: 2rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted-foreground);
}
.pin-dots {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}
.pin-dot {
  width: 0.875rem; height: 0.875rem;
  border-radius: 9999px;
  border: 1.5px solid var(--border);
  transition: 0.15s;
}
.pin-dot.filled { background: var(--primary); border-color: var(--primary); }
.pin-dot.err { border-color: var(--destructive); }
.pin-err { margin-top: 0.75rem; font-size: 0.75rem; color: var(--destructive); }

.numpad {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.numpad button {
  border: none;
  background: var(--card);
  border-radius: 1rem;
  padding: 1rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.5rem;
  color: var(--foreground);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: transform 0.08s;
}
.numpad button:active { transform: scale(0.96); }
.numpad .del {
  font-family: "Manrope", sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted-foreground);
  background: transparent;
  box-shadow: none;
}

/* ═══════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════ */
.dashboard { min-height: 100vh; padding-bottom: 6rem; }
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.25rem;
}
.header-greet {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted-foreground);
}
.header-name { font-size: 1.875rem; line-height: 1.1; margin-top: 0.15rem; }
.header-actions { display: flex; gap: 0.5rem; }
.icon-btn {
  width: 2.5rem; height: 2.5rem;
  border-radius: 9999px;
  background: var(--card);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--muted-foreground);
  transition: 0.15s;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 1rem; height: 1rem; }

/* Hero Card */
.hero {
  margin-top: 1rem;
  border-radius: 1.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, #592539 100%);
  color: var(--primary-foreground);
  padding: 1.25rem;
  box-shadow: 0 12px 35px rgba(122,59,82,0.25), inset 0 1px 0 rgba(255,255,255,0.1);
  overflow: hidden;
  position: relative;
}
.hero::after {
  content: "";
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 60%);
  pointer-events: none;
}
.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.85;
}
.hero-label svg { width: 1rem; height: 1rem; }
.hero-badge {
  background: rgba(250,247,244,0.15);
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
}
.hero-amount { margin-top: 0.75rem; font-size: 2.25rem; line-height: 1; }
.hero-progress {
  margin-top: 1rem;
  height: 0.5rem;
  width: 100%;
  border-radius: 9999px;
  background: rgba(250,247,244,0.2);
  overflow: hidden;
}
.hero-progress-bar {
  height: 100%;
  border-radius: 9999px;
  background: var(--accent);
  transition: width 0.7s ease;
}
.hero-meta {
  margin-top: 0.5rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  opacity: 0.85;
}

/* Vaults */
.vault-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.vault-card {
  background: var(--card);
  border-radius: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border);
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s, box-shadow 0.2s;
}
.vault-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.04);
}
.vault-card.active { border-color: rgba(122,59,82,0.4); }
.vault-name {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted-foreground);
}
.vault-balance { margin-top: 0.5rem; font-size: 1.5rem; }
.vault-spent { margin-top: 0.25rem; font-size: 0.75rem; color: var(--muted-foreground); }

/* Sections */
.section { margin-top: 1.5rem; }
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.section-title { font-size: 1.25rem; }
.section-right { font-size: 0.75rem; color: var(--muted-foreground); }

.card {
  background: var(--card);
  border-radius: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
}

/* Doughnut Chart */
.doughnut-wrap {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.doughnut {
  position: relative;
  width: 9rem; height: 9rem;
  flex-shrink: 0;
}
.doughnut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
}
.doughnut-center p:first-child {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted-foreground);
}
.doughnut-center p:last-child { font-size: 0.9rem; margin-top: 0.1rem; }
.legend { flex: 1; list-style: none; margin: 0; padding: 0; }
.legend li {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}
.legend li:last-child { margin-bottom: 0; }
.legend-dot { width: 0.625rem; height: 0.625rem; border-radius: 9999px; flex-shrink: 0; }
.legend-label { flex: 1; color: var(--muted-foreground); }
.legend-value { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Items + Transactions Lists */
.item-list, .tx-list { list-style: none; margin: 0; padding: 0; }
.item-row, .tx-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.75rem 0.875rem;
  margin-bottom: 0.375rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  box-shadow: 0 2px 10px rgba(0,0,0,0.01);
}
.item-row:hover, .tx-row:hover { 
  background: var(--card); 
  transform: translateX(4px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.03);
  border-color: rgba(122,59,82,0.15);
}
.item-check {
  width: 1.25rem; height: 1.25rem;
  border-radius: 0.375rem;
  border: 1.5px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: 0.15s;
}
.item-check.checked { background: var(--primary); border-color: var(--primary); }
.item-check svg { width: 0.875rem; height: 0.875rem; color: var(--primary-foreground); }
.item-name { flex: 1; font-size: 0.875rem; }
.item-name.done { color: var(--muted-foreground); text-decoration: line-through; }
.item-price { font-size: 0.875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.item-price.done { color: var(--muted-foreground); text-decoration: line-through; }

.tx-icon {
  width: 2.25rem; height: 2.25rem;
  border-radius: 9999px;
  background: var(--secondary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.tx-icon svg { width: 1rem; height: 1rem; }
.tx-icon.income { color: var(--success); }
.tx-icon.expense { color: var(--destructive); }
.tx-icon.transfer { color: var(--violet); }
.tx-body { min-width: 0; flex: 1; }
.tx-title { font-size: 0.875rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 0.7rem; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-amount { font-size: 0.875rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-amount.income { color: var(--success); }
.tx-amount.expense { color: var(--destructive); }
.tx-amount.transfer { color: var(--violet); }

.delete-btn {
  background: none;
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0.25rem;
  margin-left: 0.5rem;
  border-radius: 0.25rem;
  display: grid;
  place-items: center;
  transition: 0.15s;
}
.delete-btn:hover {
  background: var(--destructive);
  color: var(--destructive-foreground);
}

/* FAB */
.fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3.75rem; height: 3.75rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, var(--primary), #592539);
  color: var(--primary-foreground);
  border: none;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 25px rgba(122,59,82,0.4), 0 4px 10px rgba(122,59,82,0.2);
  cursor: pointer;
  z-index: 30;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
}
.fab:hover {
  transform: scale(1.05);
  box-shadow: 0 15px 30px rgba(122,59,82,0.45), 0 6px 15px rgba(122,59,82,0.25);
}
.fab:active { transform: scale(0.92); }
.fab svg { width: 1.5rem; height: 1.5rem; }

/* ═══════════════════════════════════════════════
   OVERLAYS / SHEETS
   ═══════════════════════════════════════════════ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(61,35,44,0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 0;
}
.sheet {
  width: 100%;
  max-width: 28rem;
  background: var(--card);
  border-radius: 1.75rem 1.75rem 0 0;
  padding: 1.5rem;
  padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.sheet-title { font-size: 1.25rem; }
.sheet-close {
  width: 2.25rem; height: 2.25rem;
  border-radius: 9999px;
  background: var(--secondary);
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--muted-foreground);
  transition: 0.15s;
}
.sheet-close:active { transform: scale(0.92); }
.sheet-close svg { width: 1rem; height: 1rem; }

.menu-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  background: var(--secondary);
  border: none;
  border-radius: 1rem;
  padding: 1rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.menu-btn:hover { background: rgba(243,201,120,0.2); }
.menu-btn:active { transform: scale(0.98); }
.menu-icon {
  width: 2.5rem; height: 2.5rem;
  border-radius: 9999px;
  background: var(--primary);
  color: var(--primary-foreground);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.menu-icon svg { width: 1.25rem; height: 1.25rem; }
.menu-label { display: block; font-size: 0.875rem; font-weight: 600; color: var(--foreground); }
.menu-sub { display: block; font-size: 0.75rem; color: var(--muted-foreground); margin-top: 0.1rem; }

/* Form Elements */
.form-group { margin-bottom: 1rem; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted-foreground);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--background);
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: var(--foreground);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--primary); }

.segmented {
  display: grid;
  gap: 0.375rem;
  background: var(--secondary);
  border-radius: 1rem;
  padding: 0.375rem;
}
.segmented.two { grid-template-columns: 1fr 1fr; }
.segmented.three { grid-template-columns: 1fr 1fr 1fr; }
.segmented button {
  border: none;
  background: transparent;
  border-radius: 0.75rem;
  padding: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: 0.15s;
  font-family: inherit;
}
.segmented button.active { background: var(--card); color: var(--foreground); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--secondary);
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
}
.checkbox-row input { width: 1rem; height: 1rem; accent-color: var(--primary); }

.btn-primary {
  width: 100%;
  border: none;
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: 0.75rem;
  padding: 0.875rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  font-family: inherit;
  margin-top: 0.5rem;
}
.btn-primary:hover { opacity: 0.92; }
.btn-primary:active { transform: scale(0.98); }

.hidden { display: none !important; }
