:root {
    --app-swal-width: 420px;
    --app-swal-radius: 16px;
    --app-swal-padding: 1.5rem;
    --app-swal-title-size: 1.35rem;
    --app-swal-title-size-mobile: 1.19rem;
    --app-swal-text-size: 0.97rem;
    --app-swal-text-color: #4b5563;
    --app-swal-title-color: #182433;
    --app-swal-confirm-bg: #0d6efd;
    --app-swal-confirm-bg-hover: #0b5ed7;
    --app-swal-cancel-bg: #f1f3f5;
    --app-swal-cancel-bg-hover: #e9ecef;
    --app-swal-cancel-text: #343a40;
    --app-swal-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
    --app-swal-border: rgba(15, 23, 42, 0.06);
    --app-swal-focus: rgba(13, 110, 253, 0.22);
    --app-swal-danger: #dc3545;
    --app-swal-danger-hover: #bb2d3b;
}

/* Keep SweetAlert2 above Bootstrap modals and drawers. */
.swal2-container {
    z-index: 2147483647 !important;
    padding: 15px !important;
}

.swal2-container.swal2-backdrop-show {
    backdrop-filter: blur(2px);
}

.swal2-container .swal2-popup {
    width: var(--app-swal-width) !important;
    max-width: calc(100vw - 30px) !important;
    padding: var(--app-swal-padding) !important;
    border-radius: var(--app-swal-radius) !important;
    border: 1px solid var(--app-swal-border) !important;
    background: #fff !important;
    color: #243042 !important;
    box-shadow: var(--app-swal-shadow) !important;
    font-family: inherit !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.swal2-container .swal2-title {
    margin: 0.1rem 0 0.35rem !important;
    padding: 0 !important;
    font-size: var(--app-swal-title-size) !important;
    line-height: 1.25 !important;
    font-weight: 600 !important;
    color: var(--app-swal-title-color) !important;
    text-wrap: balance;
}

.swal2-container .swal2-html-container {
    margin: 0.35rem 0 0 !important;
    padding: 0 !important;
    font-size: var(--app-swal-text-size) !important;
    line-height: 1.5 !important;
    color: var(--app-swal-text-color) !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    white-space: normal !important;
}

.swal2-container .swal2-icon {
    margin: 0.15rem auto 0.7rem !important;
    transform: scale(0.82);
    transform-origin: center center;
}

.swal2-container .swal2-actions {
    margin: 1rem 0 0 !important;
    padding: 0 !important;
    gap: 0.65rem !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: wrap-reverse !important;
}

.swal2-container .swal2-styled,
.swal2-container .swal2-confirm,
.swal2-container .swal2-cancel {
    min-height: 40px !important;
    padding: 0.6rem 1.15rem !important;
    border-radius: 8px !important;
    font-size: 0.95rem !important;
    line-height: 1.2 !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.swal2-container .swal2-confirm {
    background: var(--app-swal-confirm-bg) !important;
    border: 1px solid var(--app-swal-confirm-bg) !important;
    color: #fff !important;
}

.swal2-container .swal2-confirm:hover {
    background: var(--app-swal-confirm-bg-hover) !important;
    border-color: var(--app-swal-confirm-bg-hover) !important;
}

.swal2-container .swal2-cancel {
    background: var(--app-swal-cancel-bg) !important;
    border: 1px solid #d7dce1 !important;
    color: var(--app-swal-cancel-text) !important;
}

.swal2-container .swal2-cancel:hover {
    background: var(--app-swal-cancel-bg-hover) !important;
}

.swal2-container .swal2-styled:focus,
.swal2-container .swal2-styled:focus-visible,
.swal2-container .swal2-input:focus,
.swal2-container .swal2-textarea:focus {
    box-shadow: 0 0 0 0.2rem var(--app-swal-focus) !important;
}

.swal2-container .swal2-styled:focus-visible {
    outline: 0 !important;
}

.swal2-container .swal2-input,
.swal2-container .swal2-textarea {
    width: 100% !important;
    min-height: 40px !important;
    padding: 0.6rem 0.85rem !important;
    border-radius: 10px !important;
    border: 1px solid #d7dce1 !important;
    background: #fff !important;
    color: #243042 !important;
    font-size: 0.95rem !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
}

.swal2-container .swal2-textarea {
    min-height: 92px !important;
    resize: vertical !important;
}

.swal2-container .swal2-validation-message {
    margin-top: 0.75rem !important;
    padding: 0.7rem 0.9rem !important;
    font-size: 0.92rem !important;
    border-radius: 10px !important;
}

.swal2-container .swal2-close {
    color: #94a3b8 !important;
    font-size: 1.6rem !important;
    line-height: 1 !important;
    box-shadow: none !important;
}

.swal2-container .swal2-loader {
    border-color: rgba(13, 110, 253, 0.2) !important;
    border-top-color: #0d6efd !important;
}

.swal2-container .app-swal-confirm-danger,
.swal2-container .swal2-confirm.swal2-confirm--danger {
    background: var(--app-swal-danger) !important;
    border-color: var(--app-swal-danger) !important;
    color: #fff !important;
}

.swal2-container .app-swal-confirm-danger:hover,
.swal2-container .swal2-confirm.swal2-confirm--danger:hover {
    background: var(--app-swal-danger-hover) !important;
    border-color: var(--app-swal-danger-hover) !important;
}

.swal2-container .swal2-popup.swal2-toast {
    width: auto !important;
    max-width: min(420px, calc(100vw - 30px)) !important;
    padding: 0.85rem 1rem !important;
    border-radius: 14px !important;
}

.swal2-container .swal2-popup.swal2-toast .swal2-title {
    font-size: 1rem !important;
}

.swal2-container .swal2-popup.swal2-toast .swal2-html-container {
    font-size: 0.9rem !important;
}

.swal2-container .swal2-popup.swal2-toast .swal2-actions {
    margin-top: 0.5rem !important;
}

@keyframes app-swal-popup-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.985);
    }

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

.swal2-container .swal2-popup.swal2-show,
.swal2-container .swal2-popup.swal2-animate-show {
    animation: app-swal-popup-in 180ms ease-out;
}

@media (max-width: 575.98px) {
    .swal2-container {
        padding: 15px !important;
    }

    .swal2-container .swal2-popup {
        width: calc(100vw - 30px) !important;
        max-width: calc(100vw - 30px) !important;
        padding: 1.15rem !important;
        border-radius: 14px !important;
    }

    .swal2-container .swal2-title {
        font-size: var(--app-swal-title-size-mobile) !important;
    }

    .swal2-container .swal2-html-container {
        font-size: 0.94rem !important;
    }

    .swal2-container .swal2-actions {
        gap: 0.5rem !important;
    }

    .swal2-container .swal2-styled,
    .swal2-container .swal2-confirm,
    .swal2-container .swal2-cancel {
        width: 100% !important;
    }
}
