/* ==========================================================================
   LMS modal dialogs
   --------------------------------------------------------------------------
   Shared by every role (admin, organizer, committee, team representative and
   the public pages). Loaded from assets/css/lms-modal.css and paired with
   assets/js/lms-dialog.js (window.LmsDialog).

   What is modernised here
   -----------------------
   1. SweetAlert2 dialogs -> the confirmation / alert / loading popups every
      role uses for "Are you sure?" questions and inline warnings.
   2. Bootstrap modals    -> the shell (frame, radius, shadow, footer buttons)
      of the create / edit / detail dialogs.

   Scoping
   -------
   * Dialog rules hang off .swal2-popup:not(.swal2-toast). SweetAlert2 marks
     floating toasts with .swal2-toast, so assets/css/lms-toast.css keeps full
     ownership of them and the two components can never fight.
   * SweetAlert2 exposes design tokens (--swal2-*) which are set on the popup,
     so call sites that pass their own confirmButtonColor / cancelButtonColor
     still win: those colours become inline styles.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Backdrop
   -------------------------------------------------------------------------- */
body:not(.swal2-toast-shown) .swal2-container {
    --swal2-backdrop: rgba(9, 23, 60, .45);
    padding: 1rem;
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */
.swal2-popup:not(.swal2-toast) {
    --swal2-width: 34em;
    --swal2-padding: 26px 26px 22px;
    --swal2-border: 1px solid rgba(9, 23, 60, .07);
    --swal2-border-radius: 18px;
    --swal2-background: #ffffff;
    --swal2-color: #0b1f3a;
    --swal2-title-padding: 0;
    --swal2-html-container-padding: 0;
    --swal2-actions-margin: 22px auto 0;

    --swal2-confirm-button-background-color: #123f70;
    --swal2-confirm-button-border-radius: 10px;
    --swal2-confirm-button-box-shadow: none;
    --swal2-cancel-button-background-color: #64748b;
    --swal2-cancel-button-border-radius: 10px;
    --swal2-cancel-button-box-shadow: none;
    --swal2-deny-button-background-color: #b02a37;
    --swal2-deny-button-border-radius: 10px;
    --swal2-deny-button-box-shadow: none;

    --swal2-close-button-position: absolute;
    --swal2-close-button-inset: 14px 14px auto auto;
    --swal2-close-button-font-size: 19px;
    --swal2-close-button-color: #94a3b8;
    --swal2-close-button-box-shadow: none;
    --swal2-close-button-hover-transform: none;

    --swal2-input-border: 1px solid #dfe6ef;
    --swal2-input-border-radius: 10px;
    --swal2-input-box-shadow: none;
    --swal2-input-focus-border: 1px solid #2f6fed;
    --swal2-input-focus-box-shadow: 0 0 0 3px rgba(47, 111, 237, .16);
    --swal2-input-transition: border-color .15s ease, box-shadow .15s ease;

    --swal2-timer-progress-bar-background: rgba(9, 23, 60, .18);
    --swal2-validation-message-background: #fdf1e0;
    --swal2-validation-message-color: #8a5200;

    font-family: 'Poppins', sans-serif !important;
    box-shadow:
        0 30px 64px -28px rgba(9, 23, 60, .55),
        0 12px 28px -18px rgba(9, 23, 60, .28) !important;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
.swal2-popup:not(.swal2-toast) .swal2-title {
    margin: 0 0 6px !important;
    font-family: inherit !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    letter-spacing: -.01em;
    color: #0b1f3a !important;
    text-align: center !important;
}

.swal2-popup:not(.swal2-toast) .swal2-html-container {
    margin: 0 !important;
    font-family: inherit !important;
    font-size: 13.5px !important;
    line-height: 1.65 !important;
    color: #5b6b82 !important;
    text-align: center;
}

/* Icon: scaling the font-size scales the whole drawing (all inner parts
   are positioned in em units). */
.swal2-popup:not(.swal2-toast) .swal2-icon {
    font-size: .84em !important;
    margin: 0 auto 18px !important;
    border-width: .2em !important;
}

/* --------------------------------------------------------------------------
   Actions
   -------------------------------------------------------------------------- */
.swal2-popup:not(.swal2-toast) .swal2-actions {
    flex-wrap: wrap;
    gap: 10px;
}

.swal2-popup:not(.swal2-toast) .swal2-styled {
    margin: 0 !important;
    min-width: 118px;
    padding: 11px 20px !important;
    font-family: inherit !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    letter-spacing: .01em;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.swal2-popup:not(.swal2-toast) .swal2-styled:focus-visible {
    outline: 2px solid #93b8ff;
    outline-offset: 2px;
}

.swal2-popup:not(.swal2-toast) .swal2-styled:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px -12px rgba(9, 23, 60, .55) !important;
}

/* --------------------------------------------------------------------------
   Close button + loader
   -------------------------------------------------------------------------- */
.swal2-popup:not(.swal2-toast) .swal2-close {
    width: 30px !important;
    height: 30px !important;
    border-radius: 10px;
    line-height: 1;
    transition: background-color .15s ease, color .15s ease;
}

.swal2-popup:not(.swal2-toast) .swal2-close:hover,
.swal2-popup:not(.swal2-toast) .swal2-close:focus {
    background: #f1f5f9 !important;
    color: #0b1f3a !important;
}

.swal2-popup:not(.swal2-toast) .swal2-loader {
    border-color: #123f70 transparent #123f70 transparent !important;
}

/* --------------------------------------------------------------------------
   Fields inside custom-HTML dialogs (return for correction, timelines, …)
   -------------------------------------------------------------------------- */
.swal2-popup:not(.swal2-toast) .swal2-input,
.swal2-popup:not(.swal2-toast) .swal2-textarea,
.swal2-popup:not(.swal2-toast) .swal2-select,
.swal2-popup:not(.swal2-toast) .swal2-file {
    font-family: inherit !important;
    font-size: 13.5px !important;
}

.swal2-popup:not(.swal2-toast) .swal2-html-container .form-control,
.swal2-popup:not(.swal2-toast) .swal2-html-container .form-select,
.swal2-popup:not(.swal2-toast) .swal2-html-container textarea {
    border: 1px solid #dfe6ef !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    font-size: 13px;
}

.swal2-popup:not(.swal2-toast) .swal2-html-container .form-control:focus,
.swal2-popup:not(.swal2-toast) .swal2-html-container .form-select:focus,
.swal2-popup:not(.swal2-toast) .swal2-html-container textarea:focus {
    border-color: #2f6fed !important;
    box-shadow: 0 0 0 3px rgba(47, 111, 237, .16) !important;
}

/* --------------------------------------------------------------------------
   Loading dialog (LmsDialog.loading / LmsDialog.loadingHtml)
   -------------------------------------------------------------------------- */
.lms-dialog-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 4px 0 2px;
}

.lms-dialog-loading .spinner-border {
    width: 34px;
    height: 34px;
    border-width: 3px;
    color: #123f70;
}

.lms-dialog-loading-text {
    margin: 0;
    color: #5b6b82;
    font-size: 12.5px;
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    .swal2-popup:not(.swal2-toast) {
        --swal2-padding: 22px 18px 18px;
        --swal2-border-radius: 16px;
    }

    .swal2-popup:not(.swal2-toast) .swal2-styled {
        flex: 1 1 100%;
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .swal2-popup:not(.swal2-toast) .swal2-styled:hover {
        transform: none;
    }
}

/* ==========================================================================
   Bootstrap modal shell
   Page specific designs (.lp-modal, .ov-orgm, …) keep winning wherever they
   set their own frame, because their rules are more specific.
   ========================================================================== */
.modal {
    --bs-modal-border-radius: 14px;
    --bs-modal-inner-border-radius: 14px;
}

.modal .modal-content {
    border: 0;
    border-radius: 14px;
    box-shadow: 0 28px 60px -30px rgba(9, 23, 60, .5), 0 12px 24px -18px rgba(9, 23, 60, .28);
}

.modal .modal-header {
    padding: 18px 22px;
}

.modal .modal-title {
    font-size: 1.02rem;
    font-weight: 600;
    letter-spacing: -.01em;
}

.modal .modal-body {
    font-size: 13.5px;
}

.modal .modal-footer {
    padding: 16px 22px;
    gap: 8px;
}

.modal .modal-footer .btn {
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
}

.modal .modal-header .btn-close {
    border-radius: 8px;
    transition: background-color .15s ease;
}

.modal .modal-header .btn-close:hover {
    background-color: rgba(255, 255, 255, .16);
}
