/* Home Page Specific Styles */
.report-item-link {
    transition: all 0.2s ease;
    position: relative;
}
.report-item-link:hover {
    background-color: #f8f9fa !important;
}
.report-item-link.active {
    background-color: var(--bs-main-o) !important;
    color: var(--bs-main) !important;
    font-weight: 700 !important;
    border-left: 4px solid var(--bs-main) !important;
    padding-left: calc(1.5rem - 4px) !important;
}
.report-item-link.active svg {
    color: var(--bs-main) !important;
    opacity: 1 !important;
}

/* Report View Tabs Styling */
#reportViewTabs .nav-link {
    border: none;
    color: #6c757d;
    border-bottom: 3px solid transparent;
    background: transparent;
    margin-right: 1.5rem;
    padding: 0.75rem 0.25rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}
#reportViewTabs .nav-link:hover {
    color: var(--bs-main);
}
#reportViewTabs .nav-link.active {
    color: var(--bs-main);
    border-bottom-color: var(--bs-main);
    background: transparent;
    font-weight: 700;
}

/* Report Search Styling */
.report-search-wrapper {
    position: relative;
    margin-right: 1rem;
    width: 280px;
}
.report-search-input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border-radius: 20px;
    border: 1px solid #dee2e6;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s ease;
    background: #f8f9fa;
}
.report-search-input:focus {
    border-color: var(--bs-main);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(127, 173, 73, 0.1);
}
.report-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
    pointer-events: none;
}
.report-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    margin-top: 10px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1060;
    display: none;
    border: 1px solid #f1f1f1;
    padding: 6px;
}
.search-result-item {
    padding: 10px 14px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 2px;
}
.search-result-item:hover, .search-result-item.active-search {
    background-color: var(--bs-main-o);
}
.search-result-category {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--bs-main);
    letter-spacing: 0.8px;
    opacity: 0.8;
}
.search-result-name {
    font-size: 0.9rem;
    color: #2d3436;
    font-weight: 500;
}
.search-result-item.active-search .search-result-name {
    color: var(--bs-main);
    font-weight: 600;
}

.chart-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.chart-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1) !important;
}

/* Modal Custom Width */
@media (min-width: 1400px) {
    .modal-xl {
        max-width: 1450px !important;
    }
}

/* Select2 Bootstrap 5 compatibility tweak */
.select2-container--default .select2-selection--multiple {
    border: 1px solid #dee2e6;
    min-height: 31px;
}
.select2-container .select2-selection--multiple .select2-selection__choice {
    background-color: var(--bs-main-o);
    border: 1px solid var(--bs-main);
    color: var(--bs-main);
    font-size: 0.75rem;
    font-weight: 600;
}

/* Ensure custom tables allow horizontal scrolling */
.custom-report-table {
    table-layout: auto !important;
    width: max-content !important;
    min-width: 100% !important;
}
.table-responsive {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px; /* Space for scrollbar */
}
.table-responsive::-webkit-scrollbar {
    height: 8px;
    background-color: #f5f5f5;
}
.table-responsive::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 10px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background-color: #bbb;
}

#previewResultContainer {
    border: 1px solid #eee;
    border-radius: 8px;
    background: white;
    min-height: 400px;
}

.custom-report-table thead {
    position: sticky;
    top: 0;
    z-index: 50;
}

/* User Config Card Styles */
#userColumnConfigList {
    padding: 0;
    margin: 0;
    list-style: none;
}
.user-config-card {
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 8px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.user-config-card-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #f1f3f5;
    gap: 12px;
}
.user-config-card-body {
    display: flex;
    padding: 12px 16px;
    gap: 24px;
}
.ucfg-drag {
    cursor: grab;
    color: #adb5bd;
    display: flex;
    align-items: center;
}
.ucfg-check {
    width: 1.2rem !important;
    height: 1.2rem !important;
    cursor: pointer;
    margin: 0;
}
.ucfg-colkey {
    font-weight: 500;
    color: #495057;
    font-size: 0.95rem;
    min-width: 130px;
}
.ucfg-input {
    flex-grow: 1;
}
.ucfg-badge {
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 2px 12px;
    font-size: 0.75rem;
    color: #6c757d;
    background: #f8f9fa;
}
.ucfg-actions {
    display: flex;
    gap: 4px;
}
.ucfg-btn {
    border: 1px solid #dee2e6;
    background: #fff;
    color: #495057;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ucfg-btn:hover {
    background: #f8f9fa;
}
.ucfg-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ucfg-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #adb5bd;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.ucfg-agg-grid {
    display: grid;
    grid-template-columns: auto auto auto;
    gap: 8px 16px;
}
.ucfg-agg-grid label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #495057;
    cursor: pointer;
    user-select: none;
    margin: 0;
}

/* Column Order Modal Compact Styling */
.order-only-item {
    min-height: 40px !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
}
.order-only-item .fw-bold { font-size: 0.75rem !important; }
.order-only-item .text-muted { font-size: 0.6rem !important; }

