/* ==========================================================================
   Opsicode - notifications
   1) Toasts:  App.alert({popup: true, type}) -> .popup-container > .popup.popup-{success|danger|warning|info}
   2) Inline:  App.alert() without popup (.my-alerts) and Core::showAlert() (.alert.hidden-print)
   Each type has its own tint, accent bar and icon. Loaded on every app page via
   layout.theme.css; dark mode at the end of this file.
   ========================================================================== */

/* ---------- toast stack ---------- */
.popup-container.popup-top-right { top: 76px; right: 20px; }
.popup-container.popup-top-left { top: 76px; left: 20px; }
.popup-container.popup-bottom-right { right: 20px; bottom: 20px; }
.popup-container.popup-bottom-left { left: 20px; bottom: 20px; }
.popup-container { width: auto !important; overflow: visible !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }

/* ---------- toast card ---------- */
.popup-container > .popup {
    --t-accent: #2f6fb0;
    --t-tint: #f2f7fd;
    --t-line: #cbdcf1;
    --t-ink: #1c3f66;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 380px !important;
    max-width: calc(100vw - 32px);
    margin: 0 0 10px !important;
    padding: 14px 42px 16px 14px !important;
    border: 1px solid var(--t-line);
    border-left: 4px solid var(--t-accent);
    border-radius: 12px !important;
    background: var(--t-tint) !important;
    background-image: none !important;
    box-shadow: 0 18px 40px -14px rgba(16, 24, 40, .35) !important;
    color: var(--t-ink) !important;
    opacity: 1 !important;
    filter: none !important;
    font-size: 13.5px;
    line-height: 1.5;
    overflow: hidden;
    cursor: default;
    /* slides in by itself; App.toastOut() adds .ops-out to slide it away */
    /* slow, even ease-out (0.9s in, 0.6s out) */
    animation: ops-toast-in .9s cubic-bezier(.25, .46, .45, .94) both;
    transition: transform .6s cubic-bezier(.45, 0, .55, 1), opacity .6s ease, box-shadow .2s ease;
}
.popup-container.ops-out > .popup { opacity: 0 !important; transform: translateX(36px) scale(.98); }
@keyframes ops-toast-in {
    0% { opacity: 0; transform: translateX(56px) scale(.98); }
    55% { opacity: 1; }
    100% { opacity: 1; transform: none; }
}
.popup-container > .popup:hover { box-shadow: 0 22px 48px -14px rgba(16, 24, 40, .45) !important; }

