/* ============================================
   DataTables Styling untuk Semua Halaman
   Warna Utama: #1AB394
   ============================================ */

/* ===== Container & Wrapper ===== */
.dataTables_wrapper {
    padding: 0;
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, sans-serif;
}

/* ===== Search Box ===== */
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 0 !important;
    margin-left: auto !important;
    text-align: right !important;
    flex-grow: 0 !important;
}

.dataTables_wrapper .dataTables_length {
    margin-bottom: 0 !important;
    margin-right: auto !important;
}

.dataTables_wrapper .dataTables_filter label {
    display: flex;
    align-items: center;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0;
}

.dataTables_wrapper .dataTables_filter input {
    margin-left: 0.75rem;
    padding: 0.625rem 1rem;
    border: 1.5px solid #dee2e6;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    background-color: #fff;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: #1ab394;
    box-shadow: 0 0 0 0.2rem rgba(26, 179, 148, 0.15);
    background-color: #fff;
}

.dataTables_wrapper .dataTables_filter input::placeholder {
    color: #adb5bd;
}

/* ===== Length Menu ===== */
.dataTables_wrapper .dataTables_length {
    margin-bottom: 1.5rem;
}

.dataTables_wrapper .dataTables_length label {
    display: flex;
    align-items: center;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0;
}

.dataTables_wrapper .dataTables_length select {
    margin: 0 0.5rem;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1.5px solid #dee2e6;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.dataTables_wrapper .dataTables_length select:focus {
    outline: none;
    border-color: #1ab394;
    box-shadow: 0 0 0 0.2rem rgba(26, 179, 148, 0.15);
}

/* ===== Table Styling ===== */
.dataTables_wrapper .dataTable {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0.5rem;
}

/* Table Header - Warna #1AB394 */
.dataTables_wrapper .dataTable thead th {
    background-color: #1ab394;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 1rem 1.25rem;
    border: none;
    position: relative;
    white-space: nowrap;
    vertical-align: middle;
}

.dataTables_wrapper .dataTable thead th:first-child {
    border-top-left-radius: 0.5rem;
}

.dataTables_wrapper .dataTable thead th:last-child {
    border-top-right-radius: 0.5rem;
}

/* Sortable Header */
.dataTables_wrapper .dataTable thead th.sorting,
.dataTables_wrapper .dataTable thead th.sorting_asc,
.dataTables_wrapper .dataTable thead th.sorting_desc {
    cursor: pointer;
    position: relative;
    padding-right: 2.5rem;
    transition: all 0.3s ease;
}

.dataTables_wrapper .dataTable thead th.sorting:hover,
.dataTables_wrapper .dataTable thead th.sorting_asc:hover,
.dataTables_wrapper .dataTable thead th.sorting_desc:hover {
    background-color: #17a085;
}

/* Sorting Icons */
.dataTables_wrapper .dataTable thead th.sorting:before,
.dataTables_wrapper .dataTable thead th.sorting:after,
.dataTables_wrapper .dataTable thead th.sorting_asc:before,
.dataTables_wrapper .dataTable thead th.sorting_asc:after,
.dataTables_wrapper .dataTable thead th.sorting_desc:before,
.dataTables_wrapper .dataTable thead th.sorting_desc:after {
    content: "";
    position: absolute;
    right: 1rem;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.5;
}

.dataTables_wrapper .dataTable thead th.sorting:before {
    top: 1.25rem;
    border-bottom: 5px solid rgba(255, 255, 255, 0.7);
}

.dataTables_wrapper .dataTable thead th.sorting:after {
    bottom: 1.25rem;
    border-top: 5px solid rgba(255, 255, 255, 0.7);
}

.dataTables_wrapper .dataTable thead th.sorting_asc:before {
    top: 1.25rem;
    border-bottom: 5px solid #ffffff;
    opacity: 1;
}

.dataTables_wrapper .dataTable thead th.sorting_desc:after {
    bottom: 1.25rem;
    border-top: 5px solid #ffffff;
    opacity: 1;
}

/* Table Body */
.dataTables_wrapper .dataTable tbody tr {
    background-color: #ffffff;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.dataTables_wrapper .dataTable tbody tr:hover {
    background-color: #f0fdfa;
}

.dataTables_wrapper .dataTable tbody tr:last-child {
    border-bottom: none;
}

.dataTables_wrapper .dataTable tbody td {
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    color: #495057;
    vertical-align: middle;
    border: none;
}

.dataTables_wrapper .dataTable tbody td:first-child {
    font-weight: 500;
    color: #6c757d;
}

/* Striped Rows */
.dataTables_wrapper .dataTable tbody tr.odd {
    background-color: #ffffff;
}

.dataTables_wrapper .dataTable tbody tr.even {
    background-color: #f8f9fa;
}

.dataTables_wrapper .dataTable tbody tr.odd:hover,
.dataTables_wrapper .dataTable tbody tr.even:hover {
    background-color: #f0fdfa;
}

