/**
 * DataTables Custom Styling
 * Modern, aesthetic design for DataTables
 */

/* ============================================
   DATATABLE WRAPPER
   ============================================ */

.datatable-wrapper {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.datatable-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.datatable-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.datatable-title i {
    color: #667eea;
}

.datatable-actions {
    display: flex;
    gap: 10px;
}

/* ============================================
   DATATABLE CONTROLS
   ============================================ */

.dataTables_wrapper {
    padding: 0;
}

.dataTables_length {
    margin-bottom: 15px;
}

.dataTables_length label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}

.dataTables_length select {
    padding: 6px 30px 6px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    color: #495057;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.dataTables_length select:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dataTables_filter {
    margin-bottom: 15px;
}

.dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}

.dataTables_filter input {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    width: 250px;
    transition: all 0.2s;
}

.dataTables_filter input:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ============================================
   TABLE STYLING
   ============================================ */

.dataTable {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
}

.dataTable thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}


[type="search"] {
    width: 90% !important;
}

.dataTable thead th {
    color: rgb(0, 0, 0) !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    padding: 16px 12px !important;
    border: none !important;
    white-space: nowrap;
    position: relative;
}

.dataTable thead th:first-child {
    border-top-left-radius: 12px;
}

.dataTable thead th:last-child {
    border-top-right-radius: 12px;
}

/* Sorting icons */
.dataTable thead th.sorting,
.dataTable thead th.sorting_asc,
.dataTable thead th.sorting_desc {
    cursor: pointer;
    padding-right: 30px !important;
}

.dataTable thead th.sorting:after,
.dataTable thead th.sorting_asc:after,
.dataTable thead th.sorting_desc:after {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 12px;
    opacity: 0.5;
}

.dataTable thead th.sorting:after {
    content: '\f0dc';
}

.dataTable thead th.sorting_asc:after {
    content: '\f0de';
    opacity: 1;
}

.dataTable thead th.sorting_desc:after {
    content: '\f0dd';
    opacity: 1;
}

/* Table body */
.dataTable tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.dataTable tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
    transform: scale(1.005);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dataTable tbody td {
    padding: 14px 12px !important;
    vertical-align: middle;
    color: #495057;
    font-size: 14px;
    border: none !important;
}

.dataTable tbody tr:last-child {
    border-bottom: none;
}

/* Striped rows */
.dataTable.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(102, 126, 234, 0.02);
}

.dataTable.table-striped tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.08) !important;
}

/* ============================================
   PAGINATION
   ============================================ */

.dataTables_info {
    padding: 15px 0;
    font-size: 14px;
    color: #6c757d;
}

.dataTables_paginate {
    padding: 15px 0;
}

.dataTables_paginate .pagination {
    margin: 0;
    gap: 5px;
}

.dataTables_paginate .page-item {
    margin: 0;
}

.dataTables_paginate .page-link {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 8px 14px;
    color: #495057;
    font-weight: 500;
    transition: all 0.2s;
    margin: 0 2px;
}

.dataTables_paginate .page-link:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
    color: #667eea;
}

.dataTables_paginate .page-item.active .page-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.dataTables_paginate .page-item.disabled .page-link {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #adb5bd;
    cursor: not-allowed;
}

/* ============================================
   PROCESSING INDICATOR
   ============================================ */

.dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #495057;
}

.dataTables_processing:before {
    content: '';
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   EMPTY STATE
   ============================================ */

.dataTables_empty {
    text-align: center;
    padding: 40px 20px !important;
    color: #6c757d;
    font-size: 14px;
}

.dataTables_empty:before {
    content: '\f15c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 400;
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
    color: #dee2e6;
}

/* ============================================
   ACTION BUTTONS IN TABLE
   ============================================ */

.btn-table-action {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    margin: 0 2px;
}

.btn-table-action.btn-view {
    background: #3498db;
    color: white;
}

.btn-table-action.btn-edit {
    background: #f39c12;
    color: white;
}

.btn-table-action.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-table-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ============================================
   STATUS BADGES
   ============================================ */

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.status-badge.status-aktif {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
}

.status-badge.status-non-aktif {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
}

.status-badge.status-ditangguhkan {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
}

.status-badge.status-terdistribusi {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.status-badge.status-dalam-perjalanan {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .dataTables_filter input {
        width: 100%;
    }
    
    .datatable-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .dataTable thead th {
        font-size: 11px;
        padding: 12px 8px !important;
    }
    
    .dataTable tbody td {
        font-size: 13px;
        padding: 12px 8px !important;
    }
}

/* ============================================
   LOADING SKELETON
   ============================================ */

.skeleton-loader {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
    height: 20px;
    margin: 5px 0;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
