/**
 * Premium UX System - Koperasi SSA
 * Typography, Animations, Shadows, Skeleton Loading
 */

/* ========================================
   0. GOOGLE FONTS - INTER
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ========================================
   1. CSS VARIABLES
   ======================================== */
:root {
    /* ===== COLOR PALETTE - MODERN ===== */
    /* Primary - Modern Blue */
    --color-primary: #2563eb;
    --color-primary-light: #3b82f6;
    --color-primary-dark: #1d4ed8;
    --color-primary-50: #eff6ff;
    --color-primary-100: #dbeafe;

    /* Accent - Vibrant Indigo */
    --color-accent: #6366f1;
    --color-accent-light: #818cf8;
    --color-accent-dark: #4f46e5;

    /* Success - Emerald */
    --color-success: #10b981;
    --color-success-light: #34d399;
    --color-success-dark: #059669;

    /* Warning - Amber */
    --color-warning: #f59e0b;
    --color-warning-light: #fbbf24;
    --color-warning-dark: #d97706;

    /* Danger - Rose */
    --color-danger: #ef4444;
    --color-danger-light: #f87171;
    --color-danger-dark: #dc2626;

    /* Neutral - Slate */
    --color-gray-50: #f8fafc;
    --color-gray-100: #f1f5f9;
    --color-gray-200: #e2e8f0;
    --color-gray-300: #cbd5e1;
    --color-gray-400: #94a3b8;
    --color-gray-500: #64748b;
    --color-gray-600: #475569;
    --color-gray-700: #334155;
    --color-gray-800: #1e293b;
    --color-gray-900: #0f172a;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    --gradient-dark: linear-gradient(135deg, var(--color-gray-800) 0%, var(--color-gray-900) 100%);
    --gradient-light: linear-gradient(135deg, #ffffff 0%, var(--color-gray-50) 100%);

    /* ===== BORDER RADIUS - SMOOTH ===== */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;

    /* Timing Functions - Smooth & Natural */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

    /* Duration Presets */
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    /* Shadow Presets */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    /* ===== SEMANTIC VARIABLES (DEFAULT / LIGHT) ===== */
    --app-bg: #f8fafc;
    --app-bg-alt: #f1f5f9;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-base: #e2e8f0;
    --input-bg: #ffffff;
    --table-header-bg: #1e293b;
    --table-header-text: #ffffff;
    --table-hover-bg: rgba(0, 0, 0, 0.03);
    --modal-bg: #ffffff;
}

/* ===== DARK MODE OVERRIDES (Manual & Bootstrap) ===== */
[data-theme="dark"],
.dark-mode,
[data-bs-theme="dark"] {
    --app-bg: #0f172a;
    --app-bg-alt: #1e293b;
    --card-bg: #1e293b;
    --card-border: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-base: #334155;
    --input-bg: #1e293b;
    --table-header-bg: #0f172a;
    --table-header-text: #f8fafc;
    --table-hover-bg: rgba(255, 255, 255, 0.07);
    --modal-bg: #1e293b;

    /* Legacy compatibility for --dm-* variables */
    --dm-bg-primary: #0f172a;
    --dm-bg-secondary: #1e293b;
    --dm-bg-card: #1e293b;
    --dm-text-primary: #f8fafc;
    --dm-text-secondary: #cbd5e1;
    --dm-border: #334155;
    --dm-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}


/* ===== APPLY MODERN COLORS TO BOOTSTRAP ===== */

/* Primary button */
.btn-primary {
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-accent-dark) 100%);
}

/* Outline button */
.btn-outline-primary {
    color: var(--color-primary);
    border-color: var(--color-primary);
    border-radius: var(--radius-md);
}

.btn-outline-primary:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

/* Secondary button */
.btn-secondary {
    background: var(--color-gray-600);
    border-radius: var(--radius-md);
}

/* Success, danger, warning buttons */
.btn-success {
    background: var(--color-success);
    border-color: var(--color-success);
    border-radius: var(--radius-md);
}

.btn-danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
    border-radius: var(--radius-md);
}

.btn-warning {
    background: var(--color-warning);
    border-color: var(--color-warning);
    border-radius: var(--radius-md);
}

/* ===== ROUNDED CORNERS GLOBAL ===== */

/* Cards */
.card {
    border-radius: var(--radius-lg);
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
}

.card-header {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--card-border);
}

.card-footer {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background-color: var(--card-bg);
    border-top: 1px solid var(--card-border);
}

/* Form controls */
.form-control,
.form-select {
    border-radius: var(--radius-md);
    background-color: var(--input-bg);
    border-color: var(--border-base);
    color: var(--text-main);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--input-bg);
    color: var(--text-main);
    border-color: var(--color-primary);
}

/* Input groups */
.input-group>.form-control:first-child,
.input-group>.input-group-text:first-child {
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
}

.input-group>.form-control:last-child,
.input-group>.input-group-text:last-child,
.input-group>.btn:last-child {
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

/* Modals */
.modal-content {
    border-radius: var(--radius-xl);
    background-color: var(--modal-bg);
    color: var(--text-main);
    border: 1px solid var(--card-border);
}

/* Dropdowns */
.dropdown-menu {
    border-radius: var(--radius-md);
}

/* Badges */
.badge {
    border-radius: var(--radius-full);
    padding: 0.35em 0.75em;
}

/* Alerts */
.alert {
    border-radius: var(--radius-md);
}

/* ========================================
   1.5. TYPOGRAPHY SYSTEM
   ======================================== */

/* Apply Inter font to everything */
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    background-color: var(--app-bg);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Headings */
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
    font-family: var(--font-family);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

h1,
.h1 {
    font-size: var(--font-size-3xl);
}

h2,
.h2 {
    font-size: var(--font-size-2xl);
}

h3,
.h3 {
    font-size: var(--font-size-xl);
}

h4,
.h4 {
    font-size: var(--font-size-lg);
}

h5,
.h5 {
    font-size: var(--font-size-base);
}

h6,
.h6 {
    font-size: var(--font-size-sm);
}

/* Small text */
small,
.small,
.text-sm {
    font-size: var(--font-size-sm);
}

.text-xs {
    font-size: var(--font-size-xs);
}

/* Font weights */
.fw-medium {
    font-weight: 500;
}

.fw-semibold {
    font-weight: 600;
}

/* Better text rendering for cards */
.card-title {
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-text {
    color: #6b7280;
}

/* ========================================
   2. KEYFRAME ANIMATIONS
   ======================================== */

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Scale */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Pulse Subtle */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Skeleton Shimmer */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Spin */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   3. UTILITY CLASSES - ANIMATIONS
   ======================================== */

/* Apply fade-in to page content */
.animate-fadeIn {
    animation: fadeIn var(--duration-normal) var(--ease-out-expo);
}

.animate-fadeInUp {
    animation: fadeInUp var(--duration-slow) var(--ease-out-expo);
}

.animate-fadeInScale {
    animation: fadeInScale var(--duration-normal) var(--ease-out-expo);
}

/* Staggered children animation */
.animate-stagger>* {
    opacity: 0;
    animation: fadeInUp var(--duration-slow) var(--ease-out-expo) forwards;
}

.animate-stagger>*:nth-child(1) {
    animation-delay: 0ms;
}

.animate-stagger>*:nth-child(2) {
    animation-delay: 50ms;
}

.animate-stagger>*:nth-child(3) {
    animation-delay: 100ms;
}

.animate-stagger>*:nth-child(4) {
    animation-delay: 150ms;
}

.animate-stagger>*:nth-child(5) {
    animation-delay: 200ms;
}

.animate-stagger>*:nth-child(6) {
    animation-delay: 250ms;
}

/* ========================================
   4. HOVER EFFECTS
   ======================================== */

/* Lift on hover - for cards */
.hover-lift {
    transition: transform var(--duration-normal) var(--ease-out-expo),
        box-shadow var(--duration-normal) var(--ease-out-expo);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Scale on hover - for buttons/icons */
.hover-scale {
    transition: transform var(--duration-fast) var(--ease-out-expo);
}

.hover-scale:hover {
    transform: scale(1.02);
}

/* Glow on hover */
.hover-glow {
    transition: box-shadow var(--duration-normal) var(--ease-out-expo);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(13, 110, 253, 0.3);
}

/* Brighten on hover */
.hover-brighten {
    transition: filter var(--duration-fast) var(--ease-out-expo);
}

.hover-brighten:hover {
    filter: brightness(1.05);
}

/* ========================================
   5. FOCUS STATES - PREMIUM
   ======================================== */

/* Smooth focus ring for inputs */
.form-control,
.form-select {
    transition: border-color var(--duration-fast) var(--ease-in-out),
        box-shadow var(--duration-fast) var(--ease-in-out);
}

.form-control:focus,
.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.15);
}

/* ========================================
   6. BUTTON ENHANCEMENTS
   ======================================== */

.btn {
    transition: all var(--duration-fast) var(--ease-out-expo);
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

/* Button Loading State */
.btn.is-loading {
    color: transparent !important;
    pointer-events: none;
    position: relative;
}

.btn.is-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn-primary.is-loading::after {
    border-color: rgba(255, 255, 255, 0.4);
    border-right-color: transparent;
}

/* ========================================
   7. CARD ENHANCEMENTS - SOFT SHADOWS
   ======================================== */

.card {
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: transform var(--duration-normal) var(--ease-out-expo),
        box-shadow var(--duration-normal) var(--ease-out-expo);
}

/* Card dengan hover lift */
.card.card-interactive:hover,
.card.card-summary:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Override Bootstrap shadow classes untuk lebih halus */
.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow {
    box-shadow: var(--shadow-md) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}

/* Card tanpa border yang kasar */
.card.border-0,
.card.card-summary {
    border: none;
    box-shadow: var(--shadow-md);
}

/* Modal dengan soft shadow */
.modal-content {
    box-shadow: var(--shadow-xl);
    border: none;
}

/* Dropdown dengan soft shadow */
.dropdown-menu {
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* ========================================
   8. BETTER TABLES
   ======================================== */

/* Base table styling */
.table {
    border-collapse: separate;
    border-spacing: 0;
}

/* Sticky header */
.table-sticky thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-sticky thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: #475569;
    padding: 0.875rem 0.75rem;
}

/* Alternating row colors (zebra stripes) */
.table-striped-subtle tbody tr:nth-child(odd) {
    background-color: rgba(248, 250, 252, 0.5);
}

.table-striped-subtle tbody tr:nth-child(even) {
    background-color: #ffffff;
}

/* Row transitions */
.table tbody tr {
    transition: background-color var(--duration-fast) var(--ease-in-out);
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.04) !important;
}

/* Sortable column header */
.table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.5rem;
}

