/* Employee Reports Styles */

/* Report Container */
.report-container {
    padding: 1.5rem;
}

/* Table Container with Scroll */
.table-container-scroll {
    display: flex;
    flex-direction: column;
    overflow: auto;
    position: relative;
    min-width: 0; /* Allow flex child to shrink below content size */
}

.table-container-scroll::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-container-scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.table-container-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.table-container-scroll::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Ensure table takes full width for horizontal scroll */
.table-container-scroll .table {
    min-width: 100%;
}

/* Modern Filter Section */
.filter-section-modern {
    min-height: fit-content;
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    /* Removed overflow: hidden to allow dropdowns to show properly */
    /* overflow: hidden; */
    transition: all 0.3s ease;
    position: relative;
    z-index: 10;
}

.filter-section-modern .filter-header-wrapper {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-radius: 16px 16px 0 0;
}

/* Clickable portion of header */
.filter-section-modern .filter-header-clickable {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    user-select: none;
    padding: 8px;
    margin: -8px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.filter-section-modern .filter-header-clickable:hover {
    background: rgba(102, 126, 234, 0.05);
}

.filter-section-modern .filter-header-clickable:active {
    background: rgba(102, 126, 234, 0.1);
}

.filter-section-modern .filter-header-clickable:focus {
    outline: none;
}

/* Action buttons section */
.filter-header-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 16px;
    padding-left: 16px;
    border-left: 1px solid #e2e8f0;
}

/* Make filter action buttons smaller */
.filter-header-actions .btn {
    padding: 4px 12px !important;
    font-size: 0.8rem !important;
    line-height: 1.3 !important;
    min-height: unset !important;
}

.filter-header-actions .btn i {
    font-size: 0.85rem !important;
}



.filter-section-modern[data-collapsible-filters-collapsed-value="true"] .filter-header-wrapper {
    border-bottom: none;
    border-radius: 16px;
}

.filter-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.filter-icon {
    font-size: 1.1rem;
    color: #667eea;
    transition: color 0.2s ease;
}

.filter-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    letter-spacing: -0.025em;
}

/* Toggle indicator */
.filter-toggle-indicator {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(102, 126, 234, 0.1);
    margin-left: auto;
}

/* Toggle icon rotation */
.filter-toggle-indicator .toggle-icon {
    font-size: 1rem;
    color: #667eea;
    transition: transform 0.3s ease;
    display: inline-block;
}

.filter-header-clickable[aria-expanded="false"] .toggle-icon {
    transform: rotate(180deg);
}

.filter-content {
    padding: 24px;
    background: white;
    transition: all 0.3s ease;
    border-radius: 0 0 16px 16px;
    position: relative;
    /* Higher z-index to ensure dropdowns appear above tables */
    z-index: 100;
}

/* Bootstrap dropdowns and select2-style dropdowns need even higher z-index */
.dropdown-menu,
.select2-container,
.choices__list--dropdown,
.autocomplete-results,
.filter-content select,
.filter-content .dropdown,
.datepicker-dropdown {
    z-index: 1050 !important; /* Bootstrap modal z-index level */
}

/* Flatpickr calendar needs higher z-index to appear above modals */
/* Bootstrap modals are z-index 1055, flatpickr needs to be higher */
.flatpickr-calendar {
    z-index: 10000 !important;
}

/* Ensure the dropdown container itself doesn't clip */
.filter-section-modern {
    overflow: visible !important;
}

/* Keep the visible overflow for the filter content when expanded */
.filter-content:not(.collapsed) {
    overflow: visible !important;
}

/* Filter Badges */
.filter-badges-container {
    flex: 1;
    display: flex;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.filter-badges-container::-webkit-scrollbar {
    height: 4px;
}

.filter-badges-container::-webkit-scrollbar-track {
    background: transparent;
}

.filter-badges-container::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 2px;
}

.filter-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.425rem 0.875rem;
    font-size: 0.825rem;
    font-weight: 500;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8ecff 100%);
    color: #1e293b!important;
    border: 1px solid #d4dbee;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-badge:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #e8ecff 0%, #dce3ff 100%);
    border-color: #b8c4e6;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.15);
}

