/* ============================================================
   XpensePro — Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

/* ─── CSS Variables ──────────────────────────────────────── */
:root {
    --indigo: #6366f1;
    --emerald: #10b981;
    --rose: #f43f5e;
    --amber: #f59e0b;
    --bg-dark: #0a0f1e;
    --bg-card: #0f1629;
    --border: rgba(99,102,241,0.15);
    --text-muted: #64748b;
}

/* ─── Base ───────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Sora', sans-serif;
    background: var(--bg-dark);
    min-height: 100vh;
    padding-bottom: 80px;
    transition: background 0.3s, color 0.3s;
}
html.light body { background: #f0f4ff; color: #0f172a; }
html.light      { color: #0f172a; }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 10px; }

/* ─── Cards ──────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: all 0.3s;
}
html.light .card  { background: #fff; border-color: #e2e8f0; color: #0f172a; }
.card-glow:hover  { box-shadow: 0 0 30px rgba(99,102,241,0.1); }

/* ─── Grid Background ────────────────────────────────────── */
.grid-bg {
    background-image:
        linear-gradient(rgba(99,102,241,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99,102,241,0.04) 1px, transparent 1px);
    background-size: 32px 32px;
}

/* ─── Gradient Text ──────────────────────────────────────── */
.grad-text {
    background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ─── Inputs ─────────────────────────────────────────────── */
.inp {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 14px;
    padding: 10px 14px;
    width: 100%;
    font-size: 13px;
    color: inherit;
    font-family: 'Sora', sans-serif;
    transition: border 0.2s, box-shadow 0.2s;
    outline: none;
}
html.light .inp { background: #f8fafc; border-color: #e2e8f0; color: #0f172a; }
.inp:focus      { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }

/* ─── Buttons ────────────────────────────────────────────── */
.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Sora', sans-serif;
}
.btn-primary:hover  { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(99,102,241,0.35); }
.btn-primary:active { transform: scale(0.97); }

.btn-ghost {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: inherit;
    font-family: 'Sora', sans-serif;
    transition: all 0.2s;
}
html.light .btn-ghost { background: #f1f5f9; border-color: #e2e8f0; }
.btn-ghost:hover      { background: rgba(99,102,241,0.1); border-color: rgba(99,102,241,0.3); }

/* ─── Toast ──────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: #1e293b;
    border: 1px solid rgba(99,102,241,0.3);
    border-radius: 14px;
    padding: 12px 18px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
}
html.light .toast { background: #fff; color: #0f172a; border-color: #e2e8f0; }
.toast.success    { border-color: rgba(16,185,129,0.4); }
.toast.error      { border-color: rgba(244,63,94,0.4); }
.toast.info       { border-color: rgba(99,102,241,0.4); }

@keyframes slideIn  { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(110%); opacity: 0; } }

/* ─── Transaction Animations ─────────────────────────────── */
.tx-item { animation: fadeSlideIn 0.3s ease both; }

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

.tx-item.deleting { animation: fadeOut 0.25s ease forwards; }

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(40px); height: 0; padding: 0; margin: 0; border: none; }
}

/* ─── Modal ──────────────────────────────────────────────── */
#editModal {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
#editModal.open { display: flex; }
.modal-box      { width: 100%; max-width: 420px; animation: modalIn 0.25s ease; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

/* ─── Budget Bar ─────────────────────────────────────────── */
.budget-bar  { height: 4px; border-radius: 4px; background: rgba(255,255,255,0.1); overflow: hidden; }
.budget-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }

/* ─── Savings Gauge ──────────────────────────────────────── */
.gauge-track { width: 100%; height: 8px; background: rgba(255,255,255,0.08); border-radius: 10px; overflow: hidden; }
.gauge-fill  {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, #10b981, #6366f1);
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Bottom Nav ─────────────────────────────────────────── */
#bottomNav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(15,22,41,0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(99,102,241,0.15);
    z-index: 100;
    display: flex;
    justify-content: space-around;
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
}
html.light #bottomNav { background: rgba(255,255,255,0.95); border-color: #e2e8f0; }

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
}
.nav-item.active { color: var(--indigo); }
.nav-item i      { font-size: 16px; }

/* ─── Sections ───────────────────────────────────────────── */
.page-section        { display: none; }
.page-section.active { display: block; }

/* ─── Skeleton ───────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.04) 25%,
        rgba(255,255,255,0.08) 50%,
        rgba(255,255,255,0.04) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 10px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ─── Monospace Numbers ──────────────────────────────────── */
.mono { font-family: 'JetBrains Mono', monospace; }

/* ─── Balance Card ───────────────────────────────────────── */
.balance-card {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 60%, #a855f7 100%);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}
.balance-card::before {
    content: '';
    position: absolute;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    top: -60px; right: -60px;
}
.balance-card::after {
    content: '';
    position: absolute;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    bottom: -40px; left: -20px;
}

/* ─── Quick Buttons ──────────────────────────────────────── */
.quick-btn        { transition: all 0.15s; }
.quick-btn:active { transform: scale(0.93); }

/* ─── Badge ──────────────────────────────────────────────── */
.badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ─── Chart Container ────────────────────────────────────── */
.chart-wrap { position: relative; width: 100%; }

/* ─── Keyboard Shortcut Hint ─────────────────────────────── */
.kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 5px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
}

/* ─── Currency Select ────────────────────────────────────── */
#currencySelect { appearance: none; }

/* ─── Select & Option Fix ────────────────────────────────── */
select.inp,
select.btn-ghost {
    color: inherit;
}
select option {
    background-color: #1e293b;
    color: #f1f5f9;
}
html.light select option {
    background-color: #ffffff;
    color: #0f172a;
}

/* ─── Date Group Label ───────────────────────────────────── */
.date-group-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 6px 0 4px;
}
/* ─── Type Filter Buttons ─────────────────────────────── */
.filter-btn {
  font-size: 10px; font-weight: 700;
  padding: 4px 10px; border-radius: 8px;
  cursor: pointer; border: 1px solid rgba(99,102,241,0.2);
  background: transparent; color: var(--text-muted);
  font-family: 'Sora', sans-serif; transition: all 0.2s;
}
.filter-btn.active {
  background: rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.5);
  color: #6366f1;
}
