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

:root {
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --text-main: #1a1a1a;
    --text-muted: #6c757d;
    --primary: #0d6efd;
    --primary-hover: #0b5ed7;
    --success: #198754;
    --success-bg: #d1e7dd;
    --danger: #dc3545;
    --danger-bg: #f8d7da;
    --warning: #ffc107;
    --border: #e9ecef;
    --border-radius: 16px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 5px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
    --navbar-h: 64px;
}

[data-theme="dark"] {
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #909090;
    --border: #2e2e2e;
    --success-bg: #0d2d1a;
    --danger-bg: #2d0d0f;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 5px 20px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.6);
}
[data-theme="dark"] .badge-transfer { background: #1a2d50; }

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ==================== NAVBAR ==================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    height: var(--navbar-h);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 24px;
    gap: 16px;
    /* Escape the body padding so navbar is full-width */
    margin: -20px -20px 28px -20px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-main);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    margin-right: auto;
}
.nav-brand i { color: var(--primary); font-size: 1.35rem; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.nav-link:hover { background: var(--bg-body); color: var(--text-main); }
.nav-link.active { background: var(--bg-body); color: var(--primary); font-weight: 600; }
.nav-link-primary { background: var(--primary); color: white !important; }
.nav-link-primary:hover { background: var(--primary-hover) !important; color: white !important; }
.nav-link-danger { color: var(--danger) !important; }
.nav-link-danger:hover { background: var(--danger-bg) !important; }

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--text-main);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    line-height: 1;
}
.hamburger:hover { background: var(--bg-body); }

/* Mobile dropdown nav */
.nav-mobile {
    display: none;
    position: fixed;
    top: var(--navbar-h);
    left: 0; right: 0;
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    padding: 10px 12px 16px;
    z-index: 199;
    flex-direction: column;
    gap: 2px;
    animation: slideDown 0.18s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.nav-mobile.open { display: flex; }
.nav-mobile .nav-link { padding: 12px 14px; font-size: 0.95rem; border-radius: var(--radius-md); }

@media (max-width: 768px) {
    .nav-links { display: none; }
    .hamburger { display: flex; align-items: center; justify-content: center; }
}

/* ==================== LAYOUT ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Page header for inner pages */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
    flex-wrap: wrap;
}
.page-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}
.back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-body);
    color: var(--text-main);
    text-decoration: none;
    font-size: 1rem;
    transition: background 0.15s;
    flex-shrink: 0;
    border: 1.5px solid var(--border);
}
.back-btn:hover { background: var(--border); }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 10px;
}
.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
}

/* ==================== CARDS ==================== */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.card-static:hover {
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
}

/* ==================== GRIDS ==================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 700px) {
    .dashboard-grid,
    .grid-2,
    .grid-3 { grid-template-columns: 1fr; }
}

/* ==================== WIDGETS ==================== */
.widget-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    color: var(--text-muted);
}
.widget-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 6px 0 2px;
    line-height: 1.1;
}
.widget-sub {
    font-size: 0.85rem;
    margin-top: 4px;
    opacity: 0.85;
}

/* ==================== ACCOUNT CARDS ==================== */
.account-card { position: relative; overflow: hidden; }
.account-card .card-type {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    opacity: 0.8;
}
.account-card .balance {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 8px 0 2px;
    line-height: 1.1;
}

.progress-bar {
    width: 100%;
    height: 7px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 6px 0;
}
.progress-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--danger);
    transition: width 0.4s ease;
}
.progress-fill.ok { background: var(--success); }
.progress-fill.warn { background: var(--warning); }

/* ==================== TRANSACTIONS ==================== */
.transaction-list {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.transaction-item {
    display: flex;
    align-items: center;
    padding: 13px 20px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    transition: background 0.1s;
}
.transaction-item:last-child { border-bottom: none; }
.transaction-item:hover { background: var(--bg-body); }
.t-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.t-details { flex-grow: 1; min-width: 0; }
.t-title {
    font-weight: 600;
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.t-date { font-size: 0.78rem; color: var(--text-muted); }
.t-amount { font-weight: 700; font-size: 0.98rem; white-space: nowrap; }
.amount-pos { color: var(--success); }
.amount-neg { color: var(--danger); }

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1.3;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(13,110,253,0.3);
    color: white;
}
.btn-ghost { background: var(--bg-body); color: var(--text-main); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--border); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #157347; color: white; box-shadow: 0 4px 12px rgba(25,135,84,0.3); }
.btn-danger-soft { background: var(--danger-bg); color: var(--danger); }
.btn-danger-soft:hover { background: #f1aeb5; }
.btn-sm { padding: 5px 14px; font-size: 0.8rem; }
.btn-icon {
    width: 36px; height: 36px;
    padding: 0; border-radius: 50%;
    justify-content: center;
}

/* ==================== FAB ==================== */
.fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    height: 54px;
    padding: 0 22px;
    border-radius: 27px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    box-shadow: 0 4px 16px rgba(13,110,253,0.4);
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
    text-decoration: none;
}
.fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(13,110,253,0.5);
    color: white;
}
.fab:active { transform: translateY(0); }
.fab-text {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* ==================== MODALS ==================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 300;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}
@keyframes modalIn {
    from { transform: scale(0.95) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
    font-family: inherit;
}
.modal-close:hover { background: var(--bg-body); color: var(--text-main); }
.modal-body { padding: 18px 22px 22px; }

/* ==================== FORMS ==================== */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 6px;
    color: var(--text-main);
}
.form-control {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.93rem;
    background: var(--bg-body);
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    appearance: none;
}
.form-control::placeholder { color: #adb5bd; }
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13,110,253,0.12);
    background: var(--bg-card);
}
select.form-control { cursor: pointer; }

/* ==================== FILTER + SEARCH BAR ==================== */
.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--bg-card);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.filter-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.filter-select {
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    background: var(--bg-body);
    color: var(--text-main);
    cursor: pointer;
    outline: none;
}
.filter-select:focus { border-color: var(--primary); }

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 180px;
}
.search-wrap i {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}
.search-input {
    width: 100%;
    padding: 7px 12px 7px 32px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    background: var(--bg-body);
    color: var(--text-main);
    outline: none;
}
.search-input:focus { border-color: var(--primary); }

/* ==================== BADGES ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.badge-income { background: var(--success-bg); color: var(--success); }
.badge-expense { background: var(--danger-bg); color: var(--danger); }
.badge-transfer { background: #dde8ff; color: var(--primary); }

/* ==================== MISC ==================== */
.divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-primary { color: var(--primary) !important; }

.empty-state {
    padding: 50px 20px;
    text-align: center;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 2.5rem;
    opacity: 0.25;
    margin-bottom: 10px;
    display: block;
}

/* Utility: no hover lift on static cards */
.no-hover:hover { transform: none !important; box-shadow: var(--shadow-sm) !important; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.7s linear infinite; display: inline-block; }

/* ==================== THEME TOGGLE ==================== */
.btn-theme-toggle {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1rem;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.btn-theme-toggle:hover { background: var(--bg-body); color: var(--text-main); }

.btn-theme-float {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 999;
    background: var(--bg-card) !important;
    box-shadow: var(--shadow-md);
}