.filter-badge-label {
    font-weight: 600;
    opacity: 0.9;
}

.filter-badge-value {
    font-weight: 400;
}

.filter-badge .btn-close {
    width: 0.65rem;
    height: 0.65rem;
    padding: 0;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    background-size: 0.65rem;
    filter: none;
}

.filter-badge .btn-close:hover {
    opacity: 1;
}

/* No active filters message */
.filter-badges-container .text-muted {
    color: #94a3b8 !important;
    font-size: 0.875rem;
    font-style: italic;
}

/* Clear all button */
.filter-badges .btn-outline-secondary {
    font-size: 0.825rem;
    padding: 0.325rem 0.75rem;
    border-radius: 20px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Filter Panel Collapsed State */
.filter-content.collapsed {
    display: none;
}

.filter-content.show {
    display: block;
}

/* Filter Section */
.report-filters {
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.report-filters .card {
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.report-filters .card-header {
    background-color: transparent;
    border-bottom: 1px solid #dee2e6;
}

.report-filters .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

/* Pagination */
.report-pagination {
    padding: 1rem;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.report-pagination .pagination {
    margin-bottom: 0;
}

/* Report Summary Stats */
.report-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.report-stat-card {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.report-stat-card h6 {
    color: #6c757d;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.report-stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #212529;
}

/* Filter Form Improvements */
.report-filters .form-control,
.report-filters .form-select {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    height: var(--bit-form-field-height, 38px) !important;
    min-height: var(--bit-form-field-height, 38px) !important;
    font-size: var(--bit-form-field-font-size, 14px) !important;
}

.report-filters .form-control:focus,
.report-filters .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Export Buttons */
.report-export-buttons {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.report-export-buttons .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .report-stats {
        flex-direction: column;
    }

    .report-filters .row {
        margin-bottom: 1rem;
    }

    .report-table {
        overflow-x: auto;
    }

    .report-export-buttons {
        flex-direction: column;
        width: 100%;
    }

    .report-export-buttons .btn {
        width: 100%;
    }

    /* Filter header mobile responsive */
    .filter-section-modern .filter-header-wrapper {
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 12px;
    }

    .filter-section-modern .filter-header-clickable {
        flex: 1 1 100%;
        min-width: 0;
    }

    .filter-header-actions {
        flex: 1 1 100%;
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid #e2e8f0;
        padding-top: 12px;
        justify-content: stretch;
    }

    .filter-header-actions .btn {
        flex: 1;
        justify-content: center;
    }

    /* Filter badges container on mobile */
    .filter-badges-container {
        max-width: 100%;
    }

    /* Filter content padding on mobile */
    .filter-content {
        padding: 16px;
    }

    /* Filter fields full width on mobile */
    .filter-content .col-md-4,
    .filter-content .col-lg-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Container adjustments for mobile */
    .container-fluid[data-controller="panel-slide"] {
        padding: 0.75rem !important;
        height: auto !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        min-height: 100vh;
    }

    /* Modern card adjustments */
    .modern-card {
        min-height: 400px;
    }

    /* Table container mobile scroll */
    .table-container-scroll {
        -webkit-overflow-scrolling: touch;
    }

    /* Make table responsive on mobile */
    .table-modern {
        font-size: 0.875rem;
    }

    .table-modern th,
    .table-modern td {
        padding: 0.5rem 0.25rem;
        white-space: normal;
    }

    /* Hide less important columns on mobile if needed */
    .table-modern th:not(:first-child):not(:last-child),
    .table-modern td:not(:first-child):not(:last-child) {
        font-size: 0.8rem;
    }

    /* Listing page container responsive */
    .container-fluid {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    /* Reduce vertical padding on mobile */
    div[data-controller="panel-slide"] {
        padding: 0.75rem !important;
    }
}

/* Print Styles */
@media print {
    .report-filters,
    .report-pagination,
    .report-export-buttons {
        display: none !important;
    }
    
    .report-table {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    .report-table thead {
        background-color: #f8f9fa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}