/* =========================================================================
   Salus popup — global white popup style for SweetAlert2 (v6 + v11 markup)

   Include once on any page:
     <link href="<site>/assets/css/salus-popup.css" rel="stylesheet">
   Every swal / Swal.fire popup on that page becomes the white card.

   Colours follow the login portal tokens (--lp-*) when the page defines
   them (incl. the logo-derived theme), else the Salus EMR defaults.
   Override per page by redefining the --sp-* vars on :root.

   Optional extras:
     iconHtml: '<i class="fa fa-desktop"></i>'   -> custom icon in the soft circle
     reverseButtons: true                         -> Cancel left, primary right
   ========================================================================= */

:root {
    --sp-brand:      var(--lp-brand, #1f2421);
    --sp-brand-rgb:  var(--lp-brand-rgb, 31, 36, 33);
    --sp-brand-soft: var(--lp-brand-soft, #f1efe8);
    --sp-btn-1:      var(--lp-btn-1, #2b2e2b);
    --sp-btn-2:      var(--lp-btn-2, #1f2421);
    --sp-btn-3:      var(--lp-btn-3, #141614);
    --sp-on-brand:   var(--lp-on-brand, #ffffff);
    --sp-ink:        var(--lp-ink, #0f1a2e);
    --sp-muted:      var(--lp-muted, #5b6679);
    --sp-line:       var(--lp-line, #d9dee6);
    --sp-outline:    var(--lp-outline, #1f2421);
    --sp-outline-ink:var(--lp-outline-ink, #1f2421);
    --sp-danger:     #d64545;
    --sp-danger-soft:#fdecec;
    --sp-success:    #2f9e6e;
    --sp-warn:       #b7791f;
    --sp-warn-soft:  #fdf3e1;
    --sp-font:       'Plus Jakarta Sans', 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Backdrop ───────────────────────────────────────────────────────────── */
.swal2-container.swal2-backdrop-show,
.swal2-container.swal2-shown {
    background: rgba(15, 26, 46, .45) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ── Card ───────────────────────────────────────────────────────────────── */
.swal2-container :is(.swal2-popup, .swal2-modal),
.swal2-container .swal2-modal {
    width: 440px;                     /* a popup's own `width` option still wins */
    max-width: calc(100vw - 32px) !important;
    padding: 32px 28px 26px !important;
    background: #ffffff !important;
    border: 1px solid rgba(var(--sp-brand-rgb), .08);
    border-radius: 20px !important;
    box-shadow: 0 24px 60px rgba(15, 26, 46, .18), 0 2px 6px rgba(15, 26, 46, .06) !important;
    font-family: var(--sp-font) !important;
    box-sizing: border-box;
}
.swal2-container :is(.swal2-popup, .swal2-modal) *:not(.fa):not([class^="fa-"]):not([class*=" fa-"]) {
    font-family: var(--sp-font) !important;
}

/* ── Icon: soft tinted circle (warning / info / question) ───────────────── */
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon {
    margin: 0 auto 18px !important;
}
/* Resize only the plain circle icons. Success / error keep the library's own
   box size: older SweetAlert2 builds (v6/v7) place the tick and X strokes at
   fixed px offsets inside an 80px circle, so resizing them breaks the tick. */
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-warning,
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-info,
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-question {
    width: 88px !important;
    height: 88px !important;
    line-height: 88px !important;
    font-size: 60px !important;     /* v6 puts the "!" / "i" / "?" straight in the icon */
    font-weight: 700 !important;
    text-align: center !important;
    box-sizing: content-box !important;
    /* no `display` here: SweetAlert hides the unused icon types with an inline
       display:none, and forcing display would show all of them at once */
}
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-warning,
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-info,
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-question {
    border: none !important;
    color: var(--sp-brand) !important;
    background: var(--sp-brand-soft) !important;
    box-shadow: 0 0 0 10px rgba(var(--sp-brand-rgb), .06);
}
/* warning in amber so it still reads as a warning */
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-warning {
    color: var(--sp-warn) !important;
    background: var(--sp-warn-soft) !important;
    box-shadow: 0 0 0 10px rgba(183, 121, 31, .08);
}
/* v7 wraps the glyph in .swal2-icon-text, v11 in .swal2-icon-content */
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon .swal2-icon-text,
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon .swal2-icon-content {
    margin: 0 !important;
    font-size: 58px !important;
    line-height: inherit !important;
    font-weight: 700 !important;
    color: inherit !important;
}
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon .swal2-icon-content .fa {
    font-size: 36px;
}
/* error keeps its X, on a soft red circle */
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-error {
    border: none !important;
    background: var(--sp-danger-soft) !important;
    box-shadow: 0 0 0 8px rgba(214, 69, 69, .06);
}
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-error [class^="swal2-x-mark-line"] {
    background-color: var(--sp-danger) !important;
}
/* success keeps its animated tick, recoloured */
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-success {
    border-color: rgba(47, 158, 110, .3) !important;
}
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-success [class^="swal2-success-line"] {
    background-color: var(--sp-success) !important;
}
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(47, 158, 110, .3) !important;
}
/* masks used by the tick animation must match the white card
   (style.css sets them transparent for the old beige popup) */
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-success [class^="swal2-success-circular-line"],
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-success .swal2-success-fix {
    background-color: #ffffff !important;
}

/* ── Text ───────────────────────────────────────────────────────────────── */
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-title {
    margin: 0 0 8px !important;
    padding: 0 !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    letter-spacing: -0.01em;
    color: var(--sp-ink) !important;
}
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-html-container,
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-content {
    margin: 0 !important;
    padding: 0 4px !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    line-height: 1.6 !important;
    color: var(--sp-muted) !important;
}
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-html-container p { margin: 0 0 8px; color: inherit; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-actions,
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-buttonswrapper {
    width: 100%;
    margin: 24px 0 0 !important;
    padding: 0 !important;
    gap: 12px;
    flex-wrap: nowrap;
}
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-styled {
    flex: 1 1 0;
    min-width: 0;
    height: 46px;
    margin: 0 !important;
    padding: 0 18px !important;
    border-radius: 12px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    box-shadow: none !important;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease !important;
}
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-styled:focus,
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-styled:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(var(--sp-brand-rgb), .25) !important;
}
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-styled:active { transform: scale(.98); }

/* primary */
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-confirm.swal2-styled {
    border: none !important;
    color: var(--sp-on-brand) !important;
    background: linear-gradient(180deg, var(--sp-btn-1) 0%, var(--sp-btn-2) 50%, var(--sp-btn-3) 100%) !important;
    box-shadow: 0 8px 18px rgba(var(--sp-brand-rgb), .25) !important;
}
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-confirm.swal2-styled:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, var(--sp-btn-2) 0%, var(--sp-btn-3) 100%) !important;
    box-shadow: 0 12px 22px rgba(var(--sp-brand-rgb), .32) !important;
}

/* secondary (cancel / deny) */
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-cancel.swal2-styled,
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-deny.swal2-styled {
    color: var(--sp-outline-ink) !important;
    background: #ffffff !important;
    border: 1.5px solid var(--sp-outline) !important;
}
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-cancel.swal2-styled:hover,
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-deny.swal2-styled:hover {
    color: var(--sp-brand) !important;
    background: var(--sp-brand-soft) !important;
    border-color: var(--sp-outline) !important;
}

/* close (x) */
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-close {
    top: 10px; right: 10px;
    width: 34px; height: 34px;
    border-radius: 50%;
    font-size: 26px;
    color: var(--sp-muted);
}
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-close:hover { color: var(--sp-ink); background: var(--sp-brand-soft); }

/* inputs inside popups */
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-input,
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-textarea,
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-select {
    border: 1.5px solid var(--sp-line) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    color: var(--sp-ink);
}
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-input:focus,
.swal2-container :is(.swal2-popup, .swal2-modal) .swal2-textarea:focus {
    border-color: var(--sp-brand) !important;
    box-shadow: 0 0 0 3px rgba(var(--sp-brand-rgb), .15) !important;
}
.swal2-container h2#swal2-title {
    border-bottom: 0;
}

/* ── Wide variant: customClass: { popup: 'sp-wide' } ───────────────────── */
.swal2-container :is(.swal2-popup, .swal2-modal).sp-wide { width: 560px !important; }

/* ── Content blocks for popup html ──────────────────────────────────────────
   <p class="sp-lead">…</p>
   <div class="sp-step"><span class="sp-step-num">1</span>
     <div class="sp-step-body"><div class="sp-step-title">…</div>
       <p class="sp-step-text">…</p>
       <div class="sp-files"><a class="sp-file" href="…">
         <i class="fa fa-file-text-o"></i><span>Name</span><i class="fa fa-download sp-file-go"></i>
       </a></div>
   </div></div>                                                             */
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-body { text-align: left; }
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-lead {
    margin: 0 0 18px !important;
    text-align: center;
    font-size: 15px;
    color: var(--sp-muted);
}
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-step {
    display: flex;
    gap: 14px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--sp-line);
    border-radius: 14px;
    background: #fbfcfd;
}
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-step:last-child { margin-bottom: 0; }
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-step-num {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--sp-on-brand);
    background: var(--sp-brand);
}
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-step-body { flex: 1; min-width: 0; }
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-step-title {
    margin: 4px 0 4px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--sp-ink);
}
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-step-text {
    margin: 0 !important;
    font-size: 14px;
    line-height: 1.55;
    color: var(--sp-muted);
}
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-step-text a,
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-link {
    color: var(--sp-brand);
    font-weight: 600;
    text-decoration: none;
    word-break: break-word;
}
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-step-text a:hover,
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-link:hover { text-decoration: underline; }
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-files {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-file {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 11px 12px;
    border: 1.5px solid var(--sp-line);
    border-radius: 12px;
    background: #ffffff;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--sp-outline-ink);
    text-decoration: none;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-file:hover {
    border-color: var(--sp-outline);
    background: var(--sp-brand-soft);
    color: var(--sp-brand);
    text-decoration: none;
    transform: translateY(-1px);
}
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-file > .fa:first-child {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: var(--sp-brand);
    background: var(--sp-brand-soft);
}
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-file span { flex: 1; min-width: 0; }
.swal2-container :is(.swal2-popup, .swal2-modal) .sp-file .sp-file-go { flex: 0 0 auto; font-size: 13px; opacity: .7; }

/* ── Phones: stack buttons, primary on top ──────────────────────────────── */
@media (max-width: 420px) {
    .swal2-container :is(.swal2-popup, .swal2-modal),
    .swal2-container .swal2-modal { padding: 26px 20px 20px !important; }
    .swal2-container :is(.swal2-popup, .swal2-modal) .swal2-title { font-size: 20px !important; }
    .swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-warning,
    .swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-info,
    .swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon.swal2-question {
        width: 72px !important; height: 72px !important; line-height: 72px !important; font-size: 48px !important;
    }
    .swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon .swal2-icon-text,
    .swal2-container :is(.swal2-popup, .swal2-modal) .swal2-icon .swal2-icon-content { font-size: 46px !important; }
    .swal2-container :is(.swal2-popup, .swal2-modal) .swal2-actions { flex-direction: column-reverse; }
    .swal2-container :is(.swal2-popup, .swal2-modal) .swal2-styled { flex: none; width: 100%; }
    .swal2-container :is(.swal2-popup, .swal2-modal) .sp-files { grid-template-columns: 1fr; }
    .swal2-container :is(.swal2-popup, .swal2-modal) .sp-step { padding: 14px 12px; gap: 12px; }
}
