/* ========================================
   SINEMA-X Custom Styles
   ======================================== */

/* ========================================
   Select2 Bootstrap 5 Fixes
   ======================================== */

/* Fix Select2 selection box height and padding */
.select2-container--bootstrap-5 .select2-selection {
    min-height: calc(1.5em + 0.75rem + 2px) !important;
}

.select2-container--bootstrap-5 .select2-selection--single {
    display: flex !important;
    align-items: center !important;
    padding: 0.375rem 2.25rem 0.375rem 0.75rem !important;
    position: relative !important;
}

/* Fix selected value overflow - prevent text from going outside the box */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding: 0 !important;
    line-height: 1.5 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    width: calc(100% - 2.5rem) !important;
    display: block !important;
    max-width: 100% !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__placeholder {
    color: #adb5bd;
}

/* Fix dropdown positioning and add max height with scrollbar */
.select2-container--bootstrap-5 .select2-dropdown {
    border-color: #ced4da;
    border-top: none;
    z-index: 1056;
}

.select2-container--bootstrap-5 .select2-results__options {
    max-height: 250px;
    overflow-y: auto;
}

.select2-container--bootstrap-5 .select2-results__option {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Fix selected item display and clear button */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__clear {
    position: absolute !important;
    right: 2rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 1.25rem !important;
    color: #6c757d !important;
    z-index: 1 !important;
}

/* Ensure select2 container takes full width */
.select2-container {
    width: 100% !important;
}

/* Fix select2 selection arrow */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    position: absolute !important;
    right: 0.75rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    height: auto !important;
}

/* Focus state styling */
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Search field inside dropdown */
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
}

/* Loading state */
.select2-container--bootstrap-5 .select2-results__message {
    padding: 0.375rem 0.75rem;
    color: #6c757d;
}

/* ========================================
   DataTables Custom Styles
   ======================================== */

/* Responsive table wrapper */
.dataTables_wrapper {
    width: 100%;
}

/* ========================================
   Custom Utilities
   ======================================== */

/* Text truncate with ellipsis */
.text-truncate-custom {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .no-print {
        display: none !important;
    }
}

/* ========================================
   SweetAlert2 Modal Customizations
   ======================================== */

/* Approval Modal - Prevent overflow with scrollable content */
.swal2-modal-approval .swal2-html-container {
    max-height: 450px !important;
    overflow-y: auto !important;
    padding-right: 10px;
}

/* Verifikasi Modal - Prevent overflow with scrollable content */
.swal2-modal-verifikasi .swal2-html-container {
    max-height: 450px !important;
    overflow-y: auto !important;
    padding-right: 10px;
}

/* Custom scrollbar for modal content */
.swal2-modal-approval .swal2-html-container::-webkit-scrollbar,
.swal2-modal-verifikasi .swal2-html-container::-webkit-scrollbar {
    width: 6px;
}

.swal2-modal-approval .swal2-html-container::-webkit-scrollbar-track,
.swal2-modal-verifikasi .swal2-html-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.swal2-modal-approval .swal2-html-container::-webkit-scrollbar-thumb,
.swal2-modal-verifikasi .swal2-html-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.swal2-modal-approval .swal2-html-container::-webkit-scrollbar-thumb:hover,
.swal2-modal-verifikasi .swal2-html-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========================================
   Dark Mode Dashboard Styles
   ======================================== */
[data-bs-theme="dark"] {
    /* Card styles */
    .card {
        background-color: #1e1e2d;
        border-color: #323248;
    }

    .card-header {
        background-color: #1e1e2d !important;
        border-bottom: 1px solid #323248;
    }

    /* Pending Tasks */
    .pending-task-card {
        background-color: #2b2b40 !important;
        border-left-color: #323248 !important;
    }

    .pending-task-card:hover {
        background-color: #323248 !important;
        border-left-color: var(--bs-primary) !important;
    }

    /* Table styles */
    .table {
        --bs-table-bg: #1e1e2d;
        --bs-table-striped-bg: #2b2b40;
        --bs-table-hover-bg: #323248;
        --bs-table-border-color: #323248;
        --bs-table-color: #b5b5c3;
    }

    .table-light {
        --bs-table-bg: #2b2b40;
        --bs-table-border-color: #323248;
        --bs-table-color: #eff2f5;
    }

    /* Text colors */
    .text-muted {
        color: #7e8299 !important;
    }
}