:root {
    /* Success Style */
    --toast-success-bg: #CEEED3;
    --toast-success-border: #badbcc;
    --toast-success-text: #515151;
    --toast-success-accent: #2B7836;

    /* Error Style */
    --toast-error-bg: #f8d7da;
    --toast-error-border: #f5c6cb;
    --toast-error-text: #842029;
    --toast-error-accent: #dc3545;

    /* Warning Style */
    --toast-warning-bg: #fff3cd;
    --toast-warning-border: #ffeeba;
    --toast-warning-text: #664d03;
    --toast-warning-accent: #ffc107;

    /* Info Style */
    --toast-info-bg: #cce5ff;
    --toast-info-border: #b8daff;
    --toast-info-text: #084298;
    --toast-info-accent: #0d6efd;
}

/* Container for flat top banners */
#toast-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000000; /* Extremely high z-index to sit on top of everything */
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    pointer-events: none;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

/* Individual Toast Banner */
.custom-toast {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    width: 100%;
    overflow: hidden;
    pointer-events: auto;
    box-sizing: border-box;
    
    /* Slide in/out Animations */
    animation: toast-slide-down 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: all 0.3s ease;
}

.custom-toast.dismissing {
    animation: toast-slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Toast Success Variant */
.custom-toast.toast-success {
    background-color: var(--toast-success-bg);
}
.custom-toast.toast-success .toast-icon-box {
    background-color: var(--toast-success-accent);
}
.custom-toast.toast-success .toast-message,
.custom-toast.toast-success .toast-title-inline {
    color: var(--toast-success-text);
}
.custom-toast.toast-success .toast-icon {
    color: #ffffff;
}

/* Toast Error Variant */
.custom-toast.toast-error {
    background-color: var(--toast-error-bg);
}
.custom-toast.toast-error .toast-icon-box {
    background-color: var(--toast-error-accent);
}
.custom-toast.toast-error .toast-message,
.custom-toast.toast-error .toast-title-inline {
    color: var(--toast-error-text);
}
.custom-toast.toast-error .toast-icon {
    color: #ffffff;
}

/* Toast Warning Variant */
.custom-toast.toast-warning {
    background-color: var(--toast-warning-bg);
}
.custom-toast.toast-warning .toast-icon-box {
    background-color: var(--toast-warning-accent);
}
.custom-toast.toast-warning .toast-message,
.custom-toast.toast-warning .toast-title-inline {
    color: var(--toast-warning-text);
}
.custom-toast.toast-warning .toast-icon {
    color: #ffffff;
}

/* Toast Info Variant */
.custom-toast.toast-info {
    background-color: var(--toast-info-bg);
}
.custom-toast.toast-info .toast-icon-box {
    background-color: var(--toast-info-accent);
}
.custom-toast.toast-info .toast-message,
.custom-toast.toast-info .toast-title-inline {
    color: var(--toast-info-text);
}
.custom-toast.toast-info .toast-icon {
    color: #ffffff;
}

/* Left part (Icon + Message Wrapper) */
.toast-left-section {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 0;
}

/* Circular/Rounded Icon Box */
.toast-icon-box {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-icon {
    width: 20px;
    height: 20px;
    display: block;
}

/* Content Area */
.toast-content-wrapper {
    min-width: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.toast-message {
    font-size: 0.9375rem;
    font-weight: 500;
    margin: 0;
    line-height: 1.25rem;
    word-break: break-word;
}

.toast-title-inline {
    font-weight: 700;
    margin-right: 0.25rem;
}

/* Close Button on the Right */
.toast-close-btn {
    background: transparent;
    border: none;
    padding: 0.5rem;
    margin-left: auto;
    cursor: pointer;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    outline: none;
}

.toast-close-btn:hover,
.toast-close-btn:focus-visible {
    opacity: 1;
}

.toast-close-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.2px;
}

/* Tiny bottom progress bar */
.toast-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: rgba(0, 0, 0, 0.04);
    width: 100%;
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left;
    transition: transform 10ms linear;
}

.toast-success .toast-progress-bar {
    background-color: var(--toast-success-accent);
}
.toast-error .toast-progress-bar {
    background-color: var(--toast-error-accent);
}
.toast-warning .toast-progress-bar {
    background-color: var(--toast-warning-accent);
}
.toast-info .toast-progress-bar {
    background-color: var(--toast-info-accent);
}

/* Keyframes */
@keyframes toast-slide-down {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes toast-slide-up {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-100%);
    }
}

/* Accessibility Safe Margin for Mobile Viewports */
@media (max-width: 576px) {
    .custom-toast {
        padding: 0.75rem 1rem;
    }
    .toast-message {
        font-size: 0.875rem;
    }
    .toast-icon-box {
        width: 32px;
        height: 32px;
        border-radius: 6px;
    }
    .toast-icon {
        width: 20px;
        height: 20px;
    }
}