/* ==========================================================================
   UI MICRO-INTERACTIONS & VISUAL ENHANCEMENTS (SAFE MODE)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CUSTOM PREMIUM SCROLLBAR (macOS Style)
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(160, 160, 160, 0.4);
    border-radius: 10px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(160, 160, 160, 0.7);
}

/* Scrollbar inside tables/modals */
.table-responsive::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

/* --------------------------------------------------------------------------
   2. ENHANCED DATA TABLES (Sticky & Hover FX)
   -------------------------------------------------------------------------- */
/* Sticky Header for long tables (Terapkan .custom-sticky-table jika butuh scroll internal) */
.custom-sticky-table {
    max-height: calc(100vh - 220px);
}

.custom-sticky-table thead th,
.table-responsive thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #343a40 !important;
    /* Thead dark fallback */
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.4);
}

/* Table Row Hover Lift */
.table-hover tbody tr {
    transition: all 0.2s ease-in-out;
}

.table-hover tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    background-color: rgba(0, 123, 255, 0.05) !important;
    /* Soft blue highlight */
    z-index: 1;
    position: relative;
}

/* --------------------------------------------------------------------------
   3. MICRO-INTERACTIONS (Buttons & Cards)
   -------------------------------------------------------------------------- */
/* Soft Pulse on Main Actions */
@keyframes softPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.4);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(0, 123, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
    }
}

.btn-primary:not(:disabled):hover,
.btn-success:not(:disabled):hover,
.btn-info:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-primary.pulse-action {
    animation: softPulse 2s infinite;
}

/* Hover Lift for Info Boxes (AdminLTE native boxes) */
.info-box {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.info-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15) !important;
}

/* RIPPLE EFFECT LOGIC */
.ripple-surface {
    position: relative;
    overflow: hidden;
}

.ripple-effect {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-anim 600ms linear;
    background-color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

@keyframes ripple-anim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* --------------------------------------------------------------------------
   4. GLASSMORPHISM POP-UPS (SweetAlert2 Overrides)
   -------------------------------------------------------------------------- */
.swal2-glass-popup {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 16px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    color: #1e293b !important;
}

/* Animate swal entry dynamically */
@keyframes swalBouncy {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    60% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.swal2-glass-popup.swal2-show {
    animation: swalBouncy 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.swal2-glass-title {
    font-weight: 700 !important;
    color: #0f172a !important;
}

.swal2-glass-confirm,
.swal2-glass-cancel {
    border-radius: 8px !important;
    font-weight: 600 !important;
    padding: 10px 24px !important;
    transition: all 0.2s ease !important;
}

.swal2-glass-confirm:hover,
.swal2-glass-cancel:hover {
    transform: translateY(-2px) !important;
}

/* --------------------------------------------------------------------------
   5. TYPOGRAPHY & CARD REDESIGN (Premium Feel)
   -------------------------------------------------------------------------- */
/* Fix Dark Mode Forms (High Specificity) */
body.dark-mode .form-control,
body.dark-mode select.form-control,
body.dark-mode input.form-control,
body.dark-mode .form-control:not(.bg-success):not(.bg-danger):not(.bg-warning):not(.bg-info):not(.bg-primary):not(.bg-secondary):not(.bg-dark) {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode .form-control:focus,
body.dark-mode select.form-control:focus,
body.dark-mode input.form-control:focus,
body.dark-mode .form-control:not(.premium-input):focus {
    background-color: #0f172a !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
}

body,
.content-wrapper,
.main-header,
.main-sidebar,
.card,
.btn,
.table {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
}

/* Card Redesign (Soft Shadows & Rounded Corners) */
.card {
    border: none !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-header {
    border-top-left-radius: 16px !important;
    border-top-right-radius: 16px !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03) !important;
    background-color: transparent !important;
}

/* Info Box Redesign (Rounded & Live Gradients) */
.info-box {
    border-radius: 16px !important;
    border: none !important;
    box-shadow: 0 8px 25px -8px rgba(0, 0, 0, 0.15) !important;
    overflow: hidden;
}

/* Live Animated Gradients */
@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.bg-gradient-primary,
.bg-gradient-info,
.bg-gradient-success,
.bg-gradient-warning,
.bg-gradient-danger,
.bg-gradient-navy,
.bg-gradient-teal,
.bg-gradient-purple {
    background-size: 200% 200% !important;
    animation: gradientFlow 10s ease infinite !important;
}

/* Specific Gradient Tweaks for better flow */
.bg-gradient-primary {
    background-image: linear-gradient(135deg, #007bff 0%, #0056b3 50%, #007bff 100%) !important;
}

.bg-gradient-info {
    background-image: linear-gradient(135deg, #17a2b8 0%, #0b7a8a 50%, #17a2b8 100%) !important;
}

.bg-gradient-success {
    background-image: linear-gradient(135deg, #28a745 0%, #1e7e34 50%, #28a745 100%) !important;
}

.bg-gradient-warning {
    background-image: linear-gradient(135deg, #ffc107 0%, #d39e00 50%, #ffc107 100%) !important;
}

.bg-gradient-navy {
    background-image: linear-gradient(135deg, #001f3f 0%, #000c1a 50%, #001f3f 100%) !important;
}

/* --------------------------------------------------------------------------
   7. DATATABLES PREMIUM REDESIGN
   -------------------------------------------------------------------------- */
/* Pill-shaped search bar */
div.dataTables_wrapper div.dataTables_filter input {
    border-radius: 9999px !important;
    padding: 0.4rem 1.2rem !important;
    border: 1px solid rgba(0, 0, 0, 0.15) !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02) !important;
}

body.dark-mode div.dataTables_wrapper div.dataTables_filter input {
    border-color: rgba(255, 255, 255, 0.1) !important;
    background-color: #1e293b !important;
    color: #f8fafc !important;
}

/* Pill-shaped pagination */
.page-item .page-link {
    border-radius: 50% !important;
    margin: 0 3px !important;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none !important;
    color: #4f46e5;
    font-weight: 600;
    transition: all 0.2s ease;
}

.page-item.active .page-link {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3) !important;
    color: white !important;
}

.page-item.disabled .page-link {
    background: transparent !important;
    color: #cbd5e1 !important;
}

body.dark-mode .page-item .page-link {
    background: rgba(30, 41, 59, 0.5) !important;
    color: #e2e8f0;
}

body.dark-mode .page-item.active .page-link {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
    color: white !important;
}

body.dark-mode .page-item.disabled .page-link {
    background: transparent !important;
    color: #64748b !important;
}

/* Clean Borderless Table Look */
table.dataTable.table-sm>thead>tr>th {
    border-bottom: 2px solid rgba(0, 0, 0, 0.05) !important;
    border-top: none !important;
}

table.dataTable.table-sm>tbody>tr>td {
    border-top: 1px solid rgba(0, 0, 0, 0.03) !important;
}

body.dark-mode table.dataTable.table-sm>thead>tr>th {
    border-bottom: 2px solid rgba(255, 255, 255, 0.05) !important;
}

body.dark-mode table.dataTable.table-sm>tbody>tr>td {
    border-top: 1px solid rgba(255, 255, 255, 0.03) !important;
}

/* --------------------------------------------------------------------------
   8. TOASTR macOS GLASSMORPHISM
   -------------------------------------------------------------------------- */
#toast-container>div {
    border-radius: 16px !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.25) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    padding: 15px 15px 15px 50px !important;
    opacity: 1 !important;
}

/* Toastr Colors */
#toast-container>.toast-success {
    background-color: rgba(34, 197, 94, 0.85) !important;
}

#toast-container>.toast-error {
    background-color: rgba(239, 68, 68, 0.85) !important;
}

#toast-container>.toast-info {
    background-color: rgba(59, 130, 246, 0.85) !important;
}

#toast-container>.toast-warning {
    background-color: rgba(245, 158, 11, 0.85) !important;
}

/* --------------------------------------------------------------------------
   9. NEON GLOW FOCUS (Active State)
   -------------------------------------------------------------------------- */
.form-control:focus,
.custom-select:focus {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15), 0 0 10px rgba(79, 70, 229, 0.2) !important;
}

