/* ==========================================================================
   IN3M — SweetAlert2 theme (override only, load AFTER sweetalert2.min.css)
   Aligns modals & toasts with theme.css / Bootstrap primary.
   ========================================================================== */

:root {
    --swal2-backdrop: rgba(15, 23, 42, 0.48);
    --swal2-width: 26rem;
    --swal2-padding: 1.75rem 1.5rem 1.35rem;
    --swal2-border-radius: 16px;
    --swal2-background: #ffffff;
    --swal2-color: #334155;

    --swal2-title-padding: 0 0 0.25em;
    --swal2-html-container-padding: 0.35em 0 0;

    --swal2-confirm-button-background-color: var(--in3m-brand, #0b3d91);
    --swal2-confirm-button-border-radius: 12px;
    --swal2-confirm-button-color: #fff;

    --swal2-cancel-button-background-color: #ffffff;
    --swal2-cancel-button-border-radius: 12px;
    --swal2-cancel-button-color: #475569;

    --swal2-deny-button-background-color: #ef4444;
    --swal2-deny-button-border-radius: 12px;
    --swal2-deny-button-color: #fff;

    --swal2-actions-margin: 1.35em 0 0;
    --swal2-actions-justify-content: center;

    --swal2-input-border: 1px solid #e2e8f0;
    --swal2-input-border-radius: 10px;
    --swal2-input-focus-border: 1px solid var(--in3m-brand, #0b3d91);
    --swal2-input-focus-box-shadow: 0 0 0 3px rgba(11, 61, 145, 0.2);

    --swal2-close-button-color: #94a3b8;
    --swal2-close-button-font-size: 2rem;

    --swal2-timer-progress-bar-background: var(--in3m-brand, #0b3d91);

    --swal2-toast-border: 1px solid var(--in3m-card-border, #e2e8f2);
    --swal2-toast-box-shadow: 0 12px 32px rgba(11, 61, 145, 0.14);
}

/* Backdrop blur — chỉ modal (không toast: toast không phủ full màn) */
body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-container).swal2-backdrop-show {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

body.swal2-toast-shown div:where(.swal2-container) {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: transparent !important;
}

/* Modal */
div:where(.swal2-container) div:where(.swal2-popup) {
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 22px 50px rgba(11, 61, 145, 0.16);
    font-family: inherit;
}

div:where(.swal2-container) h2:where(.swal2-title) {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.35;
    color: #0f172a;
}

div:where(.swal2-container) div:where(.swal2-html-container) {
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.55;
    color: var(--in3m-text-muted, #5b6b82);
}

div:where(.swal2-container) div:where(.swal2-actions) {
    gap: 0.65rem;
    width: 100%;
    padding-top: 0.15rem;
}

/* Modal buttons (không áp toast) */
body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-container) button:where(.swal2-styled) {
    margin: 0;
    padding: 0.62em 1.35em;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    min-width: 5.5rem;
    border: 1px solid transparent;
    box-shadow: none;
    transition:
        transform 0.14s ease,
        box-shadow 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease;
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm) {
    background: linear-gradient(135deg, var(--in3m-brand, #0b3d91) 0%, #1a5bb8 52%, #2563eb 100%);
    color: #fff;
    border-color: rgba(11, 61, 145, 0.35);
    box-shadow: 0 2px 8px rgba(11, 61, 145, 0.22);
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(11, 61, 145, 0.32);
    filter: brightness(1.03);
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(11, 61, 145, 0.2);
    filter: brightness(0.98);
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel) {
    background: #fff;
    color: #475569;
    border-color: #cbd5e1;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):hover {
    background: var(--in3m-brand-light, #e8effa);
    color: var(--in3m-brand, #0b3d91);
    border-color: #93b4e8;
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):active {
    background: #dce8f8;
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny) {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 50%, #dc2626 100%);
    color: #fff;
    border-color: rgba(220, 38, 38, 0.35);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.22);
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.28);
    filter: brightness(1.02);
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-container) button:where(.swal2-styled):focus-visible {
    outline: none;
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35), 0 2px 8px rgba(11, 61, 145, 0.2);
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):focus-visible {
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.45);
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):focus-visible {
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.45);
}

div:where(.swal2-container) button:where(.swal2-close) {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    color: #94a3b8;
    transition: background 0.15s ease, color 0.15s ease;
}

div:where(.swal2-container) button:where(.swal2-close):hover {
    color: #64748b;
    background: #f1f5f9;
}

/* Modal icons — Bootstrap Icons trên nền tròn (toast giữ icon mặc định nhỏ) */
body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-icon) {
    --in3m-swal-icon-size: 3.65rem;
    width: var(--in3m-swal-icon-size);
    height: var(--in3m-swal-icon-size);
    margin: 1.35em auto 0.9em;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    animation: none !important;
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-icon) > * {
    display: none !important;
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-icon)::before {
    display: inline-block;
    font-family: bootstrap-icons !important;
    font-style: normal;
    font-weight: 400 !important;
    font-size: 1.85rem;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-icon).swal2-success {
    background: linear-gradient(145deg, #ecfdf5 0%, #d1fae5 100%);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.18);
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-icon).swal2-success::before {
    content: "\f26a";
    color: #10b981;
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-icon).swal2-error {
    background: linear-gradient(145deg, #fef2f2 0%, #fee2e2 100%);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.16);
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-icon).swal2-error::before {
    content: "\f622";
    color: #ef4444;
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-icon).swal2-warning {
    background: linear-gradient(145deg, #fffbeb 0%, #fef3c7 100%);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.16);
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-icon).swal2-warning::before {
    content: "\f33a";
    color: #f59e0b;
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-icon).swal2-info {
    background: linear-gradient(145deg, #eff6ff 0%, #dbeafe 100%);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.14);
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-icon).swal2-info::before {
    content: "\f430";
    color: #2563eb;
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-icon).swal2-question {
    background: linear-gradient(145deg, #e8effa 0%, #dbeafe 100%);
    box-shadow: 0 4px 14px rgba(11, 61, 145, 0.14);
}

body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-icon).swal2-question::before {
    content: "\f504";
    color: var(--in3m-brand, #0b3d91);
}

div:where(.swal2-container) div:where(.swal2-loader) {
    border-color: var(--in3m-brand, #0b3d91) transparent var(--in3m-brand, #0b3d91) transparent;
}

/* Toast (showToast, session flashes) */
.swal2-popup.swal2-toast {
    border-radius: 12px;
    padding: 0.75rem 1rem;
    min-height: auto;
}

.swal2-popup.swal2-toast .swal2-title {
    margin: 0 0.5em;
    padding: 0;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    color: #1e293b;
}

.swal2-popup.swal2-toast .swal2-icon {
    width: 1.75em;
    height: 1.75em;
    margin: 0 0.5em 0 0;
    border-width: 0.15em;
}

body.swal2-toast-shown .swal2-container {
    width: min(380px, calc(100vw - 1.5rem));
}

body.swal2-toast-shown .swal2-container.swal2-top-end,
body.swal2-toast-shown .swal2-container.swal2-top-right {
    padding: 0.85rem;
}

.swal2-popup.swal2-toast .swal2-timer-progress-bar {
    height: 3px;
    opacity: 0.85;
}

@media (max-width: 575.98px) {
    :root {
        --swal2-width: calc(100vw - 2rem);
        --swal2-padding: 1.35rem 1.15rem 1.15rem;
    }

    body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-container) button:where(.swal2-styled) {
        flex: 1 1 auto;
        min-width: 0;
    }

    body.swal2-shown:not(.swal2-toast-shown) div:where(.swal2-container) div:where(.swal2-actions) {
        flex-direction: column-reverse;
        align-items: stretch;
    }
}
