/* ============================================================
   BillingPro — Custom CSS
   ============================================================ */

/* ── CSS Variables ── */
:root {
    --sidebar-width: 250px;
    --navbar-height: 56px;
    --sidebar-bg: #1a1d23;
    --sidebar-text: #ced4da;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
    --sidebar-active-bg: var(--brand-color, #0d6efd);
    --sidebar-active-text: #ffffff;
    --footer-height: 48px;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ── Base ── */
body {
    background-color: #f0f2f5;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Navbar ── */
.navbar {
    height: var(--navbar-height);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background-color: var(--sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1040;
    transition: transform 0.28s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.sidebar-header {
    padding: 1rem 1.25rem 0.5rem;
}

/* Sidebar nav list */
.sidebar-nav {
    padding: 0.25rem 0 1rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
    white-space: nowrap;
}
.sidebar-link i {
    font-size: 1.1rem;
    width: 1.4rem;
    text-align: center;
    flex-shrink: 0;
}
.sidebar-link:hover {
    background-color: var(--sidebar-hover-bg);
    color: #ffffff;
    border-left-color: rgba(255,255,255,0.3);
}
.sidebar-link.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-left-color: rgba(255,255,255,0.8);
}

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 0.5rem 1rem;
    list-style: none;
}

/* Sidebar section label */
.sidebar-section-label {
    padding: 0.75rem 1.25rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.35);
}

/* ── Main Content ── */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height) - var(--footer-height));
    padding: 1.75rem;
}

/* ── Footer ── */
.app-footer {
    margin-left: var(--sidebar-width);
    height: var(--footer-height);
    display: flex;
    align-items: center;
    padding: 0 1.75rem;
    border-top: 1px solid #dee2e6;
    background: #fff;
}

/* ── Flash container ── */
.flash-container {
    margin-bottom: 1rem;
}

/* ── Dashboard Stat Cards ── */
.stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: transform 0.18s, box-shadow 0.18s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}
.stat-card .card-body {
    padding: 1.25rem 1.5rem;
}
.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
    color: #1a1d23;
}
.stat-card .stat-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Icon background variants */
.icon-bg-primary   { background: rgba(13,110,253,0.12); color: #0d6efd; }
.icon-bg-success   { background: rgba(25,135,84,0.12);  color: #198754; }
.icon-bg-warning   { background: rgba(255,193,7,0.15);  color: #d39e00; }
.icon-bg-danger    { background: rgba(220,53,69,0.12);  color: #dc3545; }
.icon-bg-info      { background: rgba(13,202,240,0.12); color: #0dcaf0; }
.icon-bg-purple    { background: rgba(111,66,193,0.12); color: #6f42c1; }

/* ── General Card ── */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}
.card-header {
    border-radius: 12px 12px 0 0 !important;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    background: #fff;
    font-weight: 600;
}
.card.border-0 .card-header { background: transparent; }

/* ── Status Badges ── */
.badge-status-paid       { background-color: #198754; color: #fff; }
.badge-status-unpaid     { background-color: #ffc107; color: #212529; }
.badge-status-overdue    { background-color: #dc3545; color: #fff; }
.badge-status-draft      { background-color: #6c757d; color: #fff; }
.badge-status-cancelled  { background-color: #adb5bd; color: #212529; }
.badge-status-partial    { background-color: #0dcaf0; color: #212529; }
.badge-status-refunded   { background-color: #6f42c1; color: #fff; }
.badge-status-pending    { background-color: #fd7e14; color: #fff; }

/* ── Tables ── */
.table-card .table {
    margin-bottom: 0;
}
.table-card .table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
}

/* ── Quick Action Buttons ── */
.quick-actions .btn {
    border-radius: 10px;
    padding: 0.6rem 1rem;
    font-weight: 500;
}

/* ── Login Page ── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1d23 0%, #2d3748 50%, #1a365d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 16px;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.login-logo {
    width: 64px;
    height: 64px;
    background: var(--brand-color, #0d6efd);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
    margin-bottom: 1rem;
}

/* ── Chart container ── */
.chart-container {
    position: relative;
    height: 260px;
}

/* ── Sidebar Overlay (mobile) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1039;
}
.sidebar-overlay.show {
    display: block;
}

/* ── Responsive ── */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.35);
    }
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    .app-footer {
        margin-left: 0;
    }
}

@media (max-width: 575.98px) {
    .stat-card .stat-value {
        font-size: 1.3rem;
    }
}

/* ── Print styles ── */
@media print {
    .sidebar,
    .navbar,
    .app-footer,
    .quick-actions,
    .flash-container,
    .no-print {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        margin-top: 0 !important;
        padding: 0 !important;
    }
    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
    body {
        background: #fff !important;
        font-size: 12px;
    }
    table {
        font-size: 11px;
    }
    .invoice-header {
        border-bottom: 2px solid #000;
        margin-bottom: 1rem;
    }
    a[href]::after {
        content: none !important;
    }
}
