/* =====================================================================
   ZdDialogs.css — one look for every message box and confirmation in
   ZpayEss: rounded corners, roomy padding, a clear header, a footer bar
   with the buttons on the right, and a dark look on phones in night mode.

   Covers:
     .bobsmodal-*        OpenMultiPopup (MultiPopup.js): ShowError,
                         AlertMessage, ShowMessage and data popups
     .jconfirm           $.confirm / $.alert (jquery-confirm.js)
     #Errorpopup         master page fallback message box
     .modal-content      Bootstrap modals (corners and shadow only)

   Colours and header fonts still come from the theme (template.css
   --zp-popup-* tokens, set in Theme Settings). Loaded after template.css
   and jquery-confirm.css (DefaultMaster.master.vb LoadCssFiles, Default.aspx).
   ===================================================================== */
:root {
    --zdg-radius: 16px;
    --zdg-shadow: 0 24px 60px rgba(16, 24, 40, .32), 0 4px 12px rgba(16, 24, 40, .12);
    --zdg-line: #e3e8f0;
    --zdg-foot: #f7f9fc;
    --zdg-font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --zdg-ok: #12b76a;
    --zdg-bad: #f04438;
}

/* ---------- OpenMultiPopup (ShowError, AlertMessage, ShowMessage, data popups) ---------- */
.bobsmodal { backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.bobsmodal-content {
    min-width: min(380px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    border: 0 !important;
    border-radius: var(--zdg-radius) !important;
    box-shadow: var(--zdg-shadow) !important;
    font-family: var(--zdg-font);
}
/* rounded ends without clipping (some popups open dropdowns that must spill out) */
.bobsmodal-content > :first-child { border-radius: var(--zdg-radius) var(--zdg-radius) 0 0; }
.bobsmodal-content > :last-child { border-radius: 0 0 var(--zdg-radius) var(--zdg-radius); }
.bobsmodal-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    padding: 12px 14px 12px 20px !important;
}
.bobsmodal-header strong { display: inline-flex; align-items: center; gap: 10px; line-height: 1.3; font-weight: 700; }
/* success / failure mark in front of the title (theme emoji tokens), on a soft round badge */
.bobsmodal-header strong.emojiSuccess::before,
.bobsmodal-header strong.emojiFailure::before {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    line-height: 1;
    font-size: 17px !important;
}
.bobsmodal-header .rightPanel { align-items: center; }
.bobsmodal-header .close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .16);
    font-family: Arial, sans-serif !important;
    font-style: normal !important;
    font-size: 22px !important;
    line-height: 1;
    opacity: 1;
    text-shadow: none;
    cursor: pointer;
}
.bobsmodal-header .close:hover { background: rgba(255, 255, 255, .3); }
.bobsmodal-body { padding: 16px 20px !important; line-height: 1.55; font-size: max(14px, var(--zp-popup-body-font-size, 14px)); word-break: break-word; }
.bobsmodal-body > p { margin: 0; }
.bobsmodal-footer {
    padding: 12px 18px !important;
    border-top: 1px solid var(--zdg-line) !important;
    background: var(--zdg-foot);
}
/* buttons sit in a <strong> inside the footer */
.bobsmodal-footer > strong { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; font-weight: normal; }
.bobsmodal-footer > strong > p#error { float: none !important; margin: 0 auto 0 0; }
.bobsmodal-footer > strong > p#error:empty { display: none; }
.bobsmodal-footer button, .bobsmodal-footer input[type=button], .bobsmodal-footer input[type=submit], .bobsmodal-footer .btn {
    min-width: 88px;
    height: 38px;
    padding: 0 18px !important;
    border-radius: 10px !important;
    font-family: var(--zdg-font);
    font-weight: 700 !important;
    box-shadow: 0 4px 12px rgba(16, 24, 40, .15);
    cursor: pointer;
}
/* message boxes: failure gets a red top edge, success a green one (header colour stays the theme's) */
.bobsmodal-header:has(strong.emojiFailure) { box-shadow: inset 0 4px 0 var(--zdg-bad); padding-top: 15px !important; }
.bobsmodal-header:has(strong.emojiSuccess) { box-shadow: inset 0 4px 0 var(--zdg-ok); padding-top: 15px !important; }
.bobsmodal-header strong.emojiFailure::before { background: rgba(240, 68, 56, .9); color: #fff; }
.bobsmodal-header strong.emojiSuccess::before { background: rgba(255, 255, 255, .95); }
/* message boxes ask for a 150px body; keep them compact */
.bobsmodal-body[style*="min-height:150px"], .bobsmodal-body[style*="min-height: 150px"] { min-height: 64px !important; }
@keyframes zdg-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.bobsmodal-content { animation: zdg-in .22s cubic-bezier(.2, .8, .2, 1) !important; }

/* ---------- $.confirm / $.alert (jquery-confirm) ---------- */
.jconfirm .jconfirm-bg { backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.jconfirm .jconfirm-box {
    padding: 0 !important;
    border-radius: var(--zdg-radius) !important;
    overflow: hidden;
    box-shadow: var(--zdg-shadow) !important;
    font-family: var(--zdg-font);
}
.jconfirm .jconfirm-box div.title-c { border-radius: 0 !important; padding: 15px 52px 15px 20px !important; line-height: 1.3; }
.jconfirm .jconfirm-box div.title-c .icon-c { padding-bottom: 0 !important; }
.jconfirm .jconfirm-box div.closeIcon { top: 12px !important; right: 12px !important; width: 30px; height: 30px; border-radius: 9px; background: rgba(255, 255, 255, .16); color: var(--zp-popup-header-text-color, #fff) !important; display: flex !important; align-items: center; justify-content: center; line-height: 1 !important; opacity: 1; }
/* the plugin measures the text and sets a fixed height; let the box size itself instead */
.jconfirm .jconfirm-box div.content-pane { margin: 0 !important; height: auto !important; }
/* min-height: the site's general .content rule (250px) also hits this box */
.jconfirm .jconfirm-box div.content-pane .content { position: static !important; clip: auto !important; min-height: 0 !important; margin: 0 !important; padding: 16px 20px; font-size: 14.5px; line-height: 1.55; }
.jconfirm .jconfirm-box .buttons {
    float: none !important;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px !important;
    border-top: 1px solid var(--zdg-line);
    background: var(--zdg-foot) !important;
}
.jconfirm .jconfirm-box .buttons button + button { margin-left: 0 !important; }
.jconfirm .jconfirm-box .buttons .btn {
    min-width: 88px;
    height: 38px;
    padding: 0 18px;
    border-radius: 10px !important;
    font-family: var(--zdg-font);
    font-weight: 700;
    text-transform: none;
}
/* the confirming button stands out, the other one is quiet */
.jconfirm .jconfirm-box .buttons .btn:first-child { background: var(--zp-primary, #1e3a8a); border-color: var(--zp-primary, #1e3a8a); color: #fff; box-shadow: 0 4px 12px rgba(16, 24, 40, .18); }
.jconfirm .jconfirm-box .buttons .btn:not(:first-child) { background: #fff; border: 1px solid #d0d5dd; color: #1f2937; }
.jconfirm .jconfirm-box .buttons .btn:hover { filter: brightness(1.06); }

/* ---------- master page fallback box (#Errorpopup) and Bootstrap modals ---------- */
.modal-content { border: 0; border-radius: var(--zdg-radius); box-shadow: var(--zdg-shadow); }
.modal-content > :first-child { border-top-left-radius: var(--zdg-radius); border-top-right-radius: var(--zdg-radius); }
.modal-content > :last-child { border-bottom-left-radius: var(--zdg-radius); border-bottom-right-radius: var(--zdg-radius); }
.modal-content .myheader-Error { display: flex; align-items: center; justify-content: space-between; flex-direction: row-reverse; gap: 12px; padding: 14px 16px 14px 20px; border-radius: 0; }
.modal-content .myheader-Error .modal-title { margin: 0; font-size: 16px; font-weight: 700; }
.modal-content .myheader-Error .close { float: none; width: 32px; height: 32px; margin: 0; border-radius: 9px; background: rgba(255, 255, 255, .16); opacity: 1; text-shadow: none; }
.modal-content > .modal-footer { padding: 12px 18px; border-top: 1px solid var(--zdg-line); background: var(--zdg-foot); }
.modal-content > .modal-footer .btn { min-width: 80px; border-radius: 10px; font-weight: 700; }
.modal-content > .modal-body { padding: 16px 20px; }

/* ---------- phones ---------- */
@media (max-width: 767px) {
    .bobsmodal { padding-top: 60px !important; }
    .bobsmodal-content { width: calc(100vw - 24px) !important; }
    .bobsmodal-footer button, .bobsmodal-footer input[type=button], .bobsmodal-footer input[type=submit], .bobsmodal-footer .btn { height: 42px; flex: 1 1 auto; }
    .jconfirm .jconfirm-box-container { padding-left: 12px !important; padding-right: 12px !important; }
    .jconfirm .jconfirm-box .buttons .btn { flex: 1 1 0; height: 42px; }
}

/* ---------- phones in dark (night) mode ---------- */
@media (prefers-color-scheme: dark) and (max-width: 991px) {
    :root { --zdg-line: #263247; --zdg-foot: #0f1728; }
    .bobsmodal-content, .bobsmodal-body { background: #131b2e !important; color: #e5e7eb !important; }
    .jconfirm .jconfirm-box, .jconfirm .jconfirm-box div.content-pane { background: #131b2e !important; color: #e5e7eb !important; }
    .jconfirm .jconfirm-box .buttons .btn:not(:first-child) { background: #131b2e; border-color: #263247; color: #e5e7eb; }
    .modal-content, .modal-content > .modal-body { background: #131b2e; color: #e5e7eb; }
}
