﻿:root {
    --ft-primary: #1a1a2e;
    --ft-accent: #4f8ef7;
    --ft-accent2: #22d3a5;
    --ft-danger: #f75f5f;
    --ft-warning: #f7b731;
    --ft-surface: #f4f6fb;
    --ft-card: #ffffff;
    --ft-border: #e3e8f0;
    --ft-muted: #7b8db0;
}

body {
    background: var(--ft-surface);
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* ---- Sidebar ---- */
.sidebar {
    width: 240px;
    min-height: 100vh;
    background: var(--ft-primary);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform .3s;
    overflow-y: auto;
}

.sidebar-logo {
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.5px;
}

    .sidebar-logo span {
        color: var(--ft-accent2);
    }

.sidebar-nav .nav-link {
    color: #b0c4de;
    border-radius: 10px;
    padding: .65rem 1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .95rem;
    font-weight: 500;
    transition: all .15s;
}

    .sidebar-nav .nav-link:hover,
    .sidebar-nav .nav-link.active {
        background: rgba(79,142,247,.13);
        color: #fff;
    }

    .sidebar-nav .nav-link.active {
        color: var(--ft-accent);
    }

    .sidebar-nav .nav-link i {
        font-size: 1.1rem;
    }

.sidebar-bottom {
    border-top: 1px solid rgba(255,255,255,.08);
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--ft-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
    color: #fff;
    flex-shrink: 0;
}

/* ---- Main content ---- */
.main-content {
    margin-left: 240px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

/* ---- Mobile topbar ---- */
.topbar {
    background: var(--ft-primary);
    position: sticky;
    top: 0;
    z-index: 98;
}

.topbar-logo {
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
}

    .topbar-logo span {
        color: var(--ft-accent2);
    }

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
}

    .overlay.open {
        display: block;
    }

/* ---- Auth ---- */

/* Highlight selected theme */
.theme-option input:checked + div {
    border: 3px solid #0d6efd !important; /* Bootstrap primary */
    box-shadow: 0 0 0 .25rem rgba(13,110,253,.25); /* Bootstrap glow */
    transform: scale(1.03);
    transition: .2s ease;
}

/* Smooth hover */
.theme-option div {
    transition: .2s ease;
}

.theme-option:hover div {
    transform: scale(1.02);
}

.auth-bg {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
}

.auth-card {
    background: #fff;
    border-radius: 20px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 64px rgba(0,0,0,.18);
}

.auth-logo {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--ft-accent);
}

    .auth-logo span {
        color: var(--ft-accent2);
    }

.auth-card .form-control {
    border-radius: 10px;
    border: 1.5px solid var(--ft-border);
    padding: .75rem 1rem;
}

    .auth-card .form-control:focus {
        border-color: var(--ft-accent);
        box-shadow: 0 0 0 3px rgba(79,142,247,.13);
    }

