/* ============================================================
   Brand Toast Skin — overrides toastr.js defaults with the same
   visual language as the rest of the redesign (Bricolage Grotesque,
   lime/dark, flat cards, Instrument Serif accents). Loaded AFTER
   toastr.min.css so specificity is just selector-equal — the cascade
   wins by load order.

   Variants exposed:
     .toast-success      → lime (default success path)
     .toast-error        → rose
     .toast-warning      → amber
     .toast-info         → sky
     .toast-primary      → dark card with lime accent (wrapper)
     .toast-secondary    → soft gray card with dark accent (wrapper)

   Call sites unchanged — use toastr.success/error/warning/info as
   before. For the two new wrapper variants pass toastClass:
     toastr.info(msg, title, { toastClass: 'toast toast-primary' });
   ============================================================ */

/* Container — top-right by default. The position class is set
   globally in app.js; we just style the container. */
#toast-container {
    z-index: 999999;
    pointer-events: none;
    font-family: 'Bricolage Grotesque', 'Bricolage Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
#toast-container > div {
    pointer-events: auto;
    opacity: 1;
    width: 360px;
    max-width: calc(100vw - 32px);
    padding: 16px 44px 16px 56px;
    margin: 0 0 12px;
    background: #ffffff;
    background-image: none !important;
    border: 1px solid rgba(10, 10, 10, 0.06);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.10), 0 2px 8px rgba(0, 0, 0, 0.06);
    color: #0a0a0a;
    position: relative;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
#toast-container > div:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.13), 0 3px 10px rgba(0, 0, 0, 0.08);
    opacity: 1;
}

/* Left accent bar — 4px wide, full height, colored per variant. */
#toast-container > div::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #0a0a0a;
}

/* Icon tile — 32x32 rounded square at left side, tinted per variant. */
#toast-container > div::after {
    content: '';
    position: absolute;
    left: 14px;
    top: 16px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: #f3f4f6 center/16px 16px no-repeat;
}

/* Title + message typography — flat, tight, brand voice. */
.toast-title {
    font-size: 14px;
    font-weight: 700;
    color: #0a0a0a;
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin: 0 0 2px;
    font-family: inherit;
}
.toast-message {
    font-size: 13px;
    font-weight: 400;
    color: #4a4a4a;
    line-height: 1.5;
    word-wrap: break-word;
    font-family: inherit;
}
.toast-message a, .toast-message label { color: #0a0a0a; }
.toast-message a:hover { color: #0a0a0a; text-decoration: underline; }

/* Close button — minimal, gray → dark on hover. */
.toast-close-button {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    color: #9ca3af;
    text-shadow: none;
    opacity: 1;
    font-weight: 300;
    font-size: 18px;
    line-height: 22px;
    text-align: center;
    background: transparent;
    border: 0;
    transition: background 0.15s, color 0.15s;
    float: none;
}
.toast-close-button:hover, .toast-close-button:focus {
    color: #0a0a0a;
    background: rgba(10, 10, 10, 0.06);
    opacity: 1;
    outline: none;
}

/* Progress bar — thin slim accent at top of card. */
.toast-progress {
    height: 2px;
    background: #0a0a0a;
    opacity: 0.6;
    border-radius: 0;
    bottom: auto;
    top: 0;
    left: 0;
}

/* ============================================================
   Variant: SUCCESS (lime)
   ============================================================ */
#toast-container > .toast-success {
    background: #ffffff;
    color: #0a0a0a;
}
#toast-container > .toast-success::before { background: #CCEA4A; }
#toast-container > .toast-success::after {
    background-color: rgba(204, 234, 74, 0.18);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23556B17' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}
.toast-success .toast-progress { background: #CCEA4A; opacity: 0.9; }

/* ============================================================
   Variant: ERROR (rose)
   ============================================================ */
#toast-container > .toast-error {
    background: #ffffff;
    color: #0a0a0a;
}
#toast-container > .toast-error::before { background: #FF6B6B; }
#toast-container > .toast-error::after {
    background-color: rgba(255, 107, 107, 0.14);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23B91C1C' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='15' y1='9' x2='9' y2='15'/%3E%3Cline x1='9' y1='9' x2='15' y2='15'/%3E%3C/svg%3E");
}
.toast-error .toast-progress { background: #FF6B6B; opacity: 0.9; }

/* ============================================================
   Variant: WARNING (amber)
   ============================================================ */
#toast-container > .toast-warning {
    background: #ffffff;
    color: #0a0a0a;
}
#toast-container > .toast-warning::before { background: #FFB13B; }
#toast-container > .toast-warning::after {
    background-color: rgba(255, 177, 59, 0.16);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A35A00' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
}
.toast-warning .toast-progress { background: #FFB13B; opacity: 0.9; }

/* ============================================================
   Variant: INFO (sky)
   ============================================================ */
#toast-container > .toast-info {
    background: #ffffff;
    color: #0a0a0a;
}
#toast-container > .toast-info::before { background: #5B9BFF; }
#toast-container > .toast-info::after {
    background-color: rgba(91, 155, 255, 0.14);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231D4ED8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='16' x2='12' y2='12'/%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'/%3E%3C/svg%3E");
}
.toast-info .toast-progress { background: #5B9BFF; opacity: 0.9; }

/* ============================================================
   Variant: PRIMARY (dark card with lime accent)
   Use via: toastr.info(msg, title, { toastClass: 'toast toast-primary' });
   ============================================================ */
#toast-container > .toast-primary {
    background: #0a0a0a !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.10);
}
#toast-container > .toast-primary::before { background: #CCEA4A; }
#toast-container > .toast-primary::after {
    background-color: rgba(204, 234, 74, 0.16);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23CCEA4A' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 2L3 14h9l-1 8 10-12h-9l1-8z'/%3E%3C/svg%3E");
}
.toast-primary .toast-title { color: #ffffff; }
.toast-primary .toast-message { color: rgba(255, 255, 255, 0.72); }
.toast-primary .toast-message a, .toast-primary .toast-message label { color: #CCEA4A; }
.toast-primary .toast-close-button { color: rgba(255, 255, 255, 0.5); }
.toast-primary .toast-close-button:hover { color: #ffffff; background: rgba(255, 255, 255, 0.10); }
.toast-primary .toast-progress { background: #CCEA4A; opacity: 0.9; }

/* ============================================================
   Variant: SECONDARY (soft gray card with dark accent)
   Use via: toastr.info(msg, title, { toastClass: 'toast toast-secondary' });
   ============================================================ */
#toast-container > .toast-secondary {
    background: #f7f8fa;
    color: #0a0a0a;
    border-color: rgba(10, 10, 10, 0.08);
}
#toast-container > .toast-secondary::before { background: #0a0a0a; }
#toast-container > .toast-secondary::after {
    background-color: rgba(10, 10, 10, 0.08);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230a0a0a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
}
.toast-secondary .toast-progress { background: #0a0a0a; opacity: 0.8; }

/* ============================================================
   Animations — slide in from right with a tiny scale, slide out
   to the right. Toastr toggles classes "toast-top-*" / "toast-bottom-*"
   on the container; we target the inner toast for the motion.
   ============================================================ */
@keyframes toast-brand-in {
    from {
        opacity: 0;
        transform: translateX(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}
@keyframes toast-brand-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(20px); }
}
#toast-container > div {
    animation: toast-brand-in 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Mobile — full-width minus margins. */
@media (max-width: 480px) {
    #toast-container.toast-top-right,
    #toast-container.toast-top-left,
    #toast-container.toast-top-center,
    #toast-container.toast-top-full-width,
    #toast-container.toast-bottom-right,
    #toast-container.toast-bottom-left,
    #toast-container.toast-bottom-center,
    #toast-container.toast-bottom-full-width {
        left: 12px;
        right: 12px;
        top: 12px;
    }
    #toast-container > div {
        width: 100%;
        max-width: none;
    }
}

/* Reduced motion — flatten the slide animation. */
@media (prefers-reduced-motion: reduce) {
    #toast-container > div {
        animation: none;
        transition: none;
    }
}