/* type colours */
.popup-container > .popup.popup-success { --t-accent: #1f8a4c; --t-tint: #f0faf4; --t-line: #c3e6d1; --t-ink: #134d2c; }
.popup-container > .popup:is(.popup-danger, .popup-error) { --t-accent: #d23c3c; --t-tint: #fdf3f3; --t-line: #f2c9c9; --t-ink: #7a1f1f; }
.popup-container > .popup.popup-warning { --t-accent: #d98a06; --t-tint: #fff8ec; --t-line: #f1d9a8; --t-ink: #6b4300; }
.popup-container > .popup.popup-info { --t-accent: #2f6fb0; --t-tint: #f2f7fd; --t-line: #cbdcf1; --t-ink: #1c3f66; }

/* icon bubble (Font Awesome 4 glyphs) */
.popup-container > .popup::before {
    content: "\f05a";
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--t-accent);
    color: #fff;
    font: normal normal normal 15px/1 FontAwesome;
    -webkit-font-smoothing: antialiased;
}
.popup-container > .popup.popup-success::before { content: "\f00c"; }
.popup-container > .popup:is(.popup-danger, .popup-error)::before { content: "\f00d"; }
.popup-container > .popup.popup-warning::before { content: "\f12a"; }

/* text */
.popup-container > .popup :is(.popup-title, .popup-message) { flex: 1 1 auto; min-width: 0; color: inherit !important; }
.popup-container > .popup .popup-title { margin: 0 0 2px; font-weight: 700; font-size: 14px; }
.popup-container > .popup .popup-message { align-self: center; font-weight: 500; word-wrap: break-word; }
.popup-container > .popup .popup-title + .popup-message { font-weight: 400; }
.popup-container > .popup:has(.popup-title) { flex-wrap: wrap; }
.popup-container > .popup:has(.popup-title) .popup-message { flex-basis: calc(100% - 42px); margin-left: 42px; margin-top: -6px; }
.popup-container > .popup .popup-message a { color: var(--t-accent) !important; font-weight: 600; text-decoration: underline; }

/* close */
.popup-container > .popup .popup-close-button {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    float: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent !important;
    background-image: none !important;   /* Metronic .close: remove-icon image */
    text-indent: 0 !important;           /* Metronic .close: text-indent -10000px pushed the x out of its box */
    line-height: 1 !important;
    color: var(--t-ink) !important;
    opacity: .55 !important;
    filter: none !important;
    text-shadow: none !important;
    font-size: 0 !important;
    cursor: pointer;
}
.popup-container > .popup .popup-close-button::before { content: "\00d7"; font-size: 20px; line-height: 1; font-weight: 400; }
.popup-container > .popup .popup-close-button:hover { opacity: 1 !important; background: rgba(0, 0, 0, .07) !important; }

/* time left before it closes itself (App.alert popups close after 5s) */
.popup-container > .popup::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: var(--t-accent);
    opacity: .45;
    transform-origin: left center;
    animation: ops-toast-timer 5s linear forwards;
}
.popup-container > .popup:hover::after { animation-play-state: paused; }
@keyframes ops-toast-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@media (max-width: 480px) {
    .popup-container.popup-top-right { top: 66px; right: 12px; left: 12px; }
    .popup-container > .popup { width: 100% !important; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
    .popup-container > .popup { animation: none; transition: none; transform: none; }
    .popup-container > .popup::after { animation: none; }
}

/* ---------- inline alerts (page messages) ---------- */
:is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert) {
    --a-accent: #2f6fb0;
    --a-tint: #f2f7fd;
    --a-line: #cbdcf1;
    --a-ink: #1c3f66;
    position: relative;
    display: block;
    margin: 0 0 14px;
    padding: 12px 42px 12px 48px !important;
    border: 1px solid var(--a-line) !important;
    border-left: 4px solid var(--a-accent) !important;
    border-radius: 10px !important;
    background: var(--a-tint) !important;
    background-image: none !important;
    box-shadow: none !important;
    color: var(--a-ink) !important;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.5;
    text-shadow: none !important;
}
:is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert).alert-success { --a-accent: #1f8a4c; --a-tint: #f0faf4; --a-line: #c3e6d1; --a-ink: #134d2c; }
:is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert):is(.alert-danger, .alert-error) { --a-accent: #d23c3c; --a-tint: #fdf3f3; --a-line: #f2c9c9; --a-ink: #7a1f1f; }
:is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert).alert-warning { --a-accent: #d98a06; --a-tint: #fff8ec; --a-line: #f1d9a8; --a-ink: #6b4300; }
:is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert).alert-info { --a-accent: #2f6fb0; --a-tint: #f2f7fd; --a-line: #cbdcf1; --a-ink: #1c3f66; }
/* the leading icon becomes a small coloured bubble; alerts without one get it from CSS */
:is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert) > i.fa:first-of-type,
:is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert):not(:has(> i.fa))::before {
    position: absolute;
    left: 14px;
    top: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin: 0 !important;
    border-radius: 50%;
    background: var(--a-accent);
    color: #fff !important;
    font: normal normal normal 12px/1 FontAwesome;
}
:is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert):not(:has(> i.fa))::before { content: "\f05a"; }
:is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert).alert-success:not(:has(> i.fa))::before { content: "\f00c"; }
:is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert):is(.alert-danger, .alert-error):not(:has(> i.fa))::before { content: "\f00d"; }
:is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert).alert-warning:not(:has(> i.fa))::before { content: "\f12a"; }
:is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert) > .close {
    position: absolute !important;
    top: 50% !important;
    right: 10px !important;
    float: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 !important;
    padding: 0;
    border-radius: 6px;
    background: transparent !important;
    background-image: none !important;
    text-indent: 0 !important;
    color: var(--a-ink) !important;
    opacity: .55;
    text-shadow: none;
    font-size: 0;
}
:is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert) > .close::before { content: "\00d7"; font-size: 20px; line-height: 1; font-weight: 400; }
:is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert) > .close:hover { opacity: 1; background: rgba(0, 0, 0, .06) !important; }