/* Active Filter Chips Styling */
#activeFiltersRow {
    min-height: 48px;
    transition: all 0.3s ease;
}
.collapse-icon-chevron {
    transition: transform 0.2s ease;
    transform: rotate(-90deg);
}
button[aria-expanded="true"] .collapse-icon-chevron {
    transform: rotate(0deg) !important;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    background-color: #f7fbf2;
    border: 1px solid #e2efd9;
    border-radius: 8px;
    padding: 4px 12px;
    font-size: 0.75rem;
    color: #5d7a42;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    max-width: 100%;
}
.filter-chip-label {
    font-weight: 500;
    margin-right: 4px;
    color: #8fa67a;
    font-style: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.filter-chip-value {
    font-weight: 700;
    color: #4a6133;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.filter-chip-icon {
    margin-right: 6px;
    opacity: 0.7;
    display: inline-flex;
}
.filter-chip-remove {
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid #e2efd9;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.filter-chip-remove:hover {
    opacity: 1;
    color: #dc3545;
}

@keyframes popupShow {
    from { transform: translate(-50%, -45%) scale(0.95); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media print {
    @page {
        size: landscape;
        margin: 0.5cm;
    }
    body {
        background: white !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* Hide UI Elements */
    .top-header, #btnOpenMenu, .side-menu, .side-menu-overlay, .mobile-bottom-nav,
    #settingSidebarCollapse, #btnShowSidebarDesktop, #btnHideSidebarDesktop,
    #reportFilterPopup, .btn, button, .filter-dropdown-menu, hr, .d-md-none,
    .modal-header, .modal-footer, .alert-info, .form-switch {
        display: none !important;
    }

    /* Container Resets */
    #spaContainer, #viewHome, .setting-main, #reportViewContent, 
    #settingContentArea, #settingActiveState {
        display: block !important;
        visibility: visible !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        position: static !important;
    }

    #reportViewContent {
        padding: 10px !important;
    }

    #reportTableSection, #reportChartsSection {
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        margin-bottom: 30px !important;
    }

    #reportResultContainer, .table-responsive {
        border: none !important;
        box-shadow: none !important;
        overflow: visible !important;
        display: block !important;
        height: auto !important;
    }

    .chart-card {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #eee !important;
        margin-bottom: 20px !important;
        display: block !important;
        box-shadow: none !important;
    }
    .chart-card .card-body {
        padding: 10px !important;
        min-height: 400px !important;
    }

    /* Map styles for charts */
    .apexcharts-canvas, .apexcharts-svg {
        width: 100% !important;
        background: white !important;
    }

    .custom-report-table { 
        width: 100% !important; 
        border: 1px solid #dee2e6 !important;
        table-layout: auto !important;
        border-collapse: collapse !important;
    }
    .text-nowrap { white-space: normal !important; }
    
    /* Remove title "REPORT CONFIG" but keep Chart Titles */
    .card-header:not(.chart-card .card-header), h3.fw-bold { display: none !important; }
    .chart-card .card-header { display: flex !important; background: #f8f9fa !important; border-bottom: 1px solid #dee2e6 !important;}

    /* Text styles */
    h4#lblReportName { font-size: 18pt !important; margin-top: 0 !important; }
    #reportPrintMeta { display: flex !important; margin-bottom: 15px !important; }
    th, td { font-size: 8pt !important; padding: 4px !important; border: 1px solid #dee2e6 !important; word-wrap: break-word; }
    .group-header-row { background-color: #f8f9fa !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Filter Popup Styles */
.filter-popup {
    animation: slideDown 0.3s ease-out;
    border: none !important;
}

.filter-popup h6 {
    font-size: 0.9rem;
    color: #4a4a4a;
    font-weight: 700;
}

.status-checkboxes .form-check {
    padding-left: 1.8rem;
}

.status-checkboxes .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-left: -1.8rem;
    cursor: pointer;
}

.status-checkboxes .form-check-input:checked {
    background-color: #82b440;
    border-color: #82b440;
}

.status-checkboxes .form-check-label {
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
}

.btn-success {
    background-color: #82b440 !important;
    border-color: #82b440 !important;
}

.btn-success:hover {
    background-color: #72a138 !important;
    border-color: #72a138 !important;
}

/* Pivot table specific styling */
.pivot-table {
    border-collapse: collapse !important;
    width: 100% !important;
}

.pivot-cell {
    padding: 8px 16px !important;
    font-size: 0.85rem !important;
    line-height: 1.4 !important;
    vertical-align: middle !important;
}

.pivot-val-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
}

.pivot-val-top {
    font-size: 0.85rem;
    font-weight: 500;
    color: #212529;
}

.pivot-val-bottom {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 400;
}

.pivot-header-month {
    font-size: 0.85rem;
    font-weight: 700;
    background-color: #f8f9fa !important;
    text-align: center;
}

.pivot-header-total {
    font-weight: 700;
    background-color: #f1f3f5 !important;
    text-align: center;
}

