/* ============================================================
   BudgetApp — Blue & White theme (no dark mode)
   ============================================================ */
body { animation: fadeIn 0.15s ease-out; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Form fields */
.field {
  width: 100%; padding: 0.55rem 0.875rem;
  background: #fff; border: 1.5px solid #e2e8f0;
  border-radius: 0.5rem; color: #1e293b;
  font-size: 0.875rem; line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit; -webkit-appearance: none;
}
.field::placeholder { color: #94a3b8; }
.field:focus { outline: none; border-color: #1a6cff; box-shadow: 0 0 0 3px rgba(26,108,255,0.12); }
select.field { cursor: pointer; }
textarea.field { resize: vertical; min-height: 80px; }
select.field option { background: #fff; color: #1e293b; }

/* Currency symbol prefix — explicit padding so it works with both CDN and built Tailwind */
.currency-input { padding-left: 2.5rem !important; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal-box {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 1rem; width: 100%; max-width: 480px;
  max-height: 92vh; overflow-y: auto;
  box-shadow: 0 16px 48px rgba(15,23,42,0.15);
  transform: translateY(10px) scale(0.98);
  transition: transform 0.22s ease; color: #1e293b;
}
.modal-backdrop.open .modal-box { transform: translateY(0) scale(1); }

/* Spinner */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: white; border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-loading .spinner  { display: inline-block; }
.btn-loading .btn-text { display: none; }
.btn-loading           { pointer-events: none; opacity: 0.75; }

/* Toast */
.toast { animation: slideDown 0.2s ease; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Progress bar */
.progress-track { width: 100%; height: 7px; background: #e2e8f0; border-radius: 9999px; overflow: hidden; }
.progress-fill  { height: 100%; border-radius: 9999px; transition: width 0.5s ease; }

/* Code input */
.code-input { letter-spacing: 0.5rem; font-size: 2rem; font-weight: 700; text-align: center; }

/* Chart */
.chart-wrap { position: relative; height: 300px; }

/* Stat cards — white with colored left border */
.stat-card {
  background: #fff; border: 1px solid #e2e8f0;
  border-left-width: 4px; border-left-style: solid;
  border-radius: 0.875rem;
  padding: 0.875rem 0.75rem;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  min-width: 0; overflow: hidden;      /* prevent overflow in 3-col grid */
}
.stat-card-income  { border-left-color: #16a34a; }
.stat-card-expense { border-left-color: #dc2626; }
.stat-card-balance { border-left-color: #1a6cff; }

/* Fluid amount text that never overflows a card */
.stat-amount {
  font-weight: 700; line-height: 1.2;
  font-size: clamp(0.7rem, 3.8vw, 1.2rem);
  word-break: break-all; overflow-wrap: anywhere;
}
.stat-label {
  font-size: clamp(0.55rem, 1.8vw, 0.68rem);
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 0.3rem;
}
.stat-sub {
  font-size: clamp(0.55rem, 1.6vw, 0.68rem);
  color: #64748b; margin-top: 0.25rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Panel */
.panel { background: #fff; border: 1px solid #e2e8f0; border-radius: 0.875rem; overflow: hidden; }
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid #f1f5f9;
}

/* Table */
table { border-collapse: collapse; width: 100%; }
table thead { background: #f8fafc; }
table th {
  font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase;
  font-weight: 600; color: #64748b; padding: 0.75rem 1.25rem;
}
table td { padding: 0.875rem 1.25rem; color: #334155; }
table tbody tr { border-bottom: 1px solid #f1f5f9; }
table tbody tr:last-child { border-bottom: none; }
table tbody tr:hover { background: #f8fafc; }

/* ===== MOBILE BOTTOM NAV ===== */
@media (min-width: 768px) { .bottom-nav { display: none !important; } }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid #e2e8f0;
  z-index: 99;   /* below modal-backdrop (200) but above page content */
  display: flex; justify-content: space-around; align-items: center;
  height: 60px;
  padding-bottom: max(0px, env(safe-area-inset-bottom));
  box-shadow: 0 -2px 12px rgba(0,0,0,0.07);
}
.bottom-nav a,
.bottom-nav button,
.bottom-nav summary {
  display: flex; flex-direction: column;
  align-items: center; gap: 3px;
  color: #94a3b8; text-decoration: none;
  font-size: 0.65rem; font-weight: 500;
  padding: 6px 8px; min-width: 44px; min-height: 44px;
  justify-content: center;
  background: none; border: none; cursor: pointer;
  border-radius: 10px; list-style: none;
  transition: color 0.15s;
}
.bottom-nav summary { outline: none; }
.bottom-nav a:hover, .bottom-nav a.active { color: #1a6cff; }

/* FAB — raised above the nav bar */
.bottom-fab {
  width: 52px; height: 52px; border-radius: 50%;
  background: #1a6cff !important; color: #fff !important;
  border: none;
  box-shadow: 0 4px 16px rgba(26,108,255,0.45);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  /* push it above the bar */
  position: relative; top: -14px;
  outline: 4px solid #fff;
  transition: transform 0.15s, box-shadow 0.15s;
}
.bottom-fab:hover { transform: scale(1.08); box-shadow: 0 6px 22px rgba(26,108,255,0.55); }

/* Me popup */
.bottom-nav details { position: relative; }
.me-popup {
  position: absolute; bottom: calc(100% + 8px); right: -8px;
  width: 215px; background: #fff;
  border: 1px solid #e2e8f0; border-radius: 0.875rem;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.1);
  padding: 0.375rem 0; z-index: 110;
}
.me-popup a, .me-popup button {
  display: flex; align-items: center; gap: 0.625rem;
  width: 100%; padding: 0.55rem 0.875rem;
  font-size: 0.875rem; font-weight: 500; color: #374151;
  text-decoration: none; background: none; border: none;
  cursor: pointer; text-align: left;
  flex-direction: row; min-height: auto; transition: background 0.1s;
}
.me-popup a:hover, .me-popup button:hover { background: #f8fafc; }
.me-popup hr { border: none; border-top: 1px solid #f1f5f9; margin: 0.25rem 0; }

/* Currency picker inside me-popup */
.me-popup-currency {
  padding: 0.5rem 0.875rem 0.625rem;
  border-bottom: 1px solid #f1f5f9; margin-bottom: 0.25rem;
}
.me-popup-currency label {
  display: block; font-size: 0.6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: #94a3b8; margin-bottom: 0.3rem;
}
.me-popup-currency select {
  width: 100%; font-size: 0.8rem; font-family: inherit;
  padding: 0.3rem 0.5rem;
  border: 1.5px solid #e2e8f0; border-radius: 0.4rem;
  background: #f8fafc; color: #334155; cursor: pointer;
}
.me-popup-currency select:focus { outline: none; border-color: #1a6cff; }

@media (max-width: 767px) { body { padding-bottom: 72px; } }

/* Scrollbar */
::-webkit-scrollbar       { width: 5px; }
::-webkit-scrollbar-track { background: #f8fafc; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