.table th.sortable::after {
    content: '\F282';
    font-family: 'bootstrap-icons';
    position: absolute;
    right: 0.5rem;
    opacity: 0.3;
    transition: opacity var(--duration-fast), transform var(--duration-fast);
}

.table th.sortable:hover::after {
    opacity: 0.6;
}

.table th.sortable.sort-asc::after {
    content: '\F286';
    opacity: 1;
}

.table th.sortable.sort-desc::after {
    content: '\F282';
    opacity: 1;
}

/* Sorting animation for rows */
.table tbody tr.sorting {
    animation: tableRowSort var(--duration-normal) var(--ease-out-expo);
}

@keyframes tableRowSort {
    from {
        opacity: 0.5;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Table cell padding improvements */
.table td,
.table th {
    vertical-align: middle;
}

/* Responsive table shadow indicator */
.table-responsive {
    position: relative;
}

.table-responsive::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.05));
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.table-responsive.has-scroll::after {
    opacity: 1;
}

/* ========================================
   9. SKELETON LOADING - ENHANCED
   ======================================== */

.skeleton {
    background: linear-gradient(90deg,
            #f0f0f0 25%,
            #e0e0e0 50%,
            #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    color: transparent !important;
}

/* Basic shapes */
.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    width: 100%;
}

.skeleton-text-sm {
    height: 0.75em;
    width: 60%;
}

.skeleton-text-lg {
    height: 1.5em;
    width: 80%;
}

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
    border-radius: 12px;
}

/* Ready-to-use skeleton components */
.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.skeleton-button {
    height: 38px;
    width: 100px;
    border-radius: 6px;
}

.skeleton-input {
    height: 38px;
    width: 100%;
    border-radius: 6px;
}

.skeleton-badge {
    height: 20px;
    width: 60px;
    border-radius: 10px;
    display: inline-block;
}

/* Skeleton table row */
.skeleton-table-row {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.skeleton-table-row>div {
    height: 1em;
    flex: 1;
}

/* Skeleton card with content */
.skeleton-card-content {
    padding: 1rem;
}

.skeleton-card-content .skeleton-text:last-child {
    margin-bottom: 0;
}

/* ========================================
   10. MODAL ANIMATIONS
   ======================================== */

.modal.fade .modal-dialog {
    transform: scale(0.95) translateY(-20px);
    transition: transform var(--duration-normal) var(--ease-out-expo);
}

.modal.show .modal-dialog {
    transform: scale(1) translateY(0);
}

.modal-backdrop.fade {
    transition: opacity var(--duration-normal) var(--ease-in-out);
}

/* ========================================
   11. SIDEBAR MENU TRANSITIONS
   ======================================== */

.nav-link,
.dropdown-item {
    transition: background-color var(--duration-fast) var(--ease-in-out),
        color var(--duration-fast) var(--ease-in-out),
        padding-left var(--duration-fast) var(--ease-out-expo);
}

.nav-link:hover,
.dropdown-item:hover {
    padding-left: calc(var(--bs-nav-link-padding-x, 1rem) + 4px);
}

/* ========================================
   12. BADGE & ALERT ANIMATIONS
   ======================================== */

.badge {
    transition: transform var(--duration-fast) var(--ease-out-expo);
}

.badge:hover {
    transform: scale(1.05);
}

.alert {
    animation: fadeInUp var(--duration-slow) var(--ease-out-expo);
}

/* ========================================
   13. PAGE LOAD ANIMATION
   ======================================== */

.container-fluid,
.container {
    animation: fadeIn var(--duration-slow) var(--ease-out-expo);
}

/* ========================================
   14. ICON ANIMATIONS
   ======================================== */

.icon-box {
    transition: transform var(--duration-normal) var(--ease-out-expo),
        background-color var(--duration-normal) var(--ease-in-out);
}

.card:hover .icon-box {
    transform: scale(1.1);
}

/* ========================================
   15. PROGRESS BAR ANIMATION
   ======================================== */

.progress-bar {
    transition: width 0.6s var(--ease-out-expo);
}

/* Animated progress on load */
.progress-animated .progress-bar {
    animation: progressGrow 1s var(--ease-out-expo) forwards;
}

@keyframes progressGrow {
    from {
        width: 0%;
    }
}

/* ========================================
   16. EMPTY STATES
   ======================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    animation: fadeInUp var(--duration-slow) var(--ease-out-expo);
}

.empty-state-icon {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.empty-state-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.empty-state-text {
    font-size: var(--font-size-sm);
    color: #6b7280;
    max-width: 300px;
    line-height: 1.5;
}

.empty-state-action {
    margin-top: 1.5rem;
}

/* Variasi warna untuk empty state */
.empty-state.empty-state-warning .empty-state-icon {
    color: #f59e0b;
}

.empty-state.empty-state-info .empty-state-icon {
    color: #3b82f6;
}

/* Empty state compact untuk tabel */
.empty-state-compact {
    padding: 2rem 1rem;
}

.empty-state-compact .empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.empty-state-compact .empty-state-title {
    font-size: var(--font-size-base);
}

/* ========================================
   17. TOAST NOTIFICATIONS
   ======================================== */

/* Toast Container */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

/* Individual Toast */
.toast-notification {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid #3b82f6;
    min-width: 280px;
    max-width: 400px;
    pointer-events: auto;
    animation: toastSlideIn var(--duration-normal) var(--ease-out-expo);
}

.toast-notification.toast-exit {
    animation: toastSlideOut var(--duration-fast) var(--ease-in-out) forwards;
}

/* Toast Icon */
.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Toast Content */
.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: #111827;
    margin-bottom: 0.125rem;
}

.toast-message {
    font-size: var(--font-size-sm);
    color: #6b7280;
    line-height: 1.4;
}

/* Toast Close Button */
.toast-close {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: #9ca3af;
    font-size: 1rem;
    line-height: 1;
    transition: color var(--duration-fast);
}

.toast-close:hover {
    color: #374151;
}

/* Toast Types */
.toast-success {
    border-left-color: #10b981;
}

.toast-success .toast-icon {
    color: #10b981;
}

.toast-error {
    border-left-color: #ef4444;
}

.toast-error .toast-icon {
    color: #ef4444;
}

.toast-warning {
    border-left-color: #f59e0b;
}

.toast-warning .toast-icon {
    color: #f59e0b;
}

.toast-info {
    border-left-color: #3b82f6;
}

.toast-info .toast-icon {
    color: #3b82f6;
}

/* Toast Animations */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Toast Progress Bar (auto-dismiss indicator) */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    border-radius: 0 0 0 8px;
    animation: toastProgress linear forwards;
}