/* ===== Processing Indicator ===== */
.dataTables_wrapper .dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #1ab394;
    color: #ffffff;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(26, 179, 148, 0.3);
    z-index: 1000;
    border: none;
    text-align: center;
    line-height: 1.5;
}

/* Hide all loading indicators/spinners - only show text */
.dataTables_wrapper .dataTables_processing::before,
.dataTables_wrapper .dataTables_processing::after {
    display: none !important;
    content: none !important;
}

/* Hide spinner elements but keep text */
.dataTables_wrapper .dataTables_processing .spinner,
.dataTables_wrapper .dataTables_processing .spinner-border,
.dataTables_wrapper .dataTables_processing .spinner-grow,
.dataTables_wrapper .dataTables_processing i[class*="spinner"],
.dataTables_wrapper .dataTables_processing [class*="loading"] {
    display: none !important;
}

/* ===== Pagination ===== */
.dataTables_wrapper .dataTables_paginate {
    margin-top: 1.5rem;
    text-align: center;
}

.dataTables_wrapper .dataTables_paginate .pagination {
    display: inline-flex;
    gap: 0.5rem;
    margin: 0;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.5rem 1rem;
    margin: 0;
    border: 1.5px solid #dee2e6;
    border-radius: 0.5rem;
    background-color: #ffffff;
    color: #495057;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background-color: #1ab394;
    color: #ffffff;
    border-color: #1ab394;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background-color: #1ab394;
    color: #ffffff;
    border-color: #1ab394;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background-color: #17a085;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f8f9fa;
    color: #adb5bd;
    border-color: #dee2e6;
}

/* ===== Info ===== */
.dataTables_wrapper .dataTables_info {
    padding: 0.75rem 0;
    color: #6c757d;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ===== Empty State ===== */
.dataTables_wrapper .dataTables_empty {
    padding: 3rem 1rem;
    text-align: center;
    color: #adb5bd;
    font-style: italic;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length {
        margin-bottom: 1rem;
    }

    .dataTables_wrapper .dataTables_filter label,
    .dataTables_wrapper .dataTables_length label {
        flex-direction: column;
        align-items: flex-start;
    }

    .dataTables_wrapper .dataTables_filter input {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
    }

    .dataTables_wrapper .dataTables_length select {
        margin: 0.5rem 0;
        width: 100%;
    }

    .dataTables_wrapper .dataTable thead th {
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
    }

    .dataTables_wrapper .dataTable tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8125rem;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
    }
}

/* ===== Action Buttons in Table ===== */
.dataTables_wrapper .dataTable tbody td .btn {
    margin: 0 0.25rem;
    transition: all 0.3s ease;
}

.dataTables_wrapper .dataTable tbody td .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* ===== Status Badges ===== */
.dataTables_wrapper .dataTable tbody td .badge {
    padding: 0.5rem 0.75rem;
    font-weight: 500;
    font-size: 0.75rem;
    border-radius: 0.5rem;
}

/* ===== Scrollbar Styling ===== */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background-color: #1ab394;
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background-color: #17a085;
}

/* ===== Dark Mode Support ===== */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter label,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length label,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_info {
    color: #e9ecef;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background-color: #1a1a1a;
    border-color: #333;
    color: #fff;
}

/* Force Table Body Background & Text */
[data-bs-theme="dark"] .dataTables_wrapper .dataTable tbody tr {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-bottom-color: #222;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTable tbody tr.even {
    background-color: #0a0a0a !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTable tbody td {
    color: #ffffff !important;
    background-color: transparent !important; /* Inherit from TR */
}

/* Specific fix for first-child color overrides */
[data-bs-theme="dark"] .dataTables_wrapper .dataTable tbody td:first-child {
    color: #adb5bd !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTable tbody tr:hover,
[data-bs-theme="dark"] .dataTables_wrapper .dataTable tbody tr.odd:hover,
[data-bs-theme="dark"] .dataTables_wrapper .dataTable tbody tr.even:hover {
    background-color: #1a1a1a !important;
}

/* Pagination Dark Mode */
[data-bs-theme="dark"]
    .dataTables_wrapper
    .dataTables_paginate
    .paginate_button {
    background-color: #1a1a1a;
    color: #fff !important;
    border-color: #333;
}

[data-bs-theme="dark"]
    .dataTables_wrapper
    .dataTables_paginate
    .paginate_button:hover {
    background-color: #1ab394;
    color: #ffffff !important;
    border-color: #1ab394;
}

[data-bs-theme="dark"]
    .dataTables_wrapper
    .dataTables_paginate
    .paginate_button.current {
    background-color: #1ab394;
    color: #ffffff !important;
    border-color: #1ab394;
}

[data-bs-theme="dark"]
    .dataTables_wrapper
    .dataTables_paginate
    .paginate_button.disabled {
    background-color: #0a0a0a;
    color: #555 !important;
    border-color: #222;
}

/* Processing Indicator Dark Mode */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_processing {
    background-color: #1AB394;
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