.btn-primary-ft {
    background: var(--ft-accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: .75rem 1.5rem;
    font-weight: 600;
    width: 100%;
    font-size: 1rem;
    transition: background .2s, transform .1s;
    display: block;
    text-align: center;
}

    .btn-primary-ft:hover {
        background: #2d6fd6;
        transform: translateY(-1px);
    }

.auth-switch {
    color: var(--ft-muted);
    font-size: .9rem;
}

    .auth-switch a {
        color: var(--ft-accent);
        text-decoration: none;
        font-weight: 600;
    }

/* ---- Stat Cards ---- */
.stat-card {
    background: var(--ft-card);
    border-radius: 16px;
    border: 1px solid var(--ft-border);
    padding: 1.25rem 1.5rem;
}

.stat-label {
    font-size: .78rem;
    color: var(--ft-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
}

.stat-sub {
    font-size: .82rem;
    color: var(--ft-muted);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: .5rem;
}

/* ---- Chart Cards ---- */
.chart-card {
    background: var(--ft-card);
    border-radius: 16px;
    border: 1px solid var(--ft-border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* ---- Expense Table ---- */
.expense-card {
    background: var(--ft-card);
    border-radius: 16px;
    border: 1px solid var(--ft-border);
    overflow: hidden;
}

    .expense-card .table th {
        font-size: .78rem;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: var(--ft-muted);
        background: #f9fafd;
        border-bottom: 1px solid var(--ft-border);
    }

    .expense-card .table td {
        vertical-align: middle;
        font-size: .92rem;
    }

/* ---- Category badges ---- */
.cat-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .3rem .75rem;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 600;
}

.cat-food {
    background: #fff3e0;
    color: #e65100;
}

.cat-transport {
    background: #e3f2fd;
    color: #1565c0;
}

.cat-housing {
    background: #fce4ec;
    color: #880e4f;
}

.cat-entertainment {
    background: #f3e5f5;
    color: #6a1b9a;
}

.cat-health {
    background: #e8f5e9;
    color: #1b5e20;
}

.cat-shopping {
    background: #fff8e1;
    color: #f57f17;
}

.cat-utilities {
    background: #e0f7fa;
    color: #006064;
}

.cat-other {
    background: #f5f5f5;
    color: #424242;
}

/* ---- Forms ---- */
.add-form-card {
    background: var(--ft-card);
    border-radius: 16px;
    border: 1px solid var(--ft-border);
    padding: 1.5rem;
}

    .add-form-card .form-control,
    .add-form-card .form-select {
        border-radius: 10px;
        border: 1.5px solid var(--ft-border);
    }

        .add-form-card .form-control:focus,
        .add-form-card .form-select:focus {
            border-color: var(--ft-accent);
            box-shadow: 0 0 0 3px rgba(79,142,247,.12);
        }

.btn-add {
    background: var(--ft-accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: .65rem 1.5rem;
    font-weight: 600;
}

    .btn-add:hover {
        background: #2d6fd6;
        color: #fff;
    }

.btn-danger-sm {
    background: var(--ft-danger);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: .2rem .6rem;
    font-size: .8rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--ft-muted);
}

/* ---- Responsive ---- */
@media (max-width: 767.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

        .sidebar.open {
            transform: translateX(0);
            z-index: 101;
        }

    .main-content {
        margin-left: 0;
        padding: 1rem !important;
    }
}



/* ============================================================
   DARK MODE
   ============================================================ */
html.dark-mode {
    --ft-surface: #0f0f1e;
    --ft-card: #1a1a2e;
    --ft-border: #2a2a45;
    --ft-text: #e2e8f0;
    --ft-muted: #7b8db0;
}

    /* Body & background */
    html.dark-mode body {
        background: #0f0f1e;
        color: #e2e8f0;
    }

    /* Cards */
    html.dark-mode .chart-card,
    html.dark-mode .stat-card,
    html.dark-mode .add-form-card,
    html.dark-mode .expense-card {
        background: #1a1a2e;
        border-color: #2a2a45;
        color: #e2e8f0;
    }

        /* Table */
        html.dark-mode .expense-card .table {
            color: #e2e8f0;
        }

            html.dark-mode .expense-card .table th {
                background: #16213e;
                color: #7b8db0;
                border-color: #2a2a45;
            }

            html.dark-mode .expense-card .table td {
                border-color: #2a2a45;
            }

        html.dark-mode .expense-card .table-hover tbody tr:hover {
            background: rgba(79,142,247,.07);
            color: #e2e8f0;
        }

    /* Forms */
    html.dark-mode .form-control,
    html.dark-mode .form-select {
        background: #16213e;
        border-color: #2a2a45;
        color: #e2e8f0;
    }

        html.dark-mode .form-control:focus,
        html.dark-mode .form-select:focus {
            background: #16213e;
            border-color: #4f8ef7;
            color: #e2e8f0;
            box-shadow: 0 0 0 3px rgba(79,142,247,.15);
        }

        html.dark-mode .form-control::placeholder {
            color: #4a5568;
        }

        html.dark-mode .form-control:disabled,
        html.dark-mode .form-control[readonly] {
            background: #0f0f1e;
            color: #4a5568;
        }

    /* Input group text */
    html.dark-mode .input-group-text {
        background: #16213e;
        border-color: #2a2a45;
        color: #7b8db0;
    }

    /* Main content area */
    html.dark-mode .main-content {
        background: #0f0f1e;
    }

    /* Page title */
    html.dark-mode .page-title {
        color: #e2e8f0;
    }

    /* Text utilities */
    html.dark-mode .text-muted {
        color: #7b8db0 !important;
    }

    html.dark-mode .fw-semibold,
    html.dark-mode .fw-bold,
    html.dark-mode h1,
    html.dark-mode h2,
    html.dark-mode h3,
    html.dark-mode h4,
    html.dark-mode h5,
    html.dark-mode h6 {
        color: #e2e8f0;
    }

    /* Alerts */
    html.dark-mode .alert-success {
        background: rgba(34,211,165,.1);
        border-color: rgba(34,211,165,.25);
        color: #22d3a5;
    }

    html.dark-mode .alert-danger {
        background: rgba(247,95,95,.1);
        border-color: rgba(247,95,95,.25);
        color: #f75f5f;
    }

    /* Progress bars */
    html.dark-mode .progress {
        background: #2a2a45;
    }

    /* Stat icon backgrounds */
    html.dark-mode .stat-icon {
        opacity: .85;
    }

    /* Nav pills (tabs) */
    html.dark-mode .nav-pills .nav-link {
        color: #7b8db0;
    }

        html.dark-mode .nav-pills .nav-link.active {
            background: #4f8ef7;
            color: #fff;
        }

        html.dark-mode .nav-pills .nav-link:hover:not(.active) {
            background: rgba(79,142,247,.1);
            color: #e2e8f0;
        }

    /* Filter selects on expense page */
    html.dark-mode .form-select-sm {
        background: #16213e;
        border-color: #2a2a45;
        color: #e2e8f0;
    }

    /* Month input */
    html.dark-mode input[type="month"],
    html.dark-mode input[type="date"] {
        background: #16213e;
        border-color: #2a2a45;
        color: #e2e8f0;
    }

    /* Sidebar stays dark always — no change needed */

    /* Mobile topbar */
    html.dark-mode .topbar {
        background: #0a0a1a;
    }

/* Theme toggle button in sidebar */
.theme-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1rem;
    border-radius: 10px;
    color: #b0c4de;
    font-size: .95rem;
    font-weight: 500;
    transition: all .15s;
    margin: 2px 10px;
    width: calc(100% - 20px);
}

    .theme-toggle-btn:hover {
        background: rgba(79,142,247,.13);
        color: #fff;
    }

    .theme-toggle-btn i {
        font-size: 1.1rem;
    }