﻿/* Header */
.custom-navbar {
    background: linear-gradient(135deg, #0469B8, #0b84e8);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 999;
    border-bottom: 2px solid #0A82D8;
}

.navbar-logo {
    background: none;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4)) drop-shadow(0 0 4px rgba(255,255,255,0.3));
    height: 32px;
    margin-right: 8px;
}

.navbar-title {
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.main-content {
    flex: 1; /* grows to fill space */
    margin-left: 260px;
    margin-top: 60px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 0; /* prevents overflow issues */
}

    .main-content > *:not(.erp-footer) {
        flex: 1; /* body stretches */
        min-height: 0; /* prevents overflow issues */
    }
.erp-footer {
    background: white;
    padding: 12px 20px;
    text-align: center;
    border-top: 1px solid #ddd;
    font-size: 12px;
    color: #666;
    flex-shrink: 0; /* footer never shrinks or overlaps */
}

/* =========================================
   BODY
========================================= */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #f4f6f9;
}


/* =========================================
   HAMBURGER DRAWER
========================================= */
.menu-drawer {
    position: fixed;
    top: 0;
    right: -260px;
    width: 260px;
    height: 100%;
    background-color: #0469B8;
    box-shadow: -2px 0 8px rgba(0,0,0,.3);
    transition: .3s;
    z-index: 2000;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

    .menu-drawer.open {
        right: 0;
    }

    .menu-drawer a {
        color: white;
        text-decoration: none;
        padding: 8px;
        border-radius: 6px;
    }

        .menu-drawer a:hover {
            background: rgba(255,255,255,.15);
        }

    .menu-drawer .close-btn {
        align-self: flex-end;
        color: white;
        cursor: pointer;
        font-size: 24px;
    }

/* =========================================
   SIDEBAR
========================================= */
.erp-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 1rem 0;
}

    .erp-sidebar .nav-link {
        padding: 0.5rem 1rem;
        color: #333;
        border-radius: 0.25rem;
        transition: all 0.2s;
    }

        .erp-sidebar .nav-link:hover {
            background-color: #e9ecef;
        }

        .erp-sidebar .nav-link.active {
            background-color: #0d6efd;
            color: white;
        }

    .erp-sidebar .section-title {
        font-size: 11px;
        font-weight: 700;
        color: #6c757d;
        letter-spacing: 1px;
        text-transform: uppercase;
        padding: 12px 15px 4px;
        border-bottom: 1px solid #dee2e6;
        margin-top: 0.5rem;
    }

        .erp-sidebar .section-title.restricted {
            opacity: 0.6;
        }

    .erp-sidebar .nav-link.ms-3 {
        padding-left: 2rem;
    }

    .erp-sidebar .collapse {
        margin-bottom: 0.5rem;
    }

/* =========================================
   MODERN SIDEBAR
========================================= */
.modern-sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    width: 260px;
    height: calc(100vh - 60px);
    background: #1a1e2b;
    overflow: hidden;
    z-index: 1040;
    display: flex;
    flex-direction: column;
}

    .modern-sidebar .sidebar-search {
        padding: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        margin-bottom: 8px;
        flex-shrink: 0;
    }

    .modern-sidebar .theme-switcher {
        display: flex;
        gap: 8px;
        padding: 12px 16px;
        margin: 0 8px 12px 8px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 12px;
        flex-shrink: 0;
    }

    .modern-sidebar .sidebar-menu-items {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        padding-bottom: 20px;
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.1);
    }

        .modern-sidebar .sidebar-menu-items::-webkit-scrollbar {
            width: 4px;
        }

        .modern-sidebar .sidebar-menu-items::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 4px;
        }

        .modern-sidebar .sidebar-menu-items::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.3);
            border-radius: 4px;
        }

            .modern-sidebar .sidebar-menu-items::-webkit-scrollbar-thumb:hover {
                background: rgba(255, 255, 255, 0.5);
            }

    .modern-sidebar .module-item.disabled-module {
        opacity: 0.65;
    }

    .modern-sidebar .module-trigger.disabled-module {
        cursor: not-allowed !important;
    }

        .modern-sidebar .module-trigger.disabled-module:hover {
            background: transparent !important;
            color: #e0e0e0 !important;
        }

        .modern-sidebar .module-trigger.disabled-module .module-name {
            color: #8e95a9;
        }

    .modern-sidebar .module-item.disabled-module:hover::after {
        content: "⛔ Access Denied";
        position: fixed;
        left: 280px;
        background: #dc3545;
        color: white;
        padding: 4px 10px;
        border-radius: 6px;
        font-size: 11px;
        white-space: nowrap;
        z-index: 1100;
        pointer-events: none;
    }