@keyframes toastProgress {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

/* ========================================
   18. FORM ENHANCEMENTS
   ======================================== */

/* Floating Labels */
.form-floating-premium {
    position: relative;
}

.form-floating-premium .form-control {
    height: calc(3.5rem + 2px);
    padding: 1.625rem 0.75rem 0.625rem;
}

.form-floating-premium .form-label {
    position: absolute;
    top: 0;
    left: 0;
    padding: 1rem 0.75rem;
    pointer-events: none;
    transform-origin: 0 0;
    transition: opacity var(--duration-fast) var(--ease-in-out),
        transform var(--duration-fast) var(--ease-in-out),
        color var(--duration-fast);
    color: #6b7280;
}

.form-floating-premium .form-control:focus~.form-label,
.form-floating-premium .form-control:not(:placeholder-shown)~.form-label {
    opacity: 0.8;
    transform: scale(0.85) translateY(-0.5rem);
    color: #0d6efd;
}

.form-floating-premium .form-control::placeholder {
    color: transparent;
}

.form-floating-premium .form-control:focus::placeholder {
    color: #9ca3af;
}

/* Inline Validation States */
.form-control.is-valid,
.form-control.is-invalid {
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

/* Valid state */
.form-control.is-valid {
    border-color: #10b981;
    background-image: none;
    animation: validPulse var(--duration-normal) var(--ease-out-expo);
}

.form-control.is-valid:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

/* Invalid state */
.form-control.is-invalid {
    border-color: #ef4444;
    animation: shake 0.4s var(--ease-out-expo);
}

.form-control.is-invalid:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

/* Validation feedback text */
.valid-feedback,
.invalid-feedback {
    font-size: var(--font-size-xs);
    margin-top: 0.25rem;
    animation: fadeInUp var(--duration-fast) var(--ease-out-expo);
}

.valid-feedback {
    color: #10b981;
}

.invalid-feedback {
    color: #ef4444;
}

/* Success checkmark */
.input-with-check {
    position: relative;
}

.input-with-check .check-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%) scale(0);
    color: #10b981;
    font-size: 1rem;
    transition: transform var(--duration-fast) var(--ease-out-expo);
    pointer-events: none;
}

.input-with-check .form-control.is-valid~.check-icon {
    transform: translateY(-50%) scale(1);
}

/* Shake animation for invalid */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-4px);
    }

    40% {
        transform: translateX(4px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

/* Pulse animation for valid */
@keyframes validPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Input group enhancements */
.input-group .form-control:focus {
    z-index: 3;
}

.input-group-text {
    transition: border-color var(--duration-fast), background-color var(--duration-fast);
}

.form-control:focus+.input-group-text,
.input-group-text:has(+ .form-control:focus) {
    border-color: #86b7fe;
    background-color: #e7f1ff;
}

/* ========================================
   19. SIDEBAR REDESIGN
   ======================================== */

/* Sidebar Container */
.sidebar,
#sidebar,
[class*="sidebar"] {
    background: var(--gradient-dark) !important;
    border-right: none !important;
}

/* Sidebar Header / Brand */
.sidebar-header,
.sidebar .navbar-brand,
#sidebar .navbar-brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Sidebar Nav Links */
.sidebar .nav-link,
#sidebar .nav-link,
.sidebar-menu .nav-link {
    color: rgba(255, 255, 255, 0.7) !important;
    padding: 0.75rem 1rem;
    margin: 0.125rem 0.5rem;
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) var(--ease-out-expo);
    font-weight: 500;
}

.sidebar .nav-link:hover,
#sidebar .nav-link:hover,
.sidebar-menu .nav-link:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.1);
    padding-left: 1.25rem;
}

.sidebar .nav-link.active,
#sidebar .nav-link.active,
.sidebar-menu .nav-link.active {
    color: #ffffff !important;
    background: var(--gradient-primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* Sidebar Icons */
.sidebar .nav-link i,
#sidebar .nav-link i,
.sidebar-menu .nav-link i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
    transition: transform var(--duration-fast);
}

.sidebar .nav-link:hover i,
#sidebar .nav-link:hover i {
    transform: scale(1.1);
}

/* Sidebar Submenu */
.sidebar .collapse .nav-link,
#sidebar .collapse .nav-link {
    padding-left: 2.5rem;
    font-size: var(--font-size-sm);
}

/* Sidebar Divider */
.sidebar hr,
#sidebar hr {
    border-color: rgba(255, 255, 255, 0.1);
    margin: 0.75rem 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

/* Sidebar User Info */
.sidebar .user-info,
#sidebar .user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.8);
}

.sidebar .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
}

/* Mobile Sidebar Overlay */
@media (max-width: 768px) {

    .sidebar,
    #sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        width: 280px;
        z-index: 1050;
        transition: left var(--duration-normal) var(--ease-out-expo);
    }

    .sidebar.show,
    #sidebar.show {
        left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1049;
        opacity: 0;
        visibility: hidden;
        transition: opacity var(--duration-normal), visibility var(--duration-normal);
    }

    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
}

/* ========================================
   20. CONFIRMATION DIALOGS (SweetAlert Override)
   ======================================== */

/* SweetAlert Popup */
.swal2-popup:not(.swal2-toast) {
    border-radius: var(--radius-xl) !important;
    padding: 2rem !important;
    font-family: var(--font-family) !important;
}


/* SweetAlert Title */
.swal2-title {
    font-size: var(--font-size-xl) !important;
    font-weight: 600 !important;
    color: var(--color-gray-800) !important;
}

/* SweetAlert Content */
.swal2-html-container {
    font-size: var(--font-size-base) !important;
    color: var(--color-gray-600) !important;
    line-height: 1.6 !important;
}

/* SweetAlert Icon */
.swal2-icon {
    border-width: 3px !important;
    margin: 1.5rem auto !important;
}

.swal2-icon.swal2-success {
    border-color: var(--color-success) !important;
    color: var(--color-success) !important;
}

.swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(16, 185, 129, 0.3) !important;
}

.swal2-icon.swal2-warning {
    border-color: var(--color-warning) !important;
    color: var(--color-warning) !important;
}

.swal2-icon.swal2-error {
    border-color: var(--color-danger) !important;
}

.swal2-icon.swal2-question {
    border-color: var(--color-primary) !important;
    color: var(--color-primary) !important;
}

/* SweetAlert Buttons */
.swal2-actions {
    gap: 0.75rem !important;
}

.swal2-confirm {
    background: var(--gradient-primary) !important;
    border: none !important;
    border-radius: var(--radius-md) !important;
    padding: 0.625rem 1.5rem !important;
    font-weight: 500 !important;
    transition: all var(--duration-fast) !important;
}

.swal2-confirm:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4) !important;
}

.swal2-cancel {
    background: var(--color-gray-200) !important;
    color: var(--color-gray-700) !important;
    border: none !important;
    border-radius: var(--radius-md) !important;
    padding: 0.625rem 1.5rem !important;
    font-weight: 500 !important;
}

.swal2-cancel:hover {
    background: var(--color-gray-300) !important;
}

.swal2-deny {
    background: var(--color-danger) !important;
    border-radius: var(--radius-md) !important;
}

/* SweetAlert Backdrop */
.swal2-backdrop-show {
    background: rgba(15, 23, 42, 0.6) !important;
}

/* ========================================
   21. SEARCH HIGHLIGHT
   ======================================== */

/* Highlighted text */
.search-highlight,
mark.highlight,
.highlight {
    background: linear-gradient(135deg, #fef08a 0%, #fde047 100%);
    color: var(--color-gray-900);
    padding: 0.1em 0.25em;
    border-radius: 3px;
    font-weight: 500;
    animation: highlightPulse 0.5s var(--ease-out-expo);
}

@keyframes highlightPulse {
    0% {
        background: rgba(250, 204, 21, 0.8);
        box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.3);
    }

    100% {
        background: linear-gradient(135deg, #fef08a 0%, #fde047 100%);
        box-shadow: none;
    }
}

/* Search result item */
.search-result {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color var(--duration-fast);
}

.search-result:hover {
    background: var(--color-gray-100);
}

.search-result.active {
    background: var(--color-primary-50);
    border-left: 3px solid var(--color-primary);
}

/* Search input with icon */
.search-input-wrapper {
    position: relative;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-gray-400);
    pointer-events: none;
}

.search-input-wrapper .form-control {
    padding-left: 2.5rem;
}

.search-input-wrapper .clear-search {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-gray-400);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.search-input-wrapper .form-control:not(:placeholder-shown)~.clear-search {
    opacity: 1;
}

.search-input-wrapper .clear-search:hover {
    color: var(--color-gray-600);
    background: var(--color-gray-100);
}

/* ========================================
   22. BREADCRUMBS
   ======================================== */

.breadcrumb {
    background: var(--color-gray-50);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.breadcrumb-item {
    font-size: var(--font-size-sm);
    color: var(--color-gray-500);
}

.breadcrumb-item a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--duration-fast);
}

.breadcrumb-item a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--color-gray-700);
    font-weight: 500;
}

/* Custom separator */
.breadcrumb-item+.breadcrumb-item::before {
    content: '\F285' !important;
    font-family: 'bootstrap-icons' !important;
    font-size: 0.65rem;
    color: var(--color-gray-400);
    padding: 0 0.5rem;
}

