/* =====================================================
   SWEETALERT2 - PADRAO VISUAL EFCOL / ACADEMY
   Mantem icones semanticos e unifica popup, acoes e botoes.
   ===================================================== */

.swal2-container {
    z-index: 99999 !important;
}

/* Isola as familias para que icons.min.css nao sobrescreva as badges. */
[class^="bx"],
[class*=" bx"],
.bx {
    font-family: "boxicons" !important;
    font-style: normal !important;
    font-weight: normal !important;
    speak: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.mdi::before,
.mdi-set {
    font-family: "Material Design Icons" !important;
}

.swal2-popup:not(.swal2-toast) {
    background: #fff !important;
    border-radius: 18px !important;
    padding: 2.25rem 2rem 1.75rem !important;
    border: 1px solid rgba(0, 0, 0, .06) !important;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .14), 0 6px 20px rgba(0, 0, 0, .07) !important;
    font-family: inherit !important;
}

.swal2-title {
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    line-height: 1.3 !important;
}

.swal2-html-container {
    font-size: .9rem !important;
    color: #64748b !important;
}

.swal2-actions {
    gap: .6rem !important;
    margin-top: 1.6rem !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
}

/* Neutraliza regras legadas globais de actions/botoes carregadas antes deste tema. */
.swal2-popup:not(.swal2-toast) .swal2-actions {
    width: auto !important;
    padding: 0 !important;
    margin: 1.6rem 0 0 !important;
}

.swal2-styled {
    border-radius: 9px !important;
    font-size: .875rem !important;
    font-weight: 600 !important;
    padding: .575rem 1.35rem !important;
    border: none !important;
    line-height: 1.4 !important;
    letter-spacing: .01em !important;
    transition: transform .12s ease, box-shadow .12s ease, background .15s ease !important;
}

.swal2-popup:not(.swal2-toast) .swal2-actions .swal2-styled {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    margin: 0 !important;
    padding: .575rem 1.35rem !important;
}

.swal2-styled:active {
    transform: scale(.97) !important;
}

.swal2-styled i,
.swal2-styled svg {
    flex: 0 0 auto !important;
    margin-right: .45rem !important;
    line-height: 1 !important;
}

.swal2-title i,
.swal2-title svg {
    margin-right: .4rem !important;
    vertical-align: -.08em !important;
}

.swal2-styled.swal2-confirm {
    background: #b21f2a !important;
    color: #fff !important;
    box-shadow: 0 3px 10px rgba(178, 31, 42, .35) !important;
}

.swal2-styled.swal2-confirm:hover {
    background: #8f1822 !important;
    box-shadow: 0 5px 16px rgba(178, 31, 42, .45) !important;
}

.swal2-styled.swal2-deny {
    background: #475569 !important;
    color: #fff !important;
    box-shadow: 0 3px 10px rgba(71, 85, 105, .25) !important;
}

.swal2-styled.swal2-cancel {
    background: transparent !important;
    color: #64748b !important;
    border: 1.5px solid #e2e8f0 !important;
    box-shadow: none !important;
}

.swal2-styled.swal2-cancel:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
}

.swal2-input,
.swal2-textarea,
.swal2-select {
    border-radius: 9px !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}

/* O icone e definido por Swal (success/error/warning/info/question). */
.swal2-icon {
    margin: 0 auto 1rem !important;
}

.swal2-icon .swal2-icon-content {
    font-family: Arial, sans-serif !important;
    font-weight: 700 !important;
}

.swal2-actions .swal2-styled[style*="display: none"] {
    display: none !important;
}

.swal2-actions .swal2-styled[style*="display:none"] {
    display: none !important;
}

.swal2-actions .swal2-styled[style*="display: inline-block"],
.swal2-actions .swal2-styled[style*="display: block"],
.swal2-actions .swal2-styled[style*="display: flex"] {
    display: flex !important;
}

