/**
 * IDTS — premium SweetAlert2 theme (modal + toast).
 * Loaded after sweetalert2.min.css. Supports data-bs-theme and data-theme.
 */

/* ── Variables ─────────────────────────────────────────────────── */
:root {
    --idts-swal-radius: 20px;
    --idts-swal-radius-sm: 16px;
    --idts-swal-shadow: 0 28px 65px -15px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    --idts-swal-shadow-dark: 0 28px 65px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(148, 163, 184, 0.12) inset;
    /* SweetAlert2 reads these for default popup / toast shapes */
    --swal2-border-radius: 20px;
    --swal2-toast-border-radius: 16px;
}

/* When toasts are visible, SweetAlert2 keeps body.swal2-toast-shown and sizes ALL .swal2-container
   like a toast (narrow width, top-end/center inset + transforms). Centered modals reuse .swal2-center,
   so confirm dialogs end up squeezed into a corner with a strip of backdrop — fix by restoring full-viewport modal containers. */
body.swal2-toast-shown .swal2-container:has(.swal2-popup:not(.swal2-toast)) {
    width: auto !important;
    max-width: none !important;
    height: 100% !important;
    inset: 0 !important;
    transform: none !important;
    pointer-events: auto !important;
}

/* ── Backdrop ─────────────────────────────────────────────────── */
/* Modal dimmer only — mixin adds .idts-swal-container to toasts too; must not style toast hosts */
.idts-swal-container.swal2-backdrop-show:has(.swal2-popup:not(.swal2-toast)),
.swal2-container.swal2-backdrop-show:not(.swal2-container-toasts) {
    background: rgba(15, 23, 42, 0.52) !important;
}

html[data-bs-theme="dark"] .idts-swal-container.swal2-backdrop-show:has(.swal2-popup:not(.swal2-toast)),
html[data-theme="dark"] .idts-swal-container.swal2-backdrop-show:has(.swal2-popup:not(.swal2-toast)),
html[data-bs-theme="dark"] .swal2-container.swal2-backdrop-show:not(.swal2-container-toasts),
html[data-theme="dark"] .swal2-container.swal2-backdrop-show:not(.swal2-container-toasts) {
    background: rgba(2, 6, 23, 0.72) !important;
}

/* Toast column: transparent host, no overlay bleed (SweetAlert2 default + mixin backdrop) */
.idts-swal-container:has(.swal2-toast) {
    background: transparent !important;
    box-shadow: none !important;
}