/* ============================================================
   jQuery validationEngine tooltip — re-skin to match brand.
   Default style is a red box with thick borders and a hard
   black drop-shadow. We replace it with a small dark card +
   slim red accent, matching the toast vocabulary.

   Selectors mirror validationEngine.jquery.min.css exactly so
   the cascade overrides (no !important needed except where the
   plugin uses inline styles).
   ============================================================ */
.formError .formErrorContent {
    background: #0a0a0a !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.10) !important;
    -moz-box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.10) !important;
    -webkit-box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.10) !important;
    padding: 10px 14px 10px 36px !important;
    font-family: 'Bricolage Grotesque', 'Bricolage Fallback', -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    letter-spacing: -0.005em !important;
    line-height: 1.45 !important;
    min-width: 160px !important;
    max-width: 260px !important;
    position: relative;
    overflow: hidden;
}
/* Left red accent bar. Inset by 1px on the rounded edges so the corners
   stay clean — eliminates the "stick poking out" look. */
.formError .formErrorContent::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #FF6B6B;
}
/* Inline error icon (small circle-x). Aligned to the first line so the
   icon sits next to the title even when the message wraps to 3 lines. */
.formError .formErrorContent::after {
    content: '';
    position: absolute;
    left: 12px;
    top: 11px;
    width: 14px;
    height: 14px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FF6B6B' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='15' y1='9' x2='9' y2='15'/%3E%3Cline x1='9' y1='9' x2='15' y2='15'/%3E%3C/svg%3E") center/contain no-repeat;
}
/* Hide the "* " prefix that validationEngine prepends — replaced by our icon */
.formError .formErrorContent { text-indent: 0; }

/* Pointer arrow — repaint to match the dark card */
.formError .formErrorArrow div {
    background: #0a0a0a !important;
    border-left-color: rgba(255, 255, 255, 0.10) !important;
    border-right-color: rgba(255, 255, 255, 0.10) !important;
    box-shadow: none !important;
    -moz-box-shadow: none !important;
    -webkit-box-shadow: none !important;
}
.formError .formErrorArrow .line2,
.formError .formErrorArrow .line1 {
    background: rgba(255, 255, 255, 0.10) !important;
}

/* Green / black popup variants — apply the same skin with accent swap */
.greenPopup .formErrorContent::before { background: #CCEA4A; }
.greenPopup .formErrorContent::after {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23CCEA4A' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/contain no-repeat !important;
}

/* Slide-in animation matches the toast — keeps the visual language consistent */
.formError {
    animation: toast-brand-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@media (prefers-reduced-motion: reduce) {
    .formError { animation: none; }
}
