/* ==========================================================================
   Toast Notifications - Premium Redesign
   ========================================================================== */

:root {
    /* Success Theme (Green) */
    --toast-success-bg: #12a15a;
    --toast-success-splat: #0e7d45;
    --toast-success-bubble: #0c6839;

    /* Error Theme (Red) */
    --toast-error-bg: #d9384e;
    --toast-error-splat: #a72436;
    --toast-error-bubble: #8a1928;

    /* Warning Theme (Orange) */
    --toast-warning-bg: #f37a20;
    --toast-warning-splat: #be5a11;
    --toast-warning-bubble: #a14707;

    /* Info / Help Theme (Blue) */
    --toast-info-bg: #006edf;
    --toast-info-splat: #005bb7;
    --toast-info-bubble: #0051a8;
}

/* Toast Container positioning and spacing */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 20px; /* Generous gap for overlapping speech bubbles */
    pointer-events: none;
    padding-top: 14px; /* Space for the top-most toast's bubble to overflow safely */
}

/* Main Toast Card Base */
.toast {
    position: relative;
    background: var(--bg-color);
    color: #ffffff;
    border-radius: 24px;
    padding: 22px 24px 18px 75px; /* Large left padding for bubble & splats */
    min-width: 320px;
    max-width: 420px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.16);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    pointer-events: auto;
    animation: slideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    overflow: visible; /* Allows the icon bubble to pop out */
    border: none;
    transition: all 0.3s ease;
}

/* Theme assignments */
.toast.toast-success {
    --bg-color: var(--toast-success-bg);
    --splat-color: var(--toast-success-splat);
    --bubble-color: var(--toast-success-bubble);
}

.toast.toast-error {
    --bg-color: var(--toast-error-bg);
    --splat-color: var(--toast-error-splat);
    --bubble-color: var(--toast-error-bubble);
}

.toast.toast-warning {
    --bg-color: var(--toast-warning-bg);
    --splat-color: var(--toast-warning-splat);
    --bubble-color: var(--toast-warning-bubble);
}

.toast.toast-info,
.toast.toast-help {
    --bg-color: var(--toast-info-bg);
    --splat-color: var(--toast-info-splat);
    --bubble-color: var(--toast-info-bubble);
}

/* Background Splats and Drops */
.toast-splats {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 120px;
    overflow: hidden;
    pointer-events: none;
    border-top-left-radius: inherit;
    border-bottom-left-radius: inherit;
    color: var(--splat-color);
    z-index: 1;
}

.toast-splats svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Speech Bubble Icon styling */
.toast-icon-bubble {
    position: absolute;
    top: -12px;
    left: 22px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--bubble-color);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 800;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    z-index: 3;
}

/* Triangle/tail for the speech bubble */
.toast-icon-bubble::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 4px;
    width: 10px;
    height: 10px;
    background-color: inherit;
    clip-path: polygon(0 0, 100% 0, 0 100%);
    transform: rotate(-15deg);
}

/* Content Layout */
.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 2; /* Sits above splats */
}

.toast-title {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 800;
    font-size: 16px;
    color: #ffffff;
    line-height: 1.2;
}

.toast-message {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 600;
    font-size: 13.5px;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.4;
}

.toast-message a {
    color: #ffffff;
    text-decoration: underline;
    font-weight: 700;
}

/* Close Button (X) */
.toast-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    transition: all 0.2s ease;
    align-self: flex-start;
    margin-top: -6px;
    z-index: 2;
}

.toast-close:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.15);
}

/* Animations */
@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateX(120%) scale(0.9);
    }
    70% {
        transform: translateX(-8px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes slideOut {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(120%) scale(0.9);
    }
}

/* Responsive adjustment */
@media (max-width: 480px) {
    .toast-container {
        right: 12px;
        left: 12px;
        top: 16px;
        padding-top: 14px;
    }
    .toast {
        min-width: 0;
        width: 100%;
        max-width: none;
    }
}