/* ── Modal popup (customClass + fallback when mixin classes missing) ─ */
.idts-swal-popup.swal2-popup,
.swal2-container .swal2-popup:not(.swal2-toast) {
    border-radius: var(--idts-swal-radius) !important;
    padding: 1.6rem 1.75rem 1.45rem !important;
    width: auto !important;
    max-width: min(27.5rem, calc(100vw - 1.75rem)) !important;
    min-height: unset !important;
    background: linear-gradient(165deg, #ffffff 0%, #f8fafc 48%, #f1f5f9 100%) !important;
    border: 1px solid rgba(148, 163, 184, 0.22) !important;
    box-shadow: var(--idts-swal-shadow) !important;
}

html[data-bs-theme="dark"] .idts-swal-popup.swal2-popup,
html[data-theme="dark"] .idts-swal-popup.swal2-popup,
html[data-bs-theme="dark"] .swal2-container .swal2-popup:not(.swal2-toast),
html[data-theme="dark"] .swal2-container .swal2-popup:not(.swal2-toast) {
    background: linear-gradient(165deg, #1e293b 0%, #0f172a 55%, #020617 100%) !important;
    border-color: rgba(71, 85, 105, 0.45) !important;
    box-shadow: var(--idts-swal-shadow-dark) !important;
}

/* Height follows content (Swal heightAuto + no fixed min-heights) */
.idts-swal-popup.swal2-popup .swal2-content,
.swal2-container .swal2-popup:not(.swal2-toast) .swal2-content {
    padding: 0 !important;
}

/* ── Title ───────────────────────────────────────────────────── */
.idts-swal-title.swal2-title,
.swal2-popup:not(.swal2-toast) .swal2-title {
    font-size: clamp(1.2rem, 2.8vw, 1.5rem) !important;
    font-weight: 750 !important;
    letter-spacing: -0.035em !important;
    line-height: 1.28 !important;
    padding: 0 0.35rem 0.35rem !important;
    margin: 0 auto 0.35rem !important;
    max-width: 100% !important;
    text-align: center !important;
    color: #0f172a !important;
}

html[data-bs-theme="dark"] .idts-swal-title.swal2-title,
html[data-theme="dark"] .idts-swal-title.swal2-title,
html[data-bs-theme="dark"] .swal2-popup:not(.swal2-toast) .swal2-title,
html[data-theme="dark"] .swal2-popup:not(.swal2-toast) .swal2-title {
    color: #f1f5f9 !important;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .idts-swal-title.swal2-title,
    .swal2-popup:not(.swal2-toast) .swal2-title {
        color: transparent !important;
        background: linear-gradient(120deg, #0f172a 0%, #1e3a5f 35%, #1d4ed8 100%) !important;
        -webkit-background-clip: text !important;
        background-clip: text !important;
    }

    html[data-bs-theme="dark"] .idts-swal-title.swal2-title,
    html[data-theme="dark"] .idts-swal-title.swal2-title,
    html[data-bs-theme="dark"] .swal2-popup:not(.swal2-toast) .swal2-title,
    html[data-theme="dark"] .swal2-popup:not(.swal2-toast) .swal2-title {
        color: transparent !important;
        background: linear-gradient(120deg, #f8fafc 0%, #e2e8f0 40%, #93c5fd 100%) !important;
        -webkit-background-clip: text !important;
        background-clip: text !important;
    }
}

/* ── Body / HTML container ───────────────────────────────────── */
.idts-swal-html.swal2-html-container,
.swal2-popup:not(.swal2-toast) .swal2-html-container {
    margin: 0.15rem auto 0 !important;
    padding: 0 0.5rem 0.25rem !important;
    font-size: 0.9375rem !important;
    line-height: 1.58 !important;
    font-weight: 450 !important;
    color: #475569 !important;
    text-align: center !important;
}

html[data-bs-theme="dark"] .idts-swal-html.swal2-html-container,
html[data-theme="dark"] .idts-swal-html.swal2-html-container,
html[data-bs-theme="dark"] .swal2-popup:not(.swal2-toast) .swal2-html-container,
html[data-theme="dark"] .swal2-popup:not(.swal2-toast) .swal2-html-container {
    color: #cbd5e1 !important;
}

/* ── Icons — light, colorful badges ───────────────────────────── */
.idts-swal-popup .swal2-icon,
.swal2-popup:not(.swal2-toast) .swal2-icon {
    width: 4.1rem !important;
    height: 4.1rem !important;
    margin: 0.15rem auto 1rem !important;
    border-width: 0 !important;
    border-radius: 50% !important;
    position: relative !important;
}

.idts-swal-popup .swal2-icon::after,
.swal2-popup:not(.swal2-toast) .swal2-icon::after {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    opacity: 0.35;
    z-index: 0;
    filter: blur(12px);
}

.idts-swal-popup .swal2-icon.swal2-success,
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-success {
    background: linear-gradient(145deg, #ecfdf5 0%, #a7f3d0 100%) !important;
    color: #047857 !important;
    box-shadow: 0 10px 28px rgba(5, 150, 105, 0.28) !important;
}

.idts-swal-popup .swal2-icon.swal2-success::after,
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-success::after {
    background: #34d399;
}

.idts-swal-popup .swal2-icon.swal2-error,
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-error {
    background: linear-gradient(145deg, #fef2f2 0%, #fecaca 100%) !important;
    color: #b91c1c !important;
    box-shadow: 0 10px 28px rgba(220, 38, 38, 0.22) !important;
}

.idts-swal-popup .swal2-icon.swal2-error::after,
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-error::after {
    background: #f87171;
}

.idts-swal-popup .swal2-icon.swal2-warning,
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-warning {
    background: linear-gradient(145deg, #fffbeb 0%, #fde68a 100%) !important;
    color: #b45309 !important;
    box-shadow: 0 10px 28px rgba(217, 119, 6, 0.28) !important;
}

.idts-swal-popup .swal2-icon.swal2-warning::after,
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-warning::after {
    background: #fbbf24;
}

.idts-swal-popup .swal2-icon.swal2-info,
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-info {
    background: linear-gradient(145deg, #eff6ff 0%, #bfdbfe 100%) !important;
    color: #1d4ed8 !important;
    box-shadow: 0 10px 28px rgba(29, 78, 216, 0.22) !important;
}

.idts-swal-popup .swal2-icon.swal2-info::after,
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-info::after {
    background: #60a5fa;
}

.idts-swal-popup .swal2-icon.swal2-question,
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-question {
    background: linear-gradient(145deg, #f5f3ff 0%, #ddd6fe 100%) !important;
    color: #5b21b6 !important;
    box-shadow: 0 10px 28px rgba(91, 33, 182, 0.2) !important;
}

.idts-swal-popup .swal2-icon.swal2-question::after,
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-question::after {
    background: #a78bfa;
}

/* Keep mark / lines readable on pastel grounds */
.idts-swal-popup .swal2-icon.swal2-success [class^="swal2-success-line"],
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-success [class^="swal2-success-line"] {
    background-color: #047857 !important;
}

.idts-swal-popup .swal2-icon.swal2-success .swal2-success-ring,
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(4, 120, 87, 0.25) !important;
}

.idts-swal-popup .swal2-icon.swal2-error [class^="swal2-x-mark-line"],
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-error [class^="swal2-x-mark-line"] {
    background-color: #b91c1c !important;
}

.idts-swal-popup .swal2-icon .swal2-icon-content,
.swal2-popup:not(.swal2-toast) .swal2-icon .swal2-icon-content {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 1px 1px rgba(255, 255, 255, 0.35));
}

html[data-bs-theme="dark"] .idts-swal-popup .swal2-icon.swal2-success,
html[data-theme="dark"] .idts-swal-popup .swal2-icon.swal2-success,
html[data-bs-theme="dark"] .swal2-popup:not(.swal2-toast) .swal2-icon.swal2-success,
html[data-theme="dark"] .swal2-popup:not(.swal2-toast) .swal2-icon.swal2-success {
    background: linear-gradient(145deg, rgba(6, 78, 59, 0.55) 0%, rgba(52, 211, 153, 0.35) 100%) !important;
    color: #6ee7b7 !important;
}

html[data-bs-theme="dark"] .idts-swal-popup .swal2-icon.swal2-error,
html[data-theme="dark"] .idts-swal-popup .swal2-icon.swal2-error,
html[data-bs-theme="dark"] .swal2-popup:not(.swal2-toast) .swal2-icon.swal2-error,
html[data-theme="dark"] .swal2-popup:not(.swal2-toast) .swal2-icon.swal2-error {
    background: linear-gradient(145deg, rgba(127, 29, 29, 0.45) 0%, rgba(248, 113, 113, 0.3) 100%) !important;
    color: #fca5a5 !important;
}

html[data-bs-theme="dark"] .idts-swal-popup .swal2-icon.swal2-warning,
html[data-theme="dark"] .idts-swal-popup .swal2-icon.swal2-warning,
html[data-bs-theme="dark"] .swal2-popup:not(.swal2-toast) .swal2-icon.swal2-warning,
html[data-theme="dark"] .swal2-popup:not(.swal2-toast) .swal2-icon.swal2-warning {
    background: linear-gradient(145deg, rgba(120, 53, 15, 0.5) 0%, rgba(251, 191, 36, 0.35) 100%) !important;
    color: #fcd34d !important;
}

html[data-bs-theme="dark"] .idts-swal-popup .swal2-icon.swal2-info,
html[data-theme="dark"] .idts-swal-popup .swal2-icon.swal2-info,
html[data-bs-theme="dark"] .swal2-popup:not(.swal2-toast) .swal2-icon.swal2-info,
html[data-theme="dark"] .swal2-popup:not(.swal2-toast) .swal2-icon.swal2-info {
    background: linear-gradient(145deg, rgba(30, 58, 138, 0.5) 0%, rgba(96, 165, 250, 0.35) 100%) !important;
    color: #93c5fd !important;
}

html[data-bs-theme="dark"] .idts-swal-popup .swal2-icon.swal2-question,
html[data-theme="dark"] .idts-swal-popup .swal2-icon.swal2-question,
html[data-bs-theme="dark"] .swal2-popup:not(.swal2-toast) .swal2-icon.swal2-question,
html[data-theme="dark"] .swal2-popup:not(.swal2-toast) .swal2-icon.swal2-question {
    background: linear-gradient(145deg, rgba(76, 29, 149, 0.45) 0%, rgba(167, 139, 250, 0.3) 100%) !important;
    color: #c4b5fd !important;
}

/* Close (X) */
.idts-swal-close.swal2-close {
    border-radius: 10px !important;
    width: 2.1rem !important;
    height: 2.1rem !important;
    font-size: 1.5rem !important;
    color: #64748b !important;
    outline: none !important;
    box-shadow: none !important;
    transition: background 0.15s, color 0.15s !important;
}

.idts-swal-close.swal2-close:hover {
    background: rgba(148, 163, 184, 0.18) !important;
    color: #0f172a !important;
}

html[data-bs-theme="dark"] .idts-swal-close.swal2-close:hover,
html[data-theme="dark"] .idts-swal-close.swal2-close:hover {
    color: #f1f5f9 !important;
}

/* ── Toasts (top-end) ────────────────────────────────────────── */
.idts-swal-toast-popup.swal2-toast {
    border-radius: var(--idts-swal-radius-sm) !important;
    padding: 0.85rem 1.05rem !important;
    width: auto !important;
    max-width: min(26rem, calc(100vw - 1.5rem)) !important;
    min-height: unset !important;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.06) inset !important;
    background: linear-gradient(155deg, #ffffff 0%, #f8fafc 100%) !important;
    border: 1px solid rgba(148, 163, 184, 0.2) !important;
}

.idts-swal-toast-popup.swal2-toast.swal2-show {
    animation-duration: 0.35s !important;
}

.idts-swal-toast-popup.swal2-toast.swal2-hide {
    animation-duration: 0.22s !important;
}

html[data-bs-theme="dark"] .idts-swal-toast-popup.swal2-toast,
html[data-theme="dark"] .idts-swal-toast-popup.swal2-toast {
    background: linear-gradient(155deg, #1e293b 0%, #0f172a 100%) !important;
    border-color: rgba(71, 85, 105, 0.45) !important;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.4) !important;
}

.idts-swal-toast-title {
    font-size: 0.95rem !important;
    font-weight: 650 !important;
    letter-spacing: -0.02em !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    color: #0f172a !important;
}

html[data-bs-theme="dark"] .idts-swal-toast-title,
html[data-theme="dark"] .idts-swal-toast-title {
    color: #f1f5f9 !important;
}

/* Toast icon — compact colorful */
.idts-swal-toast-popup .swal2-icon {
    width: 2.35rem !important;
    height: 2.35rem !important;
    margin: 0 0.65rem 0 0 !important;
    min-width: 2.35rem !important;
    border-width: 0 !important;
    border-radius: 12px !important;
}

.idts-swal-toast-popup .swal2-icon::after {
    display: none;
}

.idts-swal-toast-popup .swal2-icon.swal2-success {
    background: linear-gradient(145deg, #d1fae5, #6ee7b7) !important;
    color: #065f46 !important;
}

.idts-swal-toast-popup .swal2-icon.swal2-error {
    background: linear-gradient(145deg, #fee2e2, #fca5a5) !important;
    color: #991b1b !important;
}

.idts-swal-toast-popup .swal2-icon.swal2-warning {
    background: linear-gradient(145deg, #fef3c7, #fcd34d) !important;
    color: #92400e !important;
}

.idts-swal-toast-popup .swal2-icon.swal2-info {
    background: linear-gradient(145deg, #dbeafe, #93c5fd) !important;
    color: #1e40af !important;
}

.idts-swal-toast-popup .swal2-timer-progress-bar {
    background: linear-gradient(90deg, #1d4ed8, #0ea5e9) !important;
    border-radius: 0 0 var(--idts-swal-radius-sm) var(--idts-swal-radius-sm) !important;
}

.idts-swal-toast-popup .swal2-close {
    border-radius: 8px !important;
}

/* Modal dialogs above Bootstrap modals (idts-modal-stack.css) so confirms fire on top */
.swal2-container:not(.swal2-container-toasts) {
    z-index: 12100 !important;
}