/* Breadcrumb with icons */
.breadcrumb-item i {
    margin-right: 0.375rem;
    font-size: 0.875rem;
}

/* Breadcrumb compact */
.breadcrumb-compact {
    background: transparent;
    padding: 0.5rem 0;
}

/* Responsive breadcrumb */
@media (max-width: 576px) {
    .breadcrumb {
        padding: 0.5rem 0.75rem;
        font-size: var(--font-size-xs);
    }

    .breadcrumb-item+.breadcrumb-item::before {
        padding: 0 0.35rem;
    }
}

/* ========================================
   23. DARK MODE SUPPORT
   ======================================== */

/* Dark Mode Variables */
[data-theme="dark"],
.dark-mode,
[data-bs-theme="dark"] {
    /* Background colors */
    --dm-bg-primary: #0f172a;
    --dm-bg-secondary: #1e293b;
    --dm-bg-tertiary: #334155;
    --dm-bg-elevated: #1e293b;
    --dm-bg-card: #1e293b;
    --dm-bg-hover: #334155;
    --dm-bg-input: #1e293b;

    /* Text colors */
    --dm-text-primary: #f8fafc;
    --dm-text-secondary: #cbd5e1;
    --dm-text-muted: #94a3b8;
    --dm-text-disabled: #64748b;

    /* Border colors */
    --dm-border: #334155;
    --dm-border-subtle: #293548;

    /* Primary colors (adjusted for dark) */
    --dm-primary: #3b82f6;
    --dm-primary-hover: #60a5fa;

    /* Status colors (adjusted for dark) */
    --dm-success: #22c55e;
    --dm-warning: #fbbf24;
    --dm-danger: #f87171;
    --dm-info: #38bdf8;

    /* Shadows for dark mode */
    --dm-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --dm-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --dm-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

/* ===== DARK MODE: BODY & GENERAL ===== */
[data-theme="dark"] body,
.dark-mode body,
[data-bs-theme="dark"] body {
    background-color: var(--dm-bg-primary);
    color: var(--dm-text-primary);
}

[data-theme="dark"],
.dark-mode,
[data-bs-theme="dark"] {
    background-color: var(--dm-bg-primary);
    color: var(--dm-text-primary);
}

/* ===== DARK MODE: CARDS ===== */
[data-theme="dark"] .card,
.dark-mode .card,
[data-bs-theme="dark"] .card {
    background-color: var(--dm-bg-card);
    border-color: var(--dm-border);
    box-shadow: var(--dm-shadow-md);
}

[data-theme="dark"] .card-header,
.dark-mode .card-header,
[data-bs-theme="dark"] .card-header {
    background-color: var(--dm-bg-tertiary);
    border-bottom-color: var(--dm-border);
    color: var(--dm-text-primary);
}

[data-theme="dark"] .card-footer,
.dark-mode .card-footer,
[data-bs-theme="dark"] .card-footer {
    background-color: var(--dm-bg-tertiary);
    border-top-color: var(--dm-border);
}

[data-theme="dark"] .card-title,
.dark-mode .card-title,
[data-bs-theme="dark"] .card-title {
    color: var(--dm-text-primary);
}

[data-theme="dark"] .card-text,
.dark-mode .card-text,
[data-bs-theme="dark"] .card-text {
    color: var(--dm-text-secondary);
}

/* ===== DARK MODE: FORMS ===== */
[data-theme="dark"] .form-control,
.dark-mode .form-control,
[data-bs-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
.dark-mode .form-select,
[data-bs-theme="dark"] .form-select {
    background-color: var(--dm-bg-input);
    border-color: var(--dm-border);
    color: var(--dm-text-primary);
}

[data-theme="dark"] .form-control::placeholder,
.dark-mode .form-control::placeholder,
[data-bs-theme="dark"] .form-control::placeholder {
    color: var(--dm-text-muted);
}

[data-theme="dark"] .form-control:focus,
.dark-mode .form-control:focus,
[data-bs-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus,
.dark-mode .form-select:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: var(--dm-bg-input);
    border-color: var(--dm-primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25);
    color: var(--dm-text-primary);
}

[data-theme="dark"] .form-control:disabled,
.dark-mode .form-control:disabled,
[data-bs-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-select:disabled,
.dark-mode .form-select:disabled,
[data-bs-theme="dark"] .form-select:disabled {
    background-color: var(--dm-bg-tertiary);
    color: var(--dm-text-disabled);
}

[data-theme="dark"] .input-group-text,
.dark-mode .input-group-text,
[data-bs-theme="dark"] .input-group-text {
    background-color: var(--dm-bg-tertiary);
    border-color: var(--dm-border);
    color: var(--dm-text-secondary);
}

[data-theme="dark"] .form-label,
.dark-mode .form-label,
[data-bs-theme="dark"] .form-label {
    color: var(--dm-text-secondary);
}

[data-theme="dark"] .form-text,
.dark-mode .form-text,
[data-bs-theme="dark"] .form-text {
    color: var(--dm-text-muted);
}

/* ===== DARK MODE: TABLES ===== */
[data-theme="dark"] .table,
.dark-mode .table,
[data-bs-theme="dark"] .table {
    color: var(--dm-text-primary);
}

[data-theme="dark"] .table thead th,
.dark-mode .table thead th,
[data-bs-theme="dark"] .table thead th {
    background-color: var(--dm-bg-tertiary);
    border-bottom-color: var(--dm-border);
    color: var(--dm-text-secondary);
}

[data-theme="dark"] .table-sticky thead,
.dark-mode .table-sticky thead,
[data-bs-theme="dark"] .table-sticky thead {
    background: var(--dm-bg-secondary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .table-sticky thead th,
.dark-mode .table-sticky thead th,
[data-bs-theme="dark"] .table-sticky thead th {
    background: var(--dm-bg-tertiary);
    border-bottom-color: var(--dm-border);
}

[data-theme="dark"] .table tbody td,
.dark-mode .table tbody td,
[data-bs-theme="dark"] .table tbody td {
    border-bottom-color: var(--dm-border-subtle);
}

[data-theme="dark"] .table-striped-subtle tbody tr:nth-child(odd),
.dark-mode .table-striped-subtle tbody tr:nth-child(odd),
[data-bs-theme="dark"] .table-striped-subtle tbody tr:nth-child(odd) {
    background-color: rgba(30, 41, 59, 0.5);
}

[data-theme="dark"] .table-striped-subtle tbody tr:nth-child(even),
.dark-mode .table-striped-subtle tbody tr:nth-child(even),
[data-bs-theme="dark"] .table-striped-subtle tbody tr:nth-child(even) {
    background-color: var(--dm-bg-card);
}

[data-theme="dark"] .table-hover tbody tr:hover,
.dark-mode .table-hover tbody tr:hover,
[data-bs-theme="dark"] .table-hover tbody tr:hover {
    background-color: var(--dm-bg-hover) !important;
}

/* Table Warning/Danger - Dark Mode Override */
[data-theme="dark"] .table-warning,
.dark-mode .table-warning,
[data-bs-theme="dark"] .table-warning,
[data-theme="dark"] tr.table-warning,
.dark-mode tr.table-warning,
[data-bs-theme="dark"] tr.table-warning {
    background-color: rgba(251, 191, 36, 0.2) !important;
}

[data-theme="dark"] .table-warning td,
.dark-mode .table-warning td,
[data-bs-theme="dark"] .table-warning td,
[data-theme="dark"] .table-warning td *,
.dark-mode .table-warning td *,
[data-bs-theme="dark"] .table-warning td * {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .table-warning .text-dark,
.dark-mode .table-warning .text-dark,
[data-bs-theme="dark"] .table-warning .text-dark,
[data-theme="dark"] .table-warning .text-muted,
.dark-mode .table-warning .text-muted,
[data-bs-theme="dark"] .table-warning .text-muted {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .table-danger,
.dark-mode .table-danger,
[data-bs-theme="dark"] .table-danger,
[data-theme="dark"] tr.table-danger,
.dark-mode tr.table-danger,
[data-bs-theme="dark"] tr.table-danger {
    background-color: rgba(239, 68, 68, 0.2) !important;
}

[data-theme="dark"] .table-danger td,
.dark-mode .table-danger td,
[data-bs-theme="dark"] .table-danger td,
[data-theme="dark"] .table-danger td *,
.dark-mode .table-danger td *,
[data-bs-theme="dark"] .table-danger td * {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .table-danger .text-dark,
.dark-mode .table-danger .text-dark,
[data-bs-theme="dark"] .table-danger .text-dark,
[data-theme="dark"] .table-danger .text-muted,
.dark-mode .table-danger .text-muted,
[data-bs-theme="dark"] .table-danger .text-muted {
    color: #e2e8f0 !important;
}

/* ===== DARK MODE: MODALS ===== */
[data-theme="dark"] .modal-content,
.dark-mode .modal-content,
[data-bs-theme="dark"] .modal-content {
    background-color: var(--dm-bg-card);
    border-color: var(--dm-border);
    box-shadow: var(--dm-shadow-lg);
}

[data-theme="dark"] .modal-header,
.dark-mode .modal-header,
[data-bs-theme="dark"] .modal-header {
    border-bottom-color: var(--dm-border);
}

[data-theme="dark"] .modal-footer,
.dark-mode .modal-footer,
[data-bs-theme="dark"] .modal-footer {
    border-top-color: var(--dm-border);
}

[data-theme="dark"] .modal-title,
.dark-mode .modal-title,
[data-bs-theme="dark"] .modal-title {
    color: var(--dm-text-primary);
}

[data-theme="dark"] .btn-close,
.dark-mode .btn-close,
[data-bs-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ===== DARK MODE: DROPDOWNS ===== */
[data-theme="dark"] .dropdown-menu,
.dark-mode .dropdown-menu,
[data-bs-theme="dark"] .dropdown-menu {
    background-color: var(--dm-bg-elevated);
    border-color: var(--dm-border);
    box-shadow: var(--dm-shadow-lg);
}

[data-theme="dark"] .dropdown-item,
.dark-mode .dropdown-item,
[data-bs-theme="dark"] .dropdown-item {
    color: var(--dm-text-primary);
}

[data-theme="dark"] .dropdown-item:hover,
.dark-mode .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus,
.dark-mode .dropdown-item:focus,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: var(--dm-bg-hover);
    color: var(--dm-text-primary);
}

[data-theme="dark"] .dropdown-divider,
.dark-mode .dropdown-divider,
[data-bs-theme="dark"] .dropdown-divider {
    border-color: var(--dm-border);
}

/* ===== DARK MODE: BUTTONS ===== */
[data-theme="dark"] .btn-secondary,
.dark-mode .btn-secondary,
[data-bs-theme="dark"] .btn-secondary {
    background-color: var(--dm-bg-tertiary);
    border-color: var(--dm-border);
    color: var(--dm-text-primary);
}

[data-theme="dark"] .btn-secondary:hover,
.dark-mode .btn-secondary:hover,
[data-bs-theme="dark"] .btn-secondary:hover {
    background-color: var(--dm-bg-hover);
}

[data-theme="dark"] .btn-outline-secondary,
.dark-mode .btn-outline-secondary,
[data-bs-theme="dark"] .btn-outline-secondary {
    border-color: var(--dm-border);
    color: var(--dm-text-secondary);
}

[data-theme="dark"] .btn-outline-secondary:hover,
.dark-mode .btn-outline-secondary:hover,
[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--dm-bg-tertiary);
    color: var(--dm-text-primary);
}

[data-theme="dark"] .btn-light,
.dark-mode .btn-light,
[data-bs-theme="dark"] .btn-light {
    background-color: var(--dm-bg-tertiary);
    border-color: var(--dm-border);
    color: var(--dm-text-primary);
}

/* ===== DARK MODE: ALERTS ===== */
[data-theme="dark"] .alert,
.dark-mode .alert,
[data-bs-theme="dark"] .alert {
    border-width: 1px;
}

[data-theme="dark"] .alert-primary,
.dark-mode .alert-primary,
[data-bs-theme="dark"] .alert-primary {
    background-color: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

[data-theme="dark"] .alert-success,
.dark-mode .alert-success,
[data-bs-theme="dark"] .alert-success {
    background-color: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

[data-theme="dark"] .alert-warning,
.dark-mode .alert-warning,
[data-bs-theme="dark"] .alert-warning {
    background-color: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.3);
    color: #fde68a;
}

[data-theme="dark"] .alert-danger,
.dark-mode .alert-danger,
[data-bs-theme="dark"] .alert-danger {
    background-color: rgba(248, 113, 113, 0.15);
    border-color: rgba(248, 113, 113, 0.3);
    color: #fca5a5;
}

[data-theme="dark"] .alert-info,
.dark-mode .alert-info,
[data-bs-theme="dark"] .alert-info {
    background-color: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.3);
    color: #7dd3fc;
}

/* ===== DARK MODE: BADGES ===== */
[data-theme="dark"] .badge.bg-light,
.dark-mode .badge.bg-light,
[data-bs-theme="dark"] .badge.bg-light {
    background-color: var(--dm-bg-tertiary) !important;
    color: var(--dm-text-primary);
}

[data-theme="dark"] .badge.bg-secondary,
.dark-mode .badge.bg-secondary,
[data-bs-theme="dark"] .badge.bg-secondary {
    background-color: var(--dm-bg-tertiary) !important;
    color: var(--dm-text-secondary);
}

/* ===== DARK MODE: TOAST NOTIFICATIONS ===== */
[data-theme="dark"] .toast-notification,
.dark-mode .toast-notification,
[data-bs-theme="dark"] .toast-notification {
    background: var(--dm-bg-elevated);
    box-shadow: var(--dm-shadow-lg);
}

[data-theme="dark"] .toast-title,
.dark-mode .toast-title,
[data-bs-theme="dark"] .toast-title {
    color: var(--dm-text-primary);
}

[data-theme="dark"] .toast-message,
.dark-mode .toast-message,
[data-bs-theme="dark"] .toast-message {
    color: var(--dm-text-secondary);
}

[data-theme="dark"] .toast-close,
.dark-mode .toast-close,
[data-bs-theme="dark"] .toast-close {
    color: var(--dm-text-muted);
}

[data-theme="dark"] .toast-close:hover,
.dark-mode .toast-close:hover,
[data-bs-theme="dark"] .toast-close:hover {
    color: var(--dm-text-primary);
}

/* ===== DARK MODE: SKELETON LOADING ===== */
[data-theme="dark"] .skeleton,
.dark-mode .skeleton,
[data-bs-theme="dark"] .skeleton {
    background: linear-gradient(90deg,
            var(--dm-bg-tertiary) 25%,
            var(--dm-bg-hover) 50%,
            var(--dm-bg-tertiary) 75%);
    background-size: 200% 100%;
}

/* ===== DARK MODE: EMPTY STATES ===== */
[data-theme="dark"] .empty-state-icon,
.dark-mode .empty-state-icon,
[data-bs-theme="dark"] .empty-state-icon {
    color: var(--dm-text-muted);
}

[data-theme="dark"] .empty-state-title,
.dark-mode .empty-state-title,
[data-bs-theme="dark"] .empty-state-title {
    color: var(--dm-text-primary);
}

[data-theme="dark"] .empty-state-text,
.dark-mode .empty-state-text,
[data-bs-theme="dark"] .empty-state-text {
    color: var(--dm-text-secondary);
}

/* ===== DARK MODE: BREADCRUMBS ===== */
[data-theme="dark"] .breadcrumb,
.dark-mode .breadcrumb,
[data-bs-theme="dark"] .breadcrumb {
    background: var(--dm-bg-secondary);
}

[data-theme="dark"] .breadcrumb-item,
.dark-mode .breadcrumb-item,
[data-bs-theme="dark"] .breadcrumb-item {
    color: var(--dm-text-muted);
}

[data-theme="dark"] .breadcrumb-item a,
.dark-mode .breadcrumb-item a,
[data-bs-theme="dark"] .breadcrumb-item a {
    color: var(--dm-primary);
}

[data-theme="dark"] .breadcrumb-item.active,
.dark-mode .breadcrumb-item.active,
[data-bs-theme="dark"] .breadcrumb-item.active {
    color: var(--dm-text-primary);
}

/* ===== DARK MODE: SEARCH HIGHLIGHT ===== */
[data-theme="dark"] .search-highlight,
.dark-mode .search-highlight,
[data-bs-theme="dark"] .search-highlight,
[data-theme="dark"] mark.highlight,
.dark-mode mark.highlight,
[data-bs-theme="dark"] mark.highlight {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.3) 0%, rgba(245, 158, 11, 0.3) 100%);
    color: #fde68a;
}

[data-theme="dark"] .search-result:hover,
.dark-mode .search-result:hover,
[data-bs-theme="dark"] .search-result:hover {
    background: var(--dm-bg-hover);
}

[data-theme="dark"] .search-result.active,
.dark-mode .search-result.active,
[data-bs-theme="dark"] .search-result.active {
    background: rgba(59, 130, 246, 0.2);
    border-left-color: var(--dm-primary);
}

/* ===== DARK MODE: NAV TABS ===== */
[data-theme="dark"] .nav-tabs,
.dark-mode .nav-tabs,
[data-bs-theme="dark"] .nav-tabs {
    border-bottom-color: var(--dm-border);
}

[data-theme="dark"] .nav-tabs .nav-link,
.dark-mode .nav-tabs .nav-link,
[data-bs-theme="dark"] .nav-tabs .nav-link {
    color: var(--dm-text-secondary);
}

[data-theme="dark"] .nav-tabs .nav-link:hover,
.dark-mode .nav-tabs .nav-link:hover,
[data-bs-theme="dark"] .nav-tabs .nav-link:hover {
    border-color: var(--dm-border) var(--dm-border) transparent;
    color: var(--dm-text-primary);
}

[data-theme="dark"] .nav-tabs .nav-link.active,
.dark-mode .nav-tabs .nav-link.active,
[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    background-color: var(--dm-bg-card);
    border-color: var(--dm-border) var(--dm-border) var(--dm-bg-card);
    color: var(--dm-text-primary);
}

/* ===== DARK MODE: NAV PILLS ===== */
[data-theme="dark"] .nav-pills .nav-link,
.dark-mode .nav-pills .nav-link,
[data-bs-theme="dark"] .nav-pills .nav-link {
    color: var(--dm-text-secondary);
}

[data-theme="dark"] .nav-pills .nav-link:hover,
.dark-mode .nav-pills .nav-link:hover,
[data-bs-theme="dark"] .nav-pills .nav-link:hover {
    background-color: var(--dm-bg-hover);
    color: var(--dm-text-primary);
}

[data-theme="dark"] .nav-pills .nav-link.active,
.dark-mode .nav-pills .nav-link.active,
[data-bs-theme="dark"] .nav-pills .nav-link.active {
    background: var(--gradient-primary);
}

/* ===== DARK MODE: LIST GROUP ===== */
[data-theme="dark"] .list-group-item,
.dark-mode .list-group-item,
[data-bs-theme="dark"] .list-group-item {
    background-color: var(--dm-bg-card);
    border-color: var(--dm-border);
    color: var(--dm-text-primary);
}

[data-theme="dark"] .list-group-item:hover,
.dark-mode .list-group-item:hover,
[data-bs-theme="dark"] .list-group-item:hover {
    background-color: var(--dm-bg-hover);
}

[data-theme="dark"] .list-group-item.active,
.dark-mode .list-group-item.active,
[data-bs-theme="dark"] .list-group-item.active {
    background: var(--gradient-primary);
    border-color: var(--dm-primary);
}

/* ===== DARK MODE: PAGINATION ===== */
[data-theme="dark"] .page-link,
.dark-mode .page-link,
[data-bs-theme="dark"] .page-link {
    background-color: var(--dm-bg-card);
    border-color: var(--dm-border);
    color: var(--dm-text-primary);
}

[data-theme="dark"] .page-link:hover,
.dark-mode .page-link:hover,
[data-bs-theme="dark"] .page-link:hover {
    background-color: var(--dm-bg-hover);
    border-color: var(--dm-border);
    color: var(--dm-text-primary);
}

[data-theme="dark"] .page-item.active .page-link,
.dark-mode .page-item.active .page-link,
[data-bs-theme="dark"] .page-item.active .page-link {
    background: var(--gradient-primary);
    border-color: var(--dm-primary);
}

[data-theme="dark"] .page-item.disabled .page-link,
.dark-mode .page-item.disabled .page-link,
[data-bs-theme="dark"] .page-item.disabled .page-link {
    background-color: var(--dm-bg-tertiary);
    color: var(--dm-text-disabled);
}

/* ===== DARK MODE: PROGRESS BAR ===== */
[data-theme="dark"] .progress,
.dark-mode .progress,
[data-bs-theme="dark"] .progress {
    background-color: var(--dm-bg-tertiary);
}

/* ===== DARK MODE: SWEETALERT ===== */
[data-theme="dark"] .swal2-popup,
.dark-mode .swal2-popup,
[data-bs-theme="dark"] .swal2-popup {
    background-color: var(--dm-bg-card) !important;
}

[data-theme="dark"] .swal2-title,
.dark-mode .swal2-title,
[data-bs-theme="dark"] .swal2-title {
    color: var(--dm-text-primary) !important;
}

[data-theme="dark"] .swal2-html-container,
.dark-mode .swal2-html-container,
[data-bs-theme="dark"] .swal2-html-container {
    color: var(--dm-text-secondary) !important;
}

[data-theme="dark"] .swal2-cancel,
.dark-mode .swal2-cancel,
[data-bs-theme="dark"] .swal2-cancel {
    background: var(--dm-bg-tertiary) !important;
    color: var(--dm-text-primary) !important;
}

[data-theme="dark"] .swal2-input,
[data-theme="dark"] .swal2-textarea,
[data-theme="dark"] .swal2-select,
.dark-mode .swal2-input,
.dark-mode .swal2-textarea,
.dark-mode .swal2-select,
[data-bs-theme="dark"] .swal2-input,
[data-bs-theme="dark"] .swal2-textarea,
[data-bs-theme="dark"] .swal2-select {
    background-color: var(--input-bg) !important;
    border: 1px solid var(--border-base) !important;
    color: var(--text-main) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: none !important;
}

[data-theme="dark"] .swal2-input:focus,
[data-theme="dark"] .swal2-textarea:focus,
[data-theme="dark"] .swal2-select:focus,
.dark-mode .swal2-input:focus,
.dark-mode .swal2-textarea:focus,
.dark-mode .swal2-select:focus,
[data-bs-theme="dark"] .swal2-input:focus,
[data-bs-theme="dark"] .swal2-textarea:focus,
[data-bs-theme="dark"] .swal2-select:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15) !important;
}

[data-theme="dark"] .swal2-validation-message,
.dark-mode .swal2-validation-message,
[data-bs-theme="dark"] .swal2-validation-message {
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--color-danger-light) !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    padding: 1rem !important;
    margin-top: 1rem !important;
    border-radius: var(--radius-md) !important;
    font-weight: 500 !important;
}

[data-theme="dark"] .swal2-input::placeholder,
[data-theme="dark"] .swal2-textarea::placeholder,
.dark-mode .swal2-input::placeholder,
.dark-mode .swal2-textarea::placeholder,
[data-bs-theme="dark"] .swal2-input::placeholder,
[data-bs-theme="dark"] .swal2-textarea::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.6 !important;
}

/* ===== DARK MODE: BORDERS & DIVIDERS ===== */
[data-theme="dark"] hr,
.dark-mode hr,
[data-bs-theme="dark"] hr {
    border-color: var(--dm-border);
}

[data-theme="dark"] .border,
.dark-mode .border,
[data-bs-theme="dark"] .border {
    border-color: var(--dm-border) !important;
}

[data-theme="dark"] .border-top,
.dark-mode .border-top,
[data-bs-theme="dark"] .border-top {
    border-top-color: var(--dm-border) !important;
}

[data-theme="dark"] .border-bottom,
.dark-mode .border-bottom,
[data-bs-theme="dark"] .border-bottom {
    border-bottom-color: var(--dm-border) !important;
}

/* ===== DARK MODE: SCROLLBAR ===== */
[data-theme="dark"] ::-webkit-scrollbar,
.dark-mode ::-webkit-scrollbar,
[data-bs-theme="dark"] ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

[data-theme="dark"] ::-webkit-scrollbar-track,
.dark-mode ::-webkit-scrollbar-track,
[data-bs-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--dm-bg-primary);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb,
.dark-mode ::-webkit-scrollbar-thumb,
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--dm-bg-tertiary);
    border-radius: 5px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover,