/* login / register validation alert: hidden until the form script shows it */
body.auth-do .alert.display-hide { display: none; }
body.auth-do .alert.display-hide[style*="block"] { display: block !important; }
:is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert) :is(strong, b) { font-weight: 700; }

/* ---------- dark mode ---------- */
:root[data-theme="dark"] .popup-container > .popup {
    --t-line: rgba(255, 255, 255, .08);
    background: #182235 !important;
    color: #e3e8f2 !important;
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7) !important;
}
:root[data-theme="dark"] .popup-container > .popup.popup-success { --t-accent: #34a865; background: linear-gradient(0deg, rgba(52, 168, 101, .12), rgba(52, 168, 101, .12)), #182235 !important; }
:root[data-theme="dark"] .popup-container > .popup:is(.popup-danger, .popup-error) { --t-accent: #e05656; background: linear-gradient(0deg, rgba(224, 86, 86, .12), rgba(224, 86, 86, .12)), #182235 !important; }
:root[data-theme="dark"] .popup-container > .popup.popup-warning { --t-accent: #e3a33a; background: linear-gradient(0deg, rgba(227, 163, 58, .12), rgba(227, 163, 58, .12)), #182235 !important; }
:root[data-theme="dark"] .popup-container > .popup.popup-info { --t-accent: #5b8fd6; background: linear-gradient(0deg, rgba(91, 143, 214, .12), rgba(91, 143, 214, .12)), #182235 !important; }
:root[data-theme="dark"] .popup-container > .popup .popup-close-button { color: #e3e8f2 !important; }
:root[data-theme="dark"] .popup-container > .popup .popup-close-button:hover { background: rgba(255, 255, 255, .1) !important; }
:root[data-theme="dark"] .popup-container > .popup .popup-message a { color: #fff !important; }

:root[data-theme="dark"] :is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert) {
    --a-line: rgba(255, 255, 255, .08);
    --a-ink: #e3e8f2;
    background: #182235 !important;
}
:root[data-theme="dark"] :is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert).alert-success { --a-accent: #34a865; --a-ink: #bfe9cf; background: linear-gradient(0deg, rgba(52, 168, 101, .12), rgba(52, 168, 101, .12)), #182235 !important; }
:root[data-theme="dark"] :is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert):is(.alert-danger, .alert-error) { --a-accent: #e05656; --a-ink: #f5c0c0; background: linear-gradient(0deg, rgba(224, 86, 86, .12), rgba(224, 86, 86, .12)), #182235 !important; }
:root[data-theme="dark"] :is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert).alert-warning { --a-accent: #e3a33a; --a-ink: #f3d9a8; background: linear-gradient(0deg, rgba(227, 163, 58, .12), rgba(227, 163, 58, .12)), #182235 !important; }
:root[data-theme="dark"] :is(.alert.my-alerts:not(.popup-container), .alert.hidden-print, body.auth-do .alert).alert-info { --a-accent: #5b8fd6; --a-ink: #c7dbf5; background: linear-gradient(0deg, rgba(91, 143, 214, .12), rgba(91, 143, 214, .12)), #182235 !important; }

/* auth pages (login / register / reset) have a white card in both themes: keep their alerts light */
:root[data-theme="dark"] body.auth-do:not(#_d) .alert { --a-line: #cbdcf1; --a-ink: #1c3f66; --a-tint: #f2f7fd; background: var(--a-tint) !important; }
:root[data-theme="dark"] body.auth-do:not(#_d) .alert.alert-success { --a-accent: #1f8a4c; --a-tint: #f0faf4; --a-line: #c3e6d1; --a-ink: #134d2c; background: #f0faf4 !important; }
:root[data-theme="dark"] body.auth-do:not(#_d) .alert:is(.alert-danger, .alert-error) { --a-accent: #d23c3c; --a-tint: #fdf3f3; --a-line: #f2c9c9; --a-ink: #7a1f1f; background: #fdf3f3 !important; }
:root[data-theme="dark"] body.auth-do:not(#_d) .alert.alert-warning { --a-accent: #d98a06; --a-tint: #fff8ec; --a-line: #f1d9a8; --a-ink: #6b4300; background: #fff8ec !important; }
:root[data-theme="dark"] body.auth-do:not(#_d) .alert.alert-info { --a-accent: #2f6fb0; --a-tint: #f2f7fd; --a-line: #cbdcf1; --a-ink: #1c3f66; background: #f2f7fd !important; }
