/* Site-wide toast — used by main site, auth pages, and client scripts. */

#toast {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    max-width: min(480px, calc(100vw - 2rem));
    width: max-content;
    min-width: min(320px, calc(100vw - 2rem));
    padding: 16px 18px 18px;
    gap: 12px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    z-index: 9999;
    align-items: flex-start;
    box-sizing: border-box;
}

.messages-banner {
    z-index: 10000;
    margin-bottom: 20px;
}

#toast #icon-wrapper {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    background: var(--secondary);
    border-radius: 8px;
    box-sizing: border-box;
    padding: 6px;
    margin-top: 2px;
}

#toast #icon {
    background: var(--primary);
    border-radius: 50%;
    height: 100%;
    width: 100%;
    position: relative;
}

#toast #icon::before,
#toast #icon::after {
    position: absolute;
    content: "";
    background: var(--secondary);
    border-radius: 5px;
    top: 50%;
    left: 50%;
}

#toast-data {
    display: none;
}

#toast-message {
    padding: 2px 8px 2px 0;
    flex: 1 1 auto;
    min-width: 0;
}

#toast-message h4,
#toast-message p {
    margin: 0;
    line-height: 1.35;
}

#toast-message h4 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #2a2a2a;
    margin-bottom: 0.35rem;
}

#toast-message p {
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.01em;
    color: #4a4a4a;
    line-height: 1.45;
}

#toast-close {
    position: relative;
    flex: 0 0 auto;
    padding: 14px;
    margin: -4px -6px 0 0;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0);
    transition: background 0.2s ease-in-out;
}

#toast-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

#toast-close::before,
#toast-close::after {
    position: absolute;
    content: "";
    height: 12px;
    width: 1px;
    border-radius: 5px;
    background: #606060;
    top: 50%;
    left: 50%;
    transition: background 0.2s ease-in-out;
}

#toast-close:hover::before,
#toast-close:hover::after {
    background: #404040;
}

#toast-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

#toast-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

@keyframes mira-toast-close {
    from {
        top: 72px;
        opacity: 1;
        transform: translateX(-50%) scale(1);
        visibility: visible;
    }
    to {
        top: 40px;
        opacity: 0;
        transform: translateX(-50%) scale(0.5);
        visibility: hidden;
    }
}

@keyframes mira-toast-open {
    from {
        top: 40px;
        opacity: 0;
        transform: translateX(-50%) scale(0.5);
        visibility: hidden;
    }
    to {
        top: 72px;
        opacity: 1;
        transform: translateX(-50%) scale(1);
        visibility: visible;
    }
}

#toast #timer {
    width: 0%;
    height: 4px;
    background: var(--primary);
    position: absolute;
    bottom: 0;
    left: 0;
    border-top-right-radius: 5px;
    box-shadow: 0 0 8px var(--primary);
}

#toast .timer-animation {
    animation: mira-toast-countdown 10s linear forwards;
}

@keyframes mira-toast-countdown {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Type accents (icon + timer) */
#toast.success {
    --primary: #2dd743;
    --secondary: #e3fee6;
}

#toast.success #icon {
    transform: rotate(-45deg);
}

#toast.success #icon::before {
    width: 10px;
    height: 3px;
    transform: translate(calc(-50% + 1px), calc(-50% + 1px));
}

#toast.success #icon::after {
    width: 3px;
    height: 6px;
    transform: translate(calc(-50% - 3px), calc(-50% - 1px));
}

#toast.warning {
    --primary: #f29208;
    --secondary: #ffeedf;
}

#toast.warning #icon::before {
    width: 3px;
    height: 3px;
    transform: translate(-50%, calc(-50% + 4px));
}

#toast.warning #icon::after {
    width: 3px;
    height: 7px;
    transform: translate(-50%, calc(-50% - 2px));
}

#toast.error {
    --primary: #e63435;
    --secondary: #ffeaec;
}

#toast.error #icon::before {
    width: 3px;
    height: 3px;
    transform: translate(-50%, calc(-50% + 4px));
}

#toast.error #icon::after {
    width: 3px;
    height: 7px;
    transform: translate(-50%, calc(-50% - 2px));
}

#toast.info {
    --primary: #42c0f2;
    --secondary: #cfeffc;
}

#toast.info #icon::before {
    width: 3px;
    height: 7px;
    transform: translate(-50%, calc(-50% + 2px));
}

#toast.info #icon::after {
    width: 3px;
    height: 3px;
    transform: translate(-50%, calc(-50% - 4px));
}