.dark-mode ::-webkit-scrollbar-thumb:hover,
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--dm-text-muted);
}

/* ===== DARK MODE: TEXT UTILITIES ===== */
[data-theme="dark"] .text-muted,
.dark-mode .text-muted,
[data-bs-theme="dark"] .text-muted {
    color: var(--dm-text-muted) !important;
}

[data-theme="dark"] .text-secondary,
.dark-mode .text-secondary,
[data-bs-theme="dark"] .text-secondary {
    color: var(--dm-text-secondary) !important;
}

[data-theme="dark"] .text-dark,
.dark-mode .text-dark,
[data-bs-theme="dark"] .text-dark {
    color: var(--dm-text-primary) !important;
}

[data-theme="dark"] .bg-light,
.dark-mode .bg-light,
[data-bs-theme="dark"] .bg-light {
    background-color: var(--dm-bg-secondary) !important;
}

[data-theme="dark"] .bg-white,
.dark-mode .bg-white,
[data-bs-theme="dark"] .bg-white {
    background-color: var(--dm-bg-card) !important;
}

/* ===== DARK MODE: ACCORDION ===== */
[data-theme="dark"] .accordion-item,
.dark-mode .accordion-item,
[data-bs-theme="dark"] .accordion-item {
    background-color: var(--dm-bg-card);
    border-color: var(--dm-border);
}