body.dark-mode .form-control:focus,
body.dark-mode .custom-select:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25), 0 0 15px rgba(99, 102, 241, 0.3) !important;
}

/* --------------------------------------------------------------------------
   10. ENHANCED DARK MODE SCROLLBAR
   -------------------------------------------------------------------------- */
body.dark-mode ::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.8) !important;
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.5) !important;
    border-radius: 10px !important;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.7) !important;
}

/* Force Dark Mode on FAB Modal & Cards */
body.dark-mode #fabGlobalModal .modal-content,
body.dark-mode #fabGlobalModal .card,
body.dark-mode #fabGlobalModal .bg-white {
    background: rgba(15, 23, 42, 0.95) !important;
    color: #e2e8f0 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode #fabGlobalModal .form-control {
    background: rgba(30, 41, 59, 0.9) !important;
    color: #f8fafc !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* --------------------------------------------------------------------------
   8. DASHBOARD WIDGETS 3D HOVER (Floating Cards)
   -------------------------------------------------------------------------- */
.info-box {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease !important;
}

.info-box:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.15) !important;
    z-index: 2;
}

body.dark-mode .info-box:hover {
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.5) !important;
}

/* --------------------------------------------------------------------------
   9. SIDEBAR NEON GLOW (Active State)
   -------------------------------------------------------------------------- */
.nav-pills .nav-link.active,
.nav-pills .show>.nav-link {
    background: linear-gradient(135deg, var(--primary), var(--info)) !important;
    color: #fff !important;
    border-radius: 50px !important;
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4) !important;
    border: none !important;
    font-weight: 600;
}

body.dark-mode .nav-pills .nav-link.active {
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.6) !important;
}

.nav-sidebar .nav-item>.nav-link {
    transition: all 0.3s ease;
    border-radius: 50px;
}

.nav-sidebar .nav-item>.nav-link:hover:not(.active) {
    transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   10. SWEETALERT2 PREMIUM OVERHAUL (macOS/iOS Style)
   -------------------------------------------------------------------------- */
.swal2-popup {
    border-radius: 24px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
}

body.dark-mode .swal2-popup {
    background: rgba(15, 23, 42, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0 !important;
}

.swal2-title {
    font-family: var(--font-family) !important;
    font-weight: 800 !important;
    letter-spacing: -0.03em;
}

body.dark-mode .swal2-title,
body.dark-mode .swal2-html-container {
    color: #f8fafc !important;
}

.swal2-confirm,
.swal2-cancel {
    border-radius: 50px !important;
    font-weight: 600 !important;
    padding: 12px 28px !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.swal2-confirm {
    background: linear-gradient(135deg, var(--primary), var(--info)) !important;
    box-shadow: 0 8px 15px -3px rgba(79, 70, 229, 0.3) !important;
    border: none !important;
}

.swal2-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -3px rgba(79, 70, 229, 0.5) !important;
}

.swal2-cancel {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: none !important;
}

body.dark-mode .swal2-cancel {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0 !important;
}

.swal2-cancel:hover {
    background: #e2e8f0 !important;
    transform: translateY(-2px);
}

body.dark-mode .swal2-cancel:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

.swal2-container.swal2-backdrop-show,
.swal2-container.swal2-noanimation {
    background: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
}