/* Third-party widgets under admin dark theme */

/* !important: many views set Select2 borders with !important in inline/stacked CSS after this file */
body[data-theme-version="dark"] .select2-container--default .select2-selection--single,
body[data-theme-version="dark"] .select2-container--default .select2-selection--multiple {
    background-color: var(--admin-input-bg, #2a2a3c) !important;
    border-color: var(--admin-border, rgba(255, 255, 255, 0.12)) !important;
    color: var(--admin-text, #e9ecef) !important;
}

body[data-theme-version="dark"] .select2-container--default.select2-container--focus .select2-selection--single,
body[data-theme-version="dark"] .select2-container--default.select2-container--focus .select2-selection--multiple,
body[data-theme-version="dark"] .select2-container--default.select2-container--open .select2-selection--single,
body[data-theme-version="dark"] .select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: rgba(255, 255, 255, 0.22) !important;
}

body[data-theme-version="dark"] .select2-container--default .select2-selection__rendered {
    color: var(--admin-text, #e9ecef) !important;
}

body[data-theme-version="dark"] .select2-container--default .select2-selection--multiple .select2-search__field {
    background: transparent !important;
    color: var(--admin-text, #e9ecef) !important;
}

body[data-theme-version="dark"] .select2-container--default .select2-selection__placeholder {
    color: var(--admin-text-muted, #94a3b8) !important;
}

body[data-theme-version="dark"] .select2-container--default.select2-container--disabled .select2-selection--single,
body[data-theme-version="dark"] .select2-container--default.select2-container--disabled .select2-selection--multiple {
    opacity: 0.65;
    background-color: rgba(0, 0, 0, 0.2) !important;
}

body[data-theme-version="dark"] .select2-dropdown {
    background-color: var(--admin-surface, #1e1e2d) !important;
    border-color: var(--admin-border, rgba(255, 255, 255, 0.12)) !important;
    color: var(--admin-text, #e9ecef) !important;
}

body[data-theme-version="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--admin-text, #fff);
}

body[data-theme-version="dark"] .select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: var(--admin-input-bg, #2a2a3c) !important;
    border-color: var(--admin-border, rgba(255, 255, 255, 0.12)) !important;
    color: var(--admin-text, #e9ecef) !important;
}

body[data-theme-version="dark"] .dataTables_wrapper .dataTables_length,
body[data-theme-version="dark"] .dataTables_wrapper .dataTables_filter,
body[data-theme-version="dark"] .dataTables_wrapper .dataTables_info,
body[data-theme-version="dark"] .dataTables_wrapper .dataTables_paginate {
    color: var(--admin-text-muted, #a1a1b5);
}

body[data-theme-version="dark"] table.dataTable thead th,
body[data-theme-version="dark"] table.dataTable thead td,
body[data-theme-version="dark"] table.dataTable.no-footer {
    border-bottom-color: var(--admin-border, rgba(255, 255, 255, 0.12));
}

body[data-theme-version="dark"] table.dataTable tbody tr {
    background-color: transparent;
    color: var(--admin-text, #e9ecef);
}

body[data-theme-version="dark"] table.dataTable tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

body[data-theme-version="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--admin-text, #e9ecef) !important;
}

body[data-theme-version="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current,
body[data-theme-version="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: transparent !important;
    color: #fff !important;
}

body[data-theme-version="dark"] .swal2-popup {
    background: var(--admin-surface, #1e1e2d);
    color: var(--admin-text, #e9ecef);
}

body[data-theme-version="dark"] .swal2-html-container,
body[data-theme-version="dark"] .swal2-title {
    color: var(--admin-text, #e9ecef);
}

body[data-theme-version="dark"] .datepicker-dropdown {
    background: var(--admin-surface, #1e1e2d);
    color: var(--admin-text, #e9ecef);
}

body[data-theme-version="dark"] .datepicker table tr td.day:hover,
body[data-theme-version="dark"] .datepicker table tr td.day.focused {
    background: rgba(255, 255, 255, 0.08);
}

body[data-theme-version="dark"] .dropdown-menu {
    background-color: var(--admin-surface, #1e1e2d);
    border-color: var(--admin-border, rgba(255, 255, 255, 0.12));
}

body[data-theme-version="dark"] .dropdown-item {
    color: var(--admin-text, #e9ecef);
}

body[data-theme-version="dark"] .dropdown-item:hover,
body[data-theme-version="dark"] .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--admin-text, #fff);
}

body[data-theme-version="dark"] .popover {
    background-color: var(--admin-surface, #1e1e2d);
    border-color: var(--admin-border, rgba(255, 255, 255, 0.12));
    color: var(--admin-text, #e9ecef);
}

body[data-theme-version="dark"] .popover .popover-header {
    background: rgba(0, 0, 0, 0.25);
    border-bottom-color: var(--admin-border, rgba(255, 255, 255, 0.1));
    color: var(--admin-text, #f1f5f9);
}

body[data-theme-version="dark"] .popover .popover-body {
    color: var(--admin-text, #e9ecef);
}

body[data-theme-version="dark"] .tooltip .tooltip-inner {
    background-color: #334155;
    color: #f8fafc;
}

/* Toastr: invert-heavy panels for readability on dark body */
body[data-theme-version="dark"] .toast {
    background-color: var(--admin-surface, #2a2a3c);
    color: var(--admin-text, #e9ecef);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

body[data-theme-version="dark"] .toast-success {
    background-color: #1e3d2f;
    color: #d1fae5;
}

body[data-theme-version="dark"] .toast-error {
    background-color: #3d1e1e;
    color: #fecaca;
}

body[data-theme-version="dark"] .toast-info {
    background-color: #1e2d3d;
    color: #bfdbfe;
}

body[data-theme-version="dark"] .toast-warning {
    background-color: #3d351e;
    color: #fef08a;
}