[data-theme="dark"] .accordion-button,
.dark-mode .accordion-button,
[data-bs-theme="dark"] .accordion-button {
    background-color: var(--dm-bg-card);
    color: var(--dm-text-primary);
}

[data-theme="dark"] .accordion-button:not(.collapsed),
.dark-mode .accordion-button:not(.collapsed),
[data-bs-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: var(--dm-bg-tertiary);
    color: var(--dm-primary);
}

[data-theme="dark"] .accordion-button::after,
.dark-mode .accordion-button::after,
[data-bs-theme="dark"] .accordion-button::after {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="dark"] .accordion-body,
.dark-mode .accordion-body,
[data-bs-theme="dark"] .accordion-body {
    background-color: var(--dm-bg-card);
    color: var(--dm-text-secondary);
}

/* ===== AUTO DARK MODE (System Preference) ===== */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        /* Background colors */
        --dm-bg-primary: #0f172a;
        --dm-bg-secondary: #1e293b;
        --dm-bg-tertiary: #334155;
        --dm-bg-elevated: #1e293b;
        --dm-bg-card: #1e293b;
        --dm-bg-hover: #334155;
        --dm-bg-input: #1e293b;

        /* Text colors */
        --dm-text-primary: #f8fafc;
        --dm-text-secondary: #cbd5e1;
        --dm-text-muted: #94a3b8;
        --dm-text-disabled: #64748b;

        /* Border colors */
        --dm-border: #334155;
        --dm-border-subtle: #293548;

        /* Primary colors */
        --dm-primary: #3b82f6;
        --dm-primary-hover: #60a5fa;

        /* Status colors */
        --dm-success: #22c55e;
        --dm-warning: #fbbf24;
        --dm-danger: #f87171;
        --dm-info: #38bdf8;

        /* Shadows */
        --dm-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
        --dm-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
        --dm-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    }

    /* Auto apply dark to body if system prefers dark and no explicit light theme */
    :root:not([data-theme="light"]) body {
        background-color: var(--dm-bg-primary);
        color: var(--dm-text-primary);
    }
}