/* =========================================
   CARDS
========================================= */
.erp-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}

.dashboard-card {
    background: linear-gradient(135deg,#0469B8,#0b84e8);
    color: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.dashboard-title {
    font-size: 12px;
}

.dashboard-value {
    font-size: 24px;
    font-weight: bold;
}

/* =========================================
   TABLES
========================================= */
.table-container {
    max-height: calc(100vh - 280px);
    overflow: auto;
    border: 1px solid #dee2e6;
    border-radius: 10px;
}

.table-sticky {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 100%;
}

    .table-sticky thead th {
        position: sticky;
        top: 0;
        background: #0469B8;
        color: white;
        z-index: 100;
        white-space: nowrap;
    }

.table td {
    vertical-align: middle;
}

/* Remove zebra striping */
.table tbody tr:nth-child(odd) {
    background-color: transparent !important;
}

/* Keep total line highlighted */
.table-secondary {
    background-color: #f0f0f0 !important;
    font-weight: bold;
}

/* =========================================
   STICKY COLUMNS
========================================= */
tbody td.sticky-col-1 {
    position: sticky;
    left: 0;
    background: white;
    z-index: 20;
    min-width: 100px;
}

tbody td.sticky-col-2 {
    position: sticky;
    left: 100px;
    background: white;
    z-index: 20;
    min-width: 300px;
    border-right: 2px solid #adb5bd;
}

thead th.sticky-col-1 {
    left: 0;
    z-index: 200;
}

thead th.sticky-col-2 {
    left: 100px;
    z-index: 200;
}

/* =========================================
   LEDGER
========================================= */
.ledger-table td:nth-child(3) {
    min-width: 450px;
    max-width: 600px;
    white-space: normal;
    word-break: break-word;
}

.ledger-table td:nth-child(4),
.ledger-table td:nth-child(5),
.ledger-table td:nth-child(6) {
    white-space: nowrap;
    font-family: Consolas;
}

.ledger-table tbody td.sticky-col-Voucher,
.ledger-table thead th.sticky-col-Voucher {
    min-width: 100px;
    left: 0;
}

.ledger-table tbody td.sticky-col-Date,
.ledger-table thead th.sticky-col-Date {
    min-width: 100px;
    left: 100px;
}

.ledger-table thead th.sticky-col-Voucher {
    left: 0;
    min-width: 80px;
}

.ledger-table thead th.sticky-col-Date {
    left: 80px;
    min-width: 80px;
}

.table-sticky.ledger-table {
    width: 100%;
    min-width: 100%;
}

.ledger-table thead th {
    position: sticky;
    top: 0;
    background: #0469B8;
    color: white;
    z-index: 150;
    white-space: nowrap;
}

.ledger-table td:nth-child(2),
.ledger-table th:nth-child(2) {
    min-width: 140px;
    max-width: 160px;
    white-space: nowrap;
}

/* =========================================
   ROW COLORS
========================================= */
.parent-row {
    background: #fff3cd !important;
    color: brown;
    font-weight: bold;
}

    .parent-row td.sticky-col-1,
    .parent-row td.sticky-col-2 {
        background: #fff3cd !important;
    }

.subgroup-row {
    background: #eef5ff;
    color: #0469B8;
    font-weight: 600;
}

    .subgroup-row td.sticky-col-1,
    .subgroup-row td.sticky-col-2 {
        background: #eef5ff !important;
    }

.child-row {
    background: white;
}

/* =========================================
   VOUCHER
========================================= */
.voucher-container {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

    .voucher-container .table-container {
        width: 100%;
        min-width: 100%;
        border-radius: 10px;
        overflow-x: auto;
    }

    .voucher-container .ledger-table {
        width: 100%;
        min-width: 100%;
    }

    .voucher-container h4 {
        color: #0469B8;
        text-shadow: 0 1px 2px rgba(0,0,0,.1);
    }

    .voucher-container small {
        font-weight: 600;
    }

.voucher-title-card {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    text-align: center;
    background: linear-gradient(90deg, #4e73df, #1cc88a);
}

    .voucher-title-card:has(h4:contains("Payment")) {
        background: linear-gradient(90deg, #dc3545, #ff6b6b);
    }

    .voucher-title-card:has(h4:contains("Receipt")) {
        background: linear-gradient(90deg, #28a745, #6fdc8c);
    }

    .voucher-title-card:has(h4:contains("Credit")) {
        background: linear-gradient(90deg, #007bff, #6cb2eb);
    }

/* =========================================
   NUMBERS
========================================= */
.text-end,
.tb-money {
    font-family: Consolas;
    white-space: nowrap;
}

/* =========================================
   LOADER
========================================= */
.Loader {
    display: none;
    margin-top: 10px;
    text-align: center;
}

/* =========================================
   MISC
========================================= */
.erp-main-container {
    padding-top: 10px;
    padding-bottom: 40px;
}

.erp-body {
    height: calc(100vh - 70px);
    overflow-y: auto;
    overflow-x: auto;
}

.criteria-panel {
    position: sticky;
    top: 10px;
}

    .criteria-panel hr {
        border: 0;
        border-top: 2px solid #dee2e6;
        opacity: 0.8;
    }

.bg-gradient-primary {
    background: linear-gradient(90deg, #0469B8, #0b84e8);
    color: #fff;
}

.table-dark {
    background-color: #000 !important;
    color: #fff !important;
}

.description-cell {
    max-width: 400px;
    min-height: 3em;
    line-height: 1.5em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    white-space: normal;
}

.meta-line {
    white-space: nowrap;
    font-size: 12pt;
    margin-bottom: 0.5rem;
}

@media print {
    .meta-line {
        display: flex;
        justify-content: space-between;
        border-bottom: 1px solid #ccc;
        padding-bottom: 4px;
    }
}

.bg-gradient {
    background: linear-gradient(90deg, #4e73df, #1cc88a);
    border-radius: 6px;
    display: inline-block;
}

.right-panel .card {
    background-image: url('/images/bg-office-tiny.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    backdrop-filter: blur(3px);
    border-radius: 20px;
}

.login-page {
    background-color: #f5f5f5;
}

    .login-page .card {
        background-color: #ffffff;
        border-radius: 20px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    }

/* =========================================
   DASHBOARD
========================================= */
.dashboard-page {
    display: flex;
    height: calc(100vh - 60px - 38px);
    background: #f0f2f5;
    margin-left: 0px;
    overflow: hidden;
    padding-left: 0;
}

.dashboard-sidebar {
    width: 220px;
    min-width: 220px;
    background: #ffffff;
    border-right: 1px solid #e9ecef;
    overflow-y: auto;
    padding: 16px 0;
    box-shadow: 2px 0 8px rgba(0,0,0,0.04);
    height: 100%;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

    .dashboard-sidebar::-webkit-scrollbar {
        width: 4px;
    }

    .dashboard-sidebar::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .dashboard-sidebar::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 4px;
    }

        .dashboard-sidebar::-webkit-scrollbar-thumb:hover {
            background: #a8a8a8;
        }

    .dashboard-sidebar .sidebar-header {
        padding: 0 20px 16px 20px;
        border-bottom: 1px solid #e9ecef;
        margin-bottom: 8px;
    }

        .dashboard-sidebar .sidebar-header h6 {
            font-weight: 700;
            color: #1a1e2b;
            margin: 0;
            font-size: 13px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

            .dashboard-sidebar .sidebar-header h6 i {
                margin-right: 8px;
                color: #0d6efd;
            }

        .dashboard-sidebar .sidebar-header small {
            color: #6c757d;
            font-size: 11px;
            display: block;
            margin-top: 4px;
        }

    .dashboard-sidebar .category-heading {
        padding: 10px 20px;
        margin: 8px 0 4px 0;
        background: #1a1e2b;
        color: #ffffff;
        font-size: 13px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

        .dashboard-sidebar .category-heading i {
            margin-right: 8px;
            font-size: 14px;
        }

        .dashboard-sidebar .category-heading .category-badge {
            background: rgba(255,255,255,0.2);
            padding: 2px 10px;
            border-radius: 12px;
            font-size: 10px;
            font-weight: 400;
        }

    .dashboard-sidebar .option-item {
        display: flex;
        align-items: center;
        padding: 5px 14px 5px 28px;
        cursor: pointer;
        transition: all 0.2s;
        border-left: 3px solid transparent;
        position: relative;
        font-size: 13px;
        color: #4a5568;
        margin: 1px 0;
    }

        .dashboard-sidebar .option-item:hover {
            background: #f8f9fa;
            color: #0d6efd;
        }

        .dashboard-sidebar .option-item.active {
            background: #e3f2fd;
            color: #0d6efd;
            border-left-color: #0d6efd;
            font-weight: 500;
        }

        .dashboard-sidebar .option-item input[type="radio"] {
            position: absolute;
            opacity: 0;
            width: 0;
            height: 0;
        }

        .dashboard-sidebar .option-item .radio-custom {
            width: 16px;
            height: 16px;
            border: 2px solid #cbd5e0;
            border-radius: 50%;
            margin-right: 12px;
            position: relative;
            flex-shrink: 0;
            transition: all 0.2s;
        }

        .dashboard-sidebar .option-item.active .radio-custom {
            border-color: #0d6efd;
        }

            .dashboard-sidebar .option-item.active .radio-custom::after {
                content: '';
                position: absolute;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
                width: 8px;
                height: 8px;
                background: #0d6efd;
                border-radius: 50%;
            }

        .dashboard-sidebar .option-item .option-icon {
            margin-right: 8px;
            font-size: 14px;
            opacity: 0.6;
        }

        .dashboard-sidebar .option-item.active .option-icon {
            opacity: 1;
        }

.dashboard-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: #f0f2f5;
}

    .dashboard-content::-webkit-scrollbar {
        width: 6px;
    }

    .dashboard-content::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .dashboard-content::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 4px;
    }

        .dashboard-content::-webkit-scrollbar-thumb:hover {
            background: #a8a8a8;
        }

    .dashboard-content .chart-container {
        background: #ffffff;
        border-radius: 16px;
        padding: 24px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        height: calc(100vh - 60px - 38px - 48px);
        display: flex;
        flex-direction: column;
    }

        .dashboard-content .chart-container .chart-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            flex-shrink: 0;
        }

            .dashboard-content .chart-container .chart-header h4 {
                margin: 0;
                font-weight: 600;
                color: #1a1e2b;
                font-size: 18px;
            }

            .dashboard-content .chart-container .chart-header .chart-actions {
                display: flex;
                gap: 8px;
            }

            .dashboard-content .chart-container .chart-header .btn-icon {
                width: 32px;
                height: 32px;
                padding: 0;
                border: 1px solid #e9ecef;
                border-radius: 8px;
                background: white;
                color: #6c757d;
                transition: all 0.2s;
                display: flex;
                align-items: center;
                justify-content: center;
                cursor: pointer;
            }

                .dashboard-content .chart-container .chart-header .btn-icon:hover {
                    background: #f8f9fa;
                    border-color: #0d6efd;
                    color: #0d6efd;
                }

    .dashboard-content .chart-wrapper {
        flex: 1;
        position: relative;
        min-height: 0;
    }

        .dashboard-content .chart-wrapper canvas {
            width: 100% !important;
            height: 100% !important;
        }

    .dashboard-content .loading-overlay {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255,255,255,0.8);
        display: none;
        align-items: center;
        justify-content: center;
        z-index: 10;
        border-radius: 16px;
    }

        .dashboard-content .loading-overlay .spinner {
            width: 40px;
            height: 40px;
            border: 4px solid #e9ecef;
            border-top-color: #0d6efd;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.dashboard-content .error-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
}

    .dashboard-content .error-container i {
        font-size: 48px;
        margin-bottom: 16px;
        color: #dc3545;
    }

    .dashboard-content .error-container h5 {
        font-weight: 600;
        color: #1a1e2b;
    }

.dashboard-content .no-data-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
}

    .dashboard-content .no-data-container i {
        font-size: 48px;
        margin-bottom: 16px;
        color: #ffc107;
    }

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#dashboardChart {
    display: block;
    width: 100% !important;
    max-height: 40% !important;
    flex: 0 0 40%;
}

.chart-summary {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #28a745;
}

/* =========================================
   FULLSCREEN
========================================= */
.fullscreen-close-btn {
    position: fixed;
    top: 20px;
    right: 30px;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    color: #333;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

    .fullscreen-close-btn:hover {
        background: #dc3545;
        color: white;
        transform: scale(1.1);
    }

    .fullscreen-close-btn i {
        font-size: 20px;
    }

.table-container.fullscreen .fullscreen-close-btn {
    display: flex !important;
}

.fullscreen-header {
    display: none;
    position: sticky;
    top: 0;
    z-index: 100;
    background: #1a1e2b;
    padding: 12px 20px;
    border-bottom: 2px solid #0d6efd;
}

.fullscreen-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
}

.fullscreen-title {
    color: white;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

    .fullscreen-title i {
        font-size: 20px;
        color: #0d6efd;
    }

.fullscreen-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

    .fullscreen-actions .btn-icon {
        background: none;
        border: none;
        color: #adb5bd;
        padding: 6px 10px;
        cursor: pointer;
        font-size: 18px;
        border-radius: 4px;
        transition: all 0.2s ease;
        line-height: 1;
    }

        .fullscreen-actions .btn-icon:hover {
            background-color: rgba(255, 255, 255, 0.1);
            color: white;
        }

        .fullscreen-actions .btn-icon i {
            font-size: 18px;
        }

.table-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    z-index: 9999;
    background: #fff;
    border: none;
    border-radius: 0;
    padding: 0;
    overflow-y: auto;
}

    .table-container.fullscreen .fullscreen-header {
        display: block !important;
    }

    .table-container.fullscreen .cashflow-table {
        padding: 20px;
    }

        .table-container.fullscreen .cashflow-table thead th {
            position: sticky;
            top: 60px;
            z-index: 50;
        }

/* =========================================
   RESPONSIVE
========================================= */
@media (max-width: 768px) {
    .dashboard-page {
        margin-left: 0;
    }

    .dashboard-sidebar {
        width: 0;
        min-width: 0;
        overflow: hidden;
        padding: 0;
        transition: all 0.3s ease;
    }

        .dashboard-sidebar.open {
            width: 280px;
            min-width: 280px;
            padding: 16px 0;
            position: fixed;
            z-index: 1050;
            height: 100%;
            box-shadow: 2px 0 12px rgba(0,0,0,0.15);
        }

    .dashboard-content .chart-container {
        height: calc(100vh - 60px - 38px - 48px);
    }

    #dashboardChart {
        max-height: 300px;
    }

    .chart-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}