/* ========================================
   Quản lý Điện Nước - Custom Styles
   Bootstrap 5 supplement
   ======================================== */

:root {
    --sidebar-w: 260px;
    --sidebar-bg: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    --topbar-h: 60px;
    --primary: #6366f1;
    --primary-light: #818cf8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
}

* { font-family: 'Tahoma', Geneva, sans-serif; }

body { background: #f1f5f9; min-height: 100vh; }

/* ---- Login Page ---- */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container { width: 100%; max-width: 420px; padding: 1rem; }

.login-card {
    background: #fff; border-radius: 16px; padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-header { text-align: center; margin-bottom: 2rem; }

.login-icon {
    width: 70px; height: 70px; border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem; font-size: 2rem; color: #fff;
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
}

.login-header h2 { font-size: 1.5rem; font-weight: 700; color: #1e293b; }

/* ---- App Layout ---- */
.app-wrapper { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w); background: var(--sidebar-bg);
    color: #cbd5e1; display: flex; flex-direction: column;
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.25rem 1.5rem; display: flex;
    align-items: center; justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header h4 { font-size: 1.1rem; font-weight: 700; color: #fff; }

.sidebar-nav { list-style: none; padding: 0.75rem 0; margin: 0; flex: 1; }

.sidebar-nav li a {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1.5rem; color: #94a3b8;
    text-decoration: none; font-size: 0.9rem;
    transition: all 0.2s ease; border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background: rgba(255,255,255,0.05); color: #fff;
    border-left-color: rgba(255,255,255,0.2);
}

.sidebar-nav li.active a {
    background: rgba(99, 102, 241, 0.15); color: #818cf8;
    border-left-color: #6366f1; font-weight: 600;
}

.sidebar-nav li a i { font-size: 1.1rem; width: 1.25rem; text-align: center; }

.sidebar-divider {
    height: 1px; margin: 0.5rem 1.5rem;
    background: rgba(255,255,255,0.08);
}

/* ---- Main Content ---- */
.main-content {
    flex: 1; margin-left: var(--sidebar-w);
    display: flex; flex-direction: column;
}

.top-bar {
    height: var(--topbar-h); padding: 0 1.5rem;
    display: flex; align-items: center;
    background: #fff; border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.page-title { font-weight: 600; color: #334155; }

.content-area { padding: 1.5rem; flex: 1; }

/* ---- Stat Cards ---- */
.stat-card {
    background: #fff; border-radius: 12px; padding: 1.25rem;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative; overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0;
    width: 4px; height: 100%;
}

.stat-card-primary::before { background: var(--primary); }
.stat-card-success::before { background: var(--success); }
.stat-card-warning::before { background: var(--warning); }
.stat-card-info::before { background: var(--info); }

.stat-icon {
    font-size: 1.5rem; margin-bottom: 0.5rem;
    opacity: 0.7;
}

.stat-card-primary .stat-icon { color: var(--primary); }
.stat-card-success .stat-icon { color: var(--success); }
.stat-card-warning .stat-icon { color: var(--warning); }
.stat-card-info .stat-icon { color: var(--info); }

.stat-value { font-size: 1.25rem; font-weight: 700; color: #1e293b; }
.stat-label { font-size: 0.78rem; color: #64748b; margin-top: 0.25rem; }

/* ---- Tables ---- */
.table-summary thead th {
    background: #f8fafc; color: #475569;
    font-size: 0.8rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.03em;
    border-bottom: 2px solid #e2e8f0;
    padding: 0.75rem;
    white-space: nowrap;
}

.table-summary tbody td { 
    padding: 0.75rem; vertical-align: middle;
    font-size: 0.9rem;
}

.table-summary tfoot td { padding: 0.75rem; }

/* ---- Cards ---- */
.card { border-radius: 12px; border: 1px solid #e2e8f0; }
.card-header { border-bottom: 1px solid #f1f5f9; padding: 1rem 1.25rem; }

.cycle-card { transition: transform 0.2s, box-shadow 0.2s; }
.cycle-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.08); }

.payment-card { transition: all 0.3s ease; }
.payment-card.border-success { border-left: 4px solid var(--success) !important; }
.payment-card.border-warning { border-left: 4px solid var(--warning) !important; }

/* ---- Payment Toggle ---- */
.payment-toggle {
    transition: all 0.3s ease;
    min-width: 100px; font-size: 0.8rem;
}

/* ---- Meter Input ---- */
.meter-input {
    max-width: 140px;
    display: inline-block;
}

/* ---- Responsive Mobile ---- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .stat-value { font-size: 1rem; }
}

@media (max-width: 575.98px) {
    .content-area { padding: 1rem; }
    .stat-card { padding: 1rem; }
    .table-summary { font-size: 0.8rem; }
    .meter-input { max-width: 100px; }
    .payment-toggle { min-width: 80px; font-size: 0.75rem; }
}

/* ---- Animations ---- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card, .stat-card {
    animation: fadeIn 0.3s ease-out;
}

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

/* ---- Utilities ---- */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hide number input spinners */
.meter-input::-webkit-outer-spin-button,
.meter-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
