/* SweetAlert2 pop-ups (js/alerts.js) in the site's own colours and type. Loaded after
   lib/sweetalert2/dist/sweetalert2.min.css, which is the plain stylesheet: the build that injects its CSS from
   script would break the Content-Security-Policy. The public site uses the Indigo & Coral palette; the portal uses
   its own light and dark roles, so a pop-up follows the dark-mode switch. Icon colours are 4.5:1 or better against
   the pop-up in every theme, and the buttons are the site's own, with their focus rings. */

body.public-site {
    --pop-surface: var(--paper);
    --pop-title: var(--ink);
    --pop-text: var(--body);
    --pop-ok: var(--mint-700);
    --pop-warn: var(--sun-600);
    --pop-bad: var(--rose-700);
    --pop-backdrop: rgba(30, 27, 75, .55);
    --pop-shadow: var(--shadow-lg);
}

body.admin {
    --pop-surface: var(--admin-surface);
    --pop-title: var(--admin-text);
    --pop-text: var(--admin-body);
    --pop-ok: var(--admin-ok);
    --pop-warn: var(--admin-warn-text);
    --pop-bad: var(--admin-bad-text);
    --pop-backdrop: rgba(15, 24, 54, .6);
    --pop-shadow: var(--admin-shadow-pop);
}

.educe-pop {
    --swal2-backdrop: var(--pop-backdrop);
    --swal2-background: var(--pop-surface);
    --swal2-color: var(--pop-text);
    --swal2-border-radius: var(--r-lg);
    --swal2-width: 28rem;
    --swal2-padding: 28px 24px 26px;
    --swal2-icon-zoom: .8;
    --swal2-title-padding: 0 8px;
    --swal2-html-container-padding: 10px 8px 0;
    --swal2-actions-margin: 24px auto 0;
}

.educe-pop .educe-pop__box {
    box-shadow: var(--pop-shadow);
    font-family: var(--font-body);
}

.educe-pop .educe-pop__icon {
    margin: 0 auto 18px;
}

.educe-pop .educe-pop__title {
    margin: 0;
    color: var(--pop-title);
    font-family: var(--font-head);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
}

.educe-pop .educe-pop__text {
    color: var(--pop-text);
    font-size: 1rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.educe-pop .educe-pop__actions {
    flex-wrap: wrap;
    gap: 12px;
}

.educe-pop .educe-pop__actions > button {
    min-width: 7.5rem;
    min-height: 44px;
    margin: 0;
}

/* The icons in the site's colours rather than SweetAlert2's pastels, which are too faint on white. */
.educe-pop .swal2-icon.swal2-warning {
    border-color: var(--pop-warn);
    color: var(--pop-warn);
}

.educe-pop .swal2-icon.swal2-success {
    border-color: var(--pop-ok);
    color: var(--pop-ok);
}

.educe-pop .swal2-icon.swal2-success [class^="swal2-success-line"] {
    background-color: var(--pop-ok);
}

.educe-pop .swal2-icon.swal2-success .swal2-success-ring {
    border-color: color-mix(in srgb, var(--pop-ok) 30%, transparent);
}

.educe-pop .swal2-icon.swal2-error {
    border-color: var(--pop-bad);
    color: var(--pop-bad);
}

.educe-pop .swal2-icon.swal2-error [class^="swal2-x-mark-line"] {
    background-color: var(--pop-bad);
}

/* What to fix on a form (CR-5): a left-aligned list, so several messages read one per line. */
.educe-pop .educe-pop__errors {
    display: inline-block;
    max-width: 100%;
    margin: 0;
    padding-left: 1.25rem;
    text-align: left;
}

.educe-pop .educe-pop__errors li + li {
    margin-top: 4px;
}

.educe-pop .educe-pop__errors li::marker {
    color: var(--pop-bad);
}

/* Reduced motion: the pop-up and its icon simply appear. SweetAlert2 sees no animation and closes at once. */
@media (prefers-reduced-motion: reduce) {
    .educe-pop,
    .educe-pop *,
    .educe-pop *::before,
    .educe-pop *::after {
        animation: none !important;
        transition: none !important;
    }
}

@media print {
    .educe-pop {
        display: none !important;
    }
}
