﻿/* ============================================
   SỔ TIẾT KIỆM - MAIN STYLESHEET
   ============================================ */

:root {
    --sidebar-width: 240px;
    --topbar-height: 56px;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar-bg: #0f172a;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #2563eb;
    --card-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
}

/* ---- BASE ---- */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
}

    body.login-page {
        background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }

/* ---- SIDEBAR ---- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform .25s ease;
}

.sidebar-brand {
    padding: 1.25rem 1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

    .sidebar-brand i {
        font-size: 1.5rem;
        color: #60a5fa;
    }

.sidebar-user {
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: .5rem;
}

    .sidebar-user .avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: var(--primary);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        flex-shrink: 0;
    }

    .sidebar-user .user-name {
        font-size: .85rem;
        font-weight: 600;
        color: #f1f5f9;
    }

.sidebar-nav {
    padding: 0 .5rem .5rem;
    flex: 1;
}

    .sidebar-nav .nav-link {
        color: var(--sidebar-text);
        border-radius: 6px;
        padding: .55rem .85rem;
        font-size: .88rem;
        display: flex;
        align-items: center;
        gap: .55rem;
        transition: all .15s;
    }

        .sidebar-nav .nav-link i {
            width: 1.2rem;
            text-align: center;
            font-size: 1rem;
        }

        .sidebar-nav .nav-link:hover {
            background: rgba(255,255,255,.07);
            color: #fff;
        }

        .sidebar-nav .nav-link.active {
            background: var(--sidebar-active);
            color: #fff;
        }

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,.08);
    margin: .5rem .35rem;
}

.notif-badge {
    background: #ef4444;
    color: #fff;
    font-size: .65rem;
    border-radius: 10px;
    padding: .1rem .35rem;
    min-width: 18px;
    text-align: center;
    margin-left: auto;
}

/* ---- MAIN CONTENT ---- */
body.has-sidebar .main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* ---- TOPBAR ---- */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
}

.realtime-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: .4;
    }
}

/* ---- PAGE CONTENT ---- */
.page-content {
    padding: 1.5rem;
}

/* ---- CARDS ---- */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: .8rem 1rem;
}

/* ---- STAT CARDS ---- */
.stat-card {
    border-radius: 12px;
    padding: 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.stat-blue {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
}

.stat-green {
    background: linear-gradient(135deg, #059669, #10b981);
}

.stat-purple {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
}

.stat-orange {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

.stat-icon {
    font-size: 2rem;
    opacity: .8;
}

.stat-label {
    font-size: .78rem;
    opacity: .85;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-sub {
    font-size: .75rem;
    opacity: .8;
    margin-top: .15rem;
}

/* ---- BALANCE DISPLAY ---- */
.so-balance {
    text-align: center;
    padding: 1rem 0;
}

.balance-label {
    font-size: .8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.balance-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

.balance-unit {
    font-size: .9rem;
    color: #64748b;
}

/* ---- INFO TABLE ---- */
.info-table th {
    width: 40%;
    font-weight: 500;
    color: #64748b;
    font-size: .85rem;
}

.info-table td {
    font-size: .85rem;
}

/* ---- BADGES ---- */
.badge {
    font-weight: 500;
}

/* ---- LOGIN ---- */
.login-container {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.login-brand {
    text-align: center;
    color: #fff;
    margin-bottom: 2rem;
}

    .login-brand i {
        font-size: 3rem;
        color: #60a5fa;
        display: block;
        margin-bottom: .5rem;
    }

    .login-brand h1 {
        font-size: 1.6rem;
        font-weight: 700;
        margin: 0;
    }

    .login-brand p {
        color: #94a3b8;
        font-size: .9rem;
        margin: .25rem 0 0;
    }

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0,0,0,.2);
}

/* ---- TOAST ---- */
.toast-custom {
    min-width: 280px;
    border-radius: 8px;
    padding: .75rem 1rem;
    color: #fff;
    font-size: .88rem;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    animation: slideIn .3s ease;
}

.toast-success {
    background: #059669;
}

.toast-info {
    background: #2563eb;
}

.toast-warning {
    background: #d97706;
}

.toast-danger {
    background: #dc2626;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

        .sidebar.open {
            transform: translateX(0);
        }

    body.has-sidebar .main-content {
        margin-left: 0;
    }

    .page-content {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.3rem;
    }
}

/* ---- UTILITIES ---- */
.table th {
    font-weight: 600;
    font-size: .83rem;
}

.table td {
    font-size: .87rem;
    vertical-align: middle;
}

.breadcrumb {
    font-size: .83rem;
}

.font-monospace {
    font-size: .78rem;
}
