/**
 * Peren toast notifications - replaces Hyva's full-width message banner.
 * Plain CSS, not Tailwind utilities - this child theme has no Tailwind
 * build (see the "no Tailwind build" gotcha documented throughout this
 * project), same approach already used for every other custom UI piece.
 *
 * Positioning is deliberately NOT relying on the ancestor ".page.messages"
 * container (vendor's compiled Tailwind CSS makes that container
 * "sticky top-0 z-20", full width - see messages.css). Every rule below
 * is scoped to .peren-toast-region/.peren-toast, which no longer carry
 * any of the old ".message"/".message-success" class names, so none of
 * Hyva's compiled banner CSS can match this markup at all.
 *
 * Real bug found 2026-09-10, confirmed via a real triggered error toast +
 * screenshot + a JS ancestor-chain walk: scoping only the toast's OWN
 * rules here is NOT enough to guarantee it paints on top of other fixed
 * UI (e.g. the cookie-consent banner, z-index 9998/9999) - that
 * ".page.messages" ancestor's "position:sticky; z-index:20" (noted
 * above, but under-estimated) makes it establish its own CSS stacking
 * context. A descendant's z-index, no matter how high, is compared
 * against siblings *within* that context, not against the rest of the
 * page - .peren-toast-region's own z-index:10000 was capped at an
 * effective "20" for anything outside its parent, so the (higher
 * z-index, but NOT nested inside a low-z-index stacking parent) cookie
 * banner kept painting over it regardless of how high the toast's own
 * z-index was raised. Only fix is to stop ".page.messages" from
 * creating a stacking context in the first place.
 */
.page.messages {
    position: static !important;
    z-index: auto !important;
}

.peren-toast-region {
    position: fixed;
    right: 24px;
    bottom: 24px;
    /* Peren fix 2026-09-10: this tied with peren-cookie-consent.css's own
       bottom bar (also 9999) - on a tie the later-in-DOM element (the
       cookie banner) wins, silently hiding every toast behind it for any
       visitor who hasn't yet dismissed the banner. Confirmed live via a
       real triggered error toast + screenshot. A toast is short-lived
       and often reports something the visitor needs to act on right now
       (a failed submission, a blocked request); the persistent cookie
       banner should never be able to bury it. */
    z-index: 10000;
    width: 400px;
    max-width: calc(100vw - 48px);
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    pointer-events: none;
}

.peren-toast {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #ffffff;
    border: 1px solid #E5E5E5;
    border-radius: 14px;
    box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 16px 40px 16px 16px;
    font-family: inherit;
}

.peren-toast__icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
}

.peren-toast__icon svg {
    width: 18px;
    height: 18px;
}

.peren-toast__icon--success {
    color: #00A896;
    background: rgba(0, 220, 200, 0.12);
}

.peren-toast__icon--error {
    color: #DC2626;
    background: rgba(220, 38, 38, 0.10);
}

.peren-toast__icon--warning {
    color: #B45309;
    background: rgba(217, 119, 6, 0.12);
}

.peren-toast__icon--notice {
    color: var(--color-primary, #14646E);
    background: rgba(20, 100, 110, 0.10);
}

.peren-toast__body {
    flex: 1;
    min-width: 0;
}

.peren-toast__text {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.4;
    font-weight: 500;
    color: #1E1E1E;
}

.peren-toast__text a {
    text-decoration: underline;
}

.peren-toast__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 10px;
}

.peren-toast__action {
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    color: #6B7280;
    text-decoration: none;
    font-family: inherit;
}

.peren-toast__action:hover {
    color: #1E1E1E;
    text-decoration: underline;
}

.peren-toast__action--primary {
    color: var(--color-primary, #14646E);
}

.peren-toast__action--primary:hover {
    color: var(--color-primary-darker, #00353C);
}

.peren-toast__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: #6B7280;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
}

.peren-toast__close:hover {
    color: #1E1E1E;
    background: #F3F4F6;
}

.peren-toast__close:focus-visible {
    outline: 2px solid var(--color-primary, #14646E);
    outline-offset: 2px;
}

.peren-toast-enter {
    transition: opacity 250ms ease, transform 250ms ease;
}

.peren-toast-enter-start {
    opacity: 0;
    transform: translateX(20px);
}

.peren-toast-enter-end {
    opacity: 1;
    transform: translateX(0);
}

.peren-toast-leave {
    transition: opacity 200ms ease, transform 200ms ease;
}

.peren-toast-leave-start {
    opacity: 1;
    transform: translateX(0);
}

.peren-toast-leave-end {
    opacity: 0;
    transform: translateX(20px);
}

@media (prefers-reduced-motion: reduce) {
    .peren-toast-enter,
    .peren-toast-leave {
        transition: none;
    }
}

@media (max-width: 640px) {
    .peren-toast-region {
        left: 16px;
        right: 16px;
        bottom: 16px;
        width: auto;
        max-width: none;
    }
}