body.dark-mode .swal2-popup,
body.academy-dark-mode .swal2-popup,
body.membros-dark-mode .swal2-popup {
    background: #1e2a3a !important;
    color: #e2e8f0 !important;
    border-color: #2d3f54 !important;
}

body.dark-mode .swal2-title,
body.academy-dark-mode .swal2-title,
body.membros-dark-mode .swal2-title {
    color: #f0f4f8 !important;
}

body.dark-mode .swal2-html-container,
body.academy-dark-mode .swal2-html-container,
body.membros-dark-mode .swal2-html-container {
    color: #a8b8cc !important;
}

body.academy-dark-mode .swal2-input,
body.academy-dark-mode .swal2-textarea,
body.academy-dark-mode .swal2-select,
body.membros-dark-mode .swal2-input,
body.membros-dark-mode .swal2-textarea,
body.membros-dark-mode .swal2-select,
body.dark-mode .swal2-input,
body.dark-mode .swal2-textarea,
body.dark-mode .swal2-select {
    background: #243447 !important;
    border-color: #3a5068 !important;
    color: #e2e8f0 !important;
}

body.dark-mode .swal2-styled.swal2-cancel,
body.academy-dark-mode .swal2-styled.swal2-cancel,
body.membros-dark-mode .swal2-styled.swal2-cancel {
    background: #2d3f54 !important;
    border-color: #3a5068 !important;
    color: #e2e8f0 !important;
}

body.dark-mode .swal2-close,
body.academy-dark-mode .swal2-close,
body.membros-dark-mode .swal2-close {
    color: #a8b8cc !important;
}

/* Toasts use a compact card on every screen, independent of the page CSS. */
.swal2-popup.swal2-toast {
    width: min(420px, calc(100vw - 32px)) !important;
    min-height: 0 !important;
    padding: .85rem 1rem !important;
    border: 1px solid rgba(15, 23, 42, .10) !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: 0 14px 32px rgba(15, 23, 42, .18) !important;
    color: #1e293b !important;
    font-family: inherit !important;
}

.swal2-popup.swal2-toast .swal2-title {
    color: inherit !important;
    font-size: .9rem !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
}

.swal2-popup.swal2-toast .swal2-html-container {
    margin: .2rem 0 0 !important;
    color: #64748b !important;
    font-size: .8rem !important;
    line-height: 1.4 !important;
}

.swal2-popup.swal2-toast .swal2-icon {
    width: 28px !important;
    min-width: 28px !important;
    height: 28px !important;
    margin: 0 .7rem 0 0 !important;
    transform: scale(.72) !important;
    transform-origin: center !important;
}

.swal2-popup.swal2-toast .swal2-close {
    color: #64748b !important;
}

.swal2-popup.swal2-toast .swal2-timer-progress-bar {
    background: rgba(178, 31, 42, .65) !important;
}

