/**
 * DataTables Modern UI & Enterprise Loader System
 * Professional grade loading states, glassmorphism overlays, and smooth transitions
 */

/* ==========================================================================
   1. Core Wrapper & Position Context
   ========================================================================== */
.dataTables_wrapper {
    position: relative !important;
    min-height: 120px;
}

/* Ensure scroll wrapper has relative context */
.dataTables_scroll {
    position: relative !important;
}

/* ==========================================================================
   2. Modern Processing Overlay
   ========================================================================== */
div.dataTables_wrapper div.dataTables_processing {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 140px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: rgba(255, 255, 255, 0.78) !important;
    backdrop-filter: blur(3px) !important;
    -webkit-backdrop-filter: blur(3px) !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1050 !important;
    transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.22s ease !important;
    pointer-events: all !important;
}

/* Explicit hide rule overrides any conflicting styles */
div.dataTables_wrapper div.dataTables_processing[style*="display: none"],
div.dataTables_wrapper div.dataTables_processing.dt-processing-hidden {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Active visible state */
div.dataTables_wrapper div.dataTables_processing:not([style*="display: none"]) {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   3. Loader Component Layout & Animations
   ========================================================================== */
.dt-loader-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 32px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid rgba(229, 232, 247, 0.9);
    box-shadow: 0 10px 30px -5px rgba(16, 24, 40, 0.1), 0 4px 12px -2px rgba(16, 24, 40, 0.05);
    animation: dtFadeScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    user-select: none;
}

@keyframes dtFadeScaleIn {
    0% {
        opacity: 0;
        transform: scale(0.92) translateY(6px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* SVG Spinner */
.dt-spinner {
    width: 42px;
    height: 42px;
    margin-bottom: 12px;
    position: relative;
}

.dt-spinner-svg {
    width: 100%;
    height: 100%;
    animation: dtRotate 1.4s linear infinite;
}

.dt-spinner-track {
    stroke: #E5E8F7;
}

.dt-spinner-circle {
    stroke: #3C58DF;
    stroke-linecap: round;
    stroke-dasharray: 90, 150;
    stroke-dashoffset: 0;
    animation: dtDash 1.4s ease-in-out infinite;
}

@keyframes dtRotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dtDash {
    0% {
        stroke-dasharray: 1, 200;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 200;
        stroke-dashoffset: -35px;
    }
    100% {
        stroke-dasharray: 90, 200;
        stroke-dashoffset: -125px;
    }
}

.dt-loader-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1f36;
    margin-bottom: 3px;
    letter-spacing: -0.01em;
}

.dt-loader-subtitle {
    font-size: 12px;
    font-weight: 400;
    color: #697386;
}

/* Subtle Pulsing Dots Animation */
.dt-loader-title::after {
    content: '...';
    display: inline-block;
    width: 16px;
    text-align: left;
    animation: dtDots 1.4s steps(4, jump-none) infinite;
}

@keyframes dtDots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* ==========================================================================
   4. Table Empty & Error State Enhancements
   ========================================================================== */
.dataTables_empty {
    padding: 40px 16px !important;
    text-align: center !important;
    color: #697386 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    background: transparent !important;
}

.dt-error-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    margin: 12px 0;
    border-radius: 8px;
    background: #FEF3F2;
    border: 1px solid #FECDCA;
    color: #B42318;
    font-size: 13px;
    font-weight: 500;
}

.dt-error-banner i {
    font-size: 18px;
    color: #D92D20;
}

.dt-error-retry-btn {
    margin-left: auto;
    background: #D92D20;
    color: #fff;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.dt-error-retry-btn:hover {
    background: #B42318;
}

/* Responsive Table Wrapper Fix */
.dataTables_wrapper .table-responsive {
    border: none;
    margin-bottom: 0;
}