/* ===== DARK MODE: TABLE WARNING/DANGER ROWS ===== */
/* Fix kontras untuk baris tabel berwarna kuning/warning */
[data-theme="dark"] .table-warning,
.dark-mode .table-warning,
[data-bs-theme="dark"] .table-warning,
[data-theme="dark"] tr.table-warning,
.dark-mode tr.table-warning,
[data-bs-theme="dark"] tr.table-warning {
    background-color: rgba(251, 191, 36, 0.2) !important;
    color: var(--dm-text-primary) !important;
}

[data-theme="dark"] .table-warning td,
.dark-mode .table-warning td,
[data-bs-theme="dark"] .table-warning td {
    color: var(--dm-text-primary) !important;
}

/* Fix untuk baris dengan inline style background kuning */
[data-theme="dark"] tr[style*="background"]:not([style*="transparent"]),
.dark-mode tr[style*="background"]:not([style*="transparent"]),
[data-bs-theme="dark"] tr[style*="background"]:not([style*="transparent"]) {
    background-color: rgba(251, 191, 36, 0.15) !important;
    color: var(--dm-text-primary) !important;
}

[data-theme="dark"] tr[style*="background"] td,
.dark-mode tr[style*="background"] td,
[data-bs-theme="dark"] tr[style*="background"] td {
    color: var(--dm-text-primary) !important;
}