/* Toasts nunca devem herdar a area de acoes de modais legados. */
.swal2-popup.swal2-toast .swal2-actions {
    display: none !important;
    width: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.dark-mode .swal2-popup.swal2-toast,
body.academy-dark-mode .swal2-popup.swal2-toast,
body.membros-dark-mode .swal2-popup.swal2-toast {
    background: #1e2a3a !important;
    border-color: #3a5068 !important;
    box-shadow: 0 14px 32px rgba(0, 0, 0, .38) !important;
    color: #f0f4f8 !important;
}

body.dark-mode .swal2-popup.swal2-toast .swal2-html-container,
body.academy-dark-mode .swal2-popup.swal2-toast .swal2-html-container,
body.membros-dark-mode .swal2-popup.swal2-toast .swal2-html-container {
    color: #a8b8cc !important;
}

body.dark-mode .swal2-popup.swal2-toast .swal2-close,
body.academy-dark-mode .swal2-popup.swal2-toast .swal2-close,
body.membros-dark-mode .swal2-popup.swal2-toast .swal2-close {
    color: #a8b8cc !important;
}

/* =====================================================
   MOBILE - CARD FLUIDO COM CONTROLES TOUCH-FRIENDLY
   ===================================================== */
@media (max-width: 600px) {
    .swal2-container {
        align-items: center !important;
        padding: 16px !important;
        box-sizing: border-box !important;
    }

    .swal2-popup:not(.swal2-toast) {
        width: 100% !important;
        max-width: 100% !important;
        max-height: calc(100vh - 32px) !important;
        max-height: calc(100dvh - 32px) !important;
        margin: 0 !important;
        padding: 24px 18px 18px !important;
        border-radius: 20px !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .swal2-header {
        padding: 0 !important;
    }

    .swal2-icon {
        width: 64px !important;
        height: 64px !important;
        margin: 0 auto 14px !important;
        transform: none !important;
        flex-shrink: 0 !important;
    }

    .swal2-icon .swal2-icon-content {
        font-size: 2.25rem !important;
        line-height: 64px !important;
    }

    .swal2-icon.swal2-error [class^='swal2-x-mark-line'] {
        width: 2.4em !important;
        height: .22em !important;
    }

    /* Os desenhos nativos usam medidas em em e quebram ao reduzir o icone. */
    .swal2-icon.swal2-success .swal2-icon-content,
    .swal2-icon.swal2-success [class^='swal2-success-line'],
    .swal2-icon.swal2-success [class^='swal2-success-circular-line'],
    .swal2-icon.swal2-success .swal2-success-fix,
    .swal2-icon.swal2-error .swal2-icon-content,
    .swal2-icon.swal2-error .swal2-x-mark,
    .swal2-icon.swal2-warning .swal2-icon-content,
    .swal2-icon.swal2-info .swal2-icon-content,
    .swal2-icon.swal2-question .swal2-icon-content {
        display: none !important;
    }

    .swal2-icon.swal2-success::before {
        content: '' !important;
        position: absolute !important;
        z-index: 3 !important;
        top: 14px !important;
        left: 22px !important;
        width: 17px !important;
        height: 31px !important;
        border-right: 5px solid currentColor !important;
        border-bottom: 5px solid currentColor !important;
        border-radius: 1px !important;
        transform: rotate(45deg) !important;
        box-sizing: border-box !important;
    }

    .swal2-icon.swal2-success .swal2-success-ring {
        display: block !important;
        position: absolute !important;
        inset: -4px !important;
        width: auto !important;
        height: auto !important;
        border-width: 4px !important;
        box-sizing: border-box !important;
    }

    .swal2-icon.swal2-warning::before,
    .swal2-icon.swal2-info::before,
    .swal2-icon.swal2-question::before {
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        display: block !important;
        color: currentColor !important;
        font-family: Arial, sans-serif !important;
        font-size: 36px !important;
        font-weight: 700 !important;
        line-height: 1 !important;
        transform: translate(-50%, -50%) !important;
    }

    .swal2-icon.swal2-warning::before { content: '!' !important; }
    .swal2-icon.swal2-info::before { content: 'i' !important; }
    .swal2-icon.swal2-question::before { content: '?' !important; }

    .swal2-icon.swal2-error::before,
    .swal2-icon.swal2-error::after {
        content: '' !important;
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        z-index: 3 !important;
        width: 32px !important;
        height: 5px !important;
        border-radius: 3px !important;
        background: currentColor !important;
        transform: translate(-50%, -50%) rotate(45deg) !important;
    }

    .swal2-icon.swal2-error::after {
        transform: translate(-50%, -50%) rotate(-45deg) !important;
    }

    .swal2-title {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 1.08rem !important;
        line-height: 1.35 !important;
        overflow-wrap: anywhere !important;
    }

    .swal2-html-container,
    .swal2-content {
        width: 100% !important;
        max-height: calc(100vh - 180px) !important;
        max-height: calc(100dvh - 180px) !important;
        margin: 12px 0 0 !important;
        padding: 0 2px !important;
        font-size: .9rem !important;
        line-height: 1.55 !important;
        overflow-x: auto !important;
        overflow-y: auto !important;
        overflow-wrap: anywhere !important;
        box-sizing: border-box !important;
        flex: 0 1 auto !important;
        min-height: 0 !important;
    }

    .swal2-content {
        background: transparent !important;
    }

    .swal2-actions {
        position: static !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        width: 100% !important;
        margin: 20px 0 0 !important;
        padding: 0 !important;
        gap: 10px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        box-sizing: border-box !important;
        flex: 0 0 auto !important;
    }

    .swal2-styled,
    .swal2-actions .swal2-styled {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        min-height: 48px !important;
        height: auto !important;
        margin: 0 !important;
        padding: 12px 16px !important;
        align-items: center !important;
        justify-content: center !important;
        white-space: normal !important;
        text-align: center !important;
        box-sizing: border-box !important;
        transform: none !important;
    }

    .swal2-styled:active {
        transform: scale(.985) !important;
    }

    .swal2-close {
        top: 8px !important;
        right: 8px !important;
        width: 40px !important;
        height: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1.5rem !important;
        border-radius: 50% !important;
    }

    .swal2-input,
    .swal2-textarea,
    .swal2-select {
        width: 100% !important;
        max-width: 100% !important;
        margin: 10px 0 !important;
        box-sizing: border-box !important;
        font-size: 16px !important;
    }

    .swal2-validation-message {
        margin: 10px 0 0 !important;
        font-size: .82rem !important;
        overflow-wrap: anywhere !important;
    }

    /* Toasts remain compact and never inherit stacked modal actions. */
    .swal2-popup.swal2-toast {
        width: calc(100vw - 32px) !important;
        max-width: 420px !important;
        margin: 0 !important;
        padding: 12px 14px !important;
        border-radius: 14px !important;
        box-sizing: border-box !important;
    }

    .swal2-popup.swal2-toast .swal2-title {
        font-size: .86rem !important;
        text-align: left !important;
    }

    .swal2-popup.swal2-toast .swal2-icon {
        width: 22px !important;
        height: 22px !important;
        margin: 0 8px 0 0 !important;
        transform: none !important;
    }
}

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

    .swal2-popup:not(.swal2-toast) {
        max-height: calc(100vh - 20px) !important;
        max-height: calc(100dvh - 20px) !important;
        padding: 22px 14px 14px !important;
    }

    .swal2-html-container,
    .swal2-content {
        max-height: calc(100vh - 170px) !important;
        max-height: calc(100dvh - 170px) !important;
    }
}

/* O stylesheet legado transforma modais em fullscreen ate 768px e fixa fundo branco. */
@media (max-width: 768px) {
    body.dark-mode .swal2-container:not(.swal2-container-toast) .swal2-popup:not(.swal2-toast),
    body.academy-dark-mode .swal2-container:not(.swal2-container-toast) .swal2-popup:not(.swal2-toast),
    body.membros-dark-mode .swal2-container:not(.swal2-container-toast) .swal2-popup:not(.swal2-toast) {
        background: #1e2a3a !important;
        border-color: #2d3f54 !important;
    }

    body.dark-mode .swal2-popup:not(.swal2-toast) .swal2-html-container,
    body.dark-mode .swal2-popup:not(.swal2-toast) .swal2-content,
    body.academy-dark-mode .swal2-popup:not(.swal2-toast) .swal2-html-container,
    body.academy-dark-mode .swal2-popup:not(.swal2-toast) .swal2-content,
    body.membros-dark-mode .swal2-popup:not(.swal2-toast) .swal2-html-container,
    body.membros-dark-mode .swal2-popup:not(.swal2-toast) .swal2-content {
        background: transparent !important;
        color: #a8b8cc !important;
    }

    body.dark-mode .swal2-popup:not(.swal2-toast) .swal2-actions,
    body.academy-dark-mode .swal2-popup:not(.swal2-toast) .swal2-actions,
    body.membros-dark-mode .swal2-popup:not(.swal2-toast) .swal2-actions {
        background: #1e2a3a !important;
        border-color: #2d3f54 !important;
    }
}