/* Fix background global yang sering mengganggu kontras */
[data-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-white,
[data-theme="dark"] .bg-light,
[data-bs-theme="dark"] .bg-light {
    background-color: var(--dm-bg-card) !important;
    color: var(--dm-text-primary) !important;
}

[data-theme="dark"] .text-dark,
[data-theme="dark"] .text-secondary,
[data-bs-theme="dark"] .text-dark,
[data-bs-theme="dark"] .text-secondary {
    color: var(--dm-text-primary) !important;
}

/* Fix kontras untuk baris danger/merah */
[data-theme="dark"] .table-danger,
.dark-mode .table-danger,
[data-bs-theme="dark"] .table-danger,
[data-theme="dark"] tr.table-danger,
.dark-mode tr.table-danger,
[data-bs-theme="dark"] tr.table-danger {
    background-color: rgba(248, 113, 113, 0.2) !important;
    color: var(--dm-text-primary) !important;
}

[data-theme="dark"] .table-danger td,
.dark-mode .table-danger td,
[data-bs-theme="dark"] .table-danger td {
    color: var(--dm-text-primary) !important;
}

/* Fix kontras untuk baris success/hijau */
[data-theme="dark"] .table-success,
.dark-mode .table-success,
[data-bs-theme="dark"] .table-success,
[data-theme="dark"] tr.table-success,
.dark-mode tr.table-success,
[data-bs-theme="dark"] tr.table-success {
    background-color: rgba(34, 197, 94, 0.2) !important;
    color: var(--dm-text-primary) !important;
}

[data-theme="dark"] .table-success td,
.dark-mode .table-success td,
[data-bs-theme="dark"] .table-success td {
    color: var(--dm-text-primary) !important;
}

/* Fix kontras untuk baris warning/kuning */
[data-theme="dark"] .table-warning,
.dark-mode .table-warning,
[data-bs-theme="dark"] .table-warning,
[data-theme="dark"] tr.table-warning,
.dark-mode tr.table-warning,
[data-bs-theme="dark"] tr.table-warning {
    background-color: rgba(251, 191, 36, 0.2) !important;
    color: var(--dm-text-primary) !important;
}

[data-theme="dark"] .table-warning td,
.dark-mode .table-warning td,
[data-bs-theme="dark"] .table-warning td {
    color: var(--dm-text-primary) !important;
}

/* Fix kontras untuk baris info/biru */
[data-theme="dark"] .table-info,
.dark-mode .table-info,
[data-bs-theme="dark"] .table-info {
    background-color: rgba(56, 189, 248, 0.2) !important;
    color: var(--dm-text-primary) !important;
}

[data-theme="dark"] .table-info td,
.dark-mode .table-info td,
[data-bs-theme="dark"] .table-info td {
    color: var(--dm-text-primary) !important;
}

/* Fix event HOVER agar tidak merusak background baris di dark mode */
[data-theme="dark"] .table-hover tbody tr:hover,
[data-theme="dark"] .table-hover>tbody>tr:hover>*,
.dark-mode .table-hover tbody tr:hover,
.dark-mode .table-hover>tbody>tr:hover>*,
[data-bs-theme="dark"] .table-hover tbody tr:hover,
[data-bs-theme="dark"] .table-hover>tbody>tr:hover>* {
    background-color: var(--table-hover-bg) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .table-hover tbody tr.table-warning:hover,
[data-theme="dark"] .table-hover>tbody>tr.table-warning:hover>*,
[data-bs-theme="dark"] .table-hover tbody tr.table-warning:hover,
[data-bs-theme="dark"] .table-hover>tbody>tr.table-warning:hover>* {
    background-color: rgba(251, 191, 36, 0.08) !important;
}

[data-theme="dark"] .table-hover tbody tr.table-danger:hover,
[data-theme="dark"] .table-hover>tbody>tr.table-danger:hover>*,
[data-bs-theme="dark"] .table-hover tbody tr.table-danger:hover,
[data-bs-theme="dark"] .table-hover>tbody>tr.table-danger:hover>* {
    background-color: rgba(248, 113, 113, 0.08) !important;
}

[data-theme="dark"] .table-hover tbody tr.table-success:hover,
[data-theme="dark"] .table-hover>tbody>tr.table-success:hover>*,
[data-bs-theme="dark"] .table-hover tbody tr.table-success:hover,
[data-bs-theme="dark"] .table-hover>tbody>tr.table-success:hover>* {
    background-color: rgba(34, 197, 94, 0.08) !important;
}

/* Fix untuk badge di dark mode agar lebih terang */
[data-theme="dark"] .badge.bg-warning,
.dark-mode .badge.bg-warning,
[data-bs-theme="dark"] .badge.bg-warning {
    background-color: #fbbf24 !important;
    color: #1e293b !important;
}

[data-theme="dark"] .badge.bg-danger,
.dark-mode .badge.bg-danger,
[data-bs-theme="dark"] .badge.bg-danger {
    background-color: #f87171 !important;
    color: #1e293b !important;
}

/* Fix teks dark yang sulit terbaca */
[data-theme="dark"] .text-dark,
.dark-mode .text-dark,
[data-bs-theme="dark"] .text-dark {
    color: var(--text-main) !important;
}

[data-theme="dark"] .text-muted,
.dark-mode .text-muted,
[data-bs-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}


/* Fix untuk named color backgrounds di dark mode */
[data-theme="dark"] [style*="rgb(255, 248, 220)"],
.dark-mode [style*="rgb(255, 248, 220)"],
[data-bs-theme="dark"] [style*="rgb(255, 248, 220)"],
[data-theme="dark"] [style*="#fff8dc"],
.dark-mode [style*="#fff8dc"],
[data-bs-theme="dark"] [style*="#fff8dc"],
[data-theme="dark"] [style*="cornsilk"],
.dark-mode [style*="cornsilk"],
[data-bs-theme="dark"] [style*="cornsilk"] {
    background-color: rgba(251, 191, 36, 0.15) !important;
    color: var(--text-main) !important;
}

/* Fix bg-white and bg-light globally in dark mode */
[data-theme="dark"] .bg-white,
.dark-mode .bg-white,
[data-bs-theme="dark"] .bg-white {
    background-color: var(--card-bg) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .bg-light,
.dark-mode .bg-light,
[data-bs-theme="dark"] .bg-light {
    background-color: var(--app-bg-alt) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .border,
.dark-mode .border,
[data-bs-theme="dark"] .border {
    border-color: var(--border-base) !important;
}

/* Fix untuk lemonchiffon background */
[data-theme="dark"] [style*="rgb(255, 250, 205)"],
.dark-mode [style*="rgb(255, 250, 205)"],
[data-bs-theme="dark"] [style*="rgb(255, 250, 205)"],
[data-theme="dark"] [style*="#fffacd"],
.dark-mode [style*="#fffacd"],
[data-bs-theme="dark"] [style*="#fffacd"],
[data-theme="dark"] [style*="lemonchiffon"],
.dark-mode [style*="lemonchiffon"],
[data-bs-theme="dark"] [style*="lemonchiffon"] {
    background-color: rgba(251, 191, 36, 0.12) !important;
    color: var(--dm-text-primary) !important;
}

/* ========================================
   24. DOUBLE SCAN TOAST ENHANCEMENTS
   ======================================== */
body.swal2-toast-shown .swal2-container {
    background-color: transparent !important;
    pointer-events: none !important;
}
body.swal2-toast-shown .swal2-container .swal2-popup {
    pointer-events: auto !important;
}

/* Custom styling untuk toast proteksi double scan agar super ringkas */
.small-double-scan-toast-popup {
    background: #fffbeb !important; /* Warna kuning hangat premium soft */
    border: 1px solid #fef3c7 !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05) !important;
    padding: 0.5rem 0.8rem !important;
    width: auto !important;
    min-width: 250px !important;
    max-width: 320px !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

[data-theme="dark"] .small-double-scan-toast-popup,
.dark-mode .small-double-scan-toast-popup {
    background: #78350f !important; /* Warna cokelat gelap premium di dark mode */
    border: 1px solid #92400e !important;
}

.small-double-scan-toast-title {
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    color: #b45309 !important; /* Amber gelap premium */
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.2 !important;
}

[data-theme="dark"] .small-double-scan-toast-title,
.dark-mode .small-double-scan-toast-title {
    color: #fef3c7 !important;
}

.small-double-scan-toast-icon {
    font-size: 0.7rem !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-width: 2px !important;
    width: 20px !important;
    height: 20px !important;
}

/* ========================================
   25. PREMIUM DARK MODE CONTRAST OVERRIDES
   ======================================== */

/* Override warna teks acc-child yang terlalu gelap di dark mode */
[data-theme="dark"] .acc-child,
.dark-mode .acc-child,
[data-bs-theme="dark"] .acc-child {
    color: var(--dm-text-secondary) !important;
}

/* Override background subheader bg-light di dark mode */
[data-theme="dark"] .bg-light,
.dark-mode .bg-light,
[data-bs-theme="dark"] .bg-light,
[data-theme="dark"] tr.bg-light td,
.dark-mode tr.bg-light td,
[data-bs-theme="dark"] tr.bg-light td {
    background-color: var(--dm-bg-secondary) !important;
    color: var(--dm-text-primary) !important;
}

/* Override background inline total-total di dark-mode agar kontrasnya seimbang */
/* 1. Hijau Terang (Total Lancar/Tetap) -> Hijau Transparan Gelap */
[data-theme="dark"] [style*="background:#e8f5e9"],
.dark-mode [style*="background:#e8f5e9"],
[data-bs-theme="dark"] [style*="background:#e8f5e9"],
[data-theme="dark"] [style*="background: #e8f5e9"],
.dark-mode [style*="background: #e8f5e9"],
[data-bs-theme="dark"] [style*="background: #e8f5e9"] {
    background-color: rgba(16, 185, 129, 0.15) !important;
    border-top: 1px solid rgba(16, 185, 129, 0.3) !important;
    border-bottom: 1px solid rgba(16, 185, 129, 0.3) !important;
}

[data-theme="dark"] [style*="background:#e8f5e9"] td,
.dark-mode [style*="background:#e8f5e9"] td,
[data-bs-theme="dark"] [style*="background:#e8f5e9"] td,
[data-theme="dark"] [style*="background: #e8f5e9"] td,
.dark-mode [style*="background: #e8f5e9"] td,
[data-bs-theme="dark"] [style*="background: #e8f5e9"] td {
    color: #34d399 !important;
}

/* 2. Oranye Terang (Total Kewajiban/Total Kas Bersih Investasi) -> Oranye Transparan Gelap */
[data-theme="dark"] [style*="background:#fff3e0"],
.dark-mode [style*="background:#fff3e0"],
[data-bs-theme="dark"] [style*="background:#fff3e0"],
[data-theme="dark"] [style*="background: #fff3e0"],
.dark-mode [style*="background: #fff3e0"],
[data-bs-theme="dark"] [style*="background: #fff3e0"] {
    background-color: rgba(245, 158, 11, 0.15) !important;
    border-top: 1px solid rgba(245, 158, 11, 0.3) !important;
    border-bottom: 1px solid rgba(245, 158, 11, 0.3) !important;
}

[data-theme="dark"] [style*="background:#fff3e0"] td,
.dark-mode [style*="background:#fff3e0"] td,
[data-bs-theme="dark"] [style*="background:#fff3e0"] td,
[data-theme="dark"] [style*="background: #fff3e0"] td,
.dark-mode [style*="background: #fff3e0"] td,
[data-bs-theme="dark"] [style*="background: #fff3e0"] td {
    color: #fbbf24 !important;
}

/* 3. Biru Terang (Total Ekuitas / Total Kas Bersih Operasional) -> Biru Transparan Gelap */
[data-theme="dark"] [style*="background:#e3f2fd"],
.dark-mode [style*="background:#e3f2fd"],
[data-bs-theme="dark"] [style*="background:#e3f2fd"],
[data-theme="dark"] [style*="background: #e3f2fd"],
.dark-mode [style*="background: #e3f2fd"],
[data-bs-theme="dark"] [style*="background: #e3f2fd"] {
    background-color: rgba(59, 130, 246, 0.15) !important;
    border-top: 1px solid rgba(59, 130, 246, 0.3) !important;
    border-bottom: 1px solid rgba(59, 130, 246, 0.3) !important;
}

[data-theme="dark"] [style*="background:#e3f2fd"] td,
.dark-mode [style*="background:#e3f2fd"] td,
[data-bs-theme="dark"] [style*="background:#e3f2fd"] td,
[data-theme="dark"] [style*="background: #e3f2fd"] td,
.dark-mode [style*="background: #e3f2fd"] td,
[data-bs-theme="dark"] [style*="background: #e3f2fd"] td {
    color: #60a5fa !important;
}

/* 4. Pink Terang (Total Kas Bersih Pendanaan) -> Pink/Merah Transparan Gelap */
[data-theme="dark"] [style*="background:#fce4ec"],
.dark-mode [style*="background:#fce4ec"],
[data-bs-theme="dark"] [style*="background:#fce4ec"],
[data-theme="dark"] [style*="background: #fce4ec"],
.dark-mode [style*="background: #fce4ec"],
[data-bs-theme="dark"] [style*="background: #fce4ec"] {
    background-color: rgba(239, 68, 68, 0.15) !important;
    border-top: 1px solid rgba(239, 68, 68, 0.3) !important;
    border-bottom: 1px solid rgba(239, 68, 68, 0.3) !important;
}

[data-theme="dark"] [style*="background:#fce4ec"] td,
.dark-mode [style*="background:#fce4ec"] td,
[data-bs-theme="dark"] [style*="background:#fce4ec"] td,
[data-theme="dark"] [style*="background: #fce4ec"] td,
.dark-mode [style*="background: #fce4ec"] td,
[data-bs-theme="dark"] [style*="background: #fce4ec"] td {
    color: #fca5a5 !important;
}

/* 5. Override text-danger agar kontrasnya pas dan lembut di dark mode */
[data-theme="dark"] .text-danger,
.dark-mode .text-danger,
[data-bs-theme="dark"] .text-danger {
    color: #f87171 !important;
}

/* 6. Override text-success agar kontrasnya pas dan lembut di dark mode */
[data-theme="dark"] .text-success,
.dark-mode .text-success,
[data-bs-theme="dark"] .text-success {
    color: #4ade80 !important;
}

/* 7. Override teks deskripsi total (seperti 'Total Aset Lancar', 'Total Kewajiban', dll) di dark mode */
[data-theme="dark"] tr[style*="background"] td,
.dark-mode tr[style*="background"] td,
[data-bs-theme="dark"] tr[style*="background"] td {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) !important;
}