/* ==========================================================================
   Component: Toast Notification (BEM Naming Convention)
   ========================================================================== */

/* Toast Container (Positioning) */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; /* Let clicks pass through container */
}

/* Toast Block */
.toast {
    position: relative;
    width: 320px;
    background: var(--card-bg, #ffffff);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.2));
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    pointer-events: auto; /* Re-enable clicks for the toast itself */
    animation: toast-slide-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast--closing {
    opacity: 0;
    transform: translateX(120%);
}

/* Toast Content Wrapper */
.toast__content {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    gap: 12px;
}

/* Toast Icon Element */
.toast__icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Toast Text Element */
.toast__text {
    flex-grow: 1;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color, #333);
    line-height: 1.4;
    word-break: break-word;
}

/* Progress Bar Container */
.toast__progress-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .toast__progress-wrapper {
    background: rgba(255, 255, 255, 0.1);
}

/* Progress Bar Element */
.toast__progress {
    height: 100%;
    width: 100%;
    transform-origin: left;
    /* Animation is set dynamically via inline style in JS */
}

/* --- Modifiers for Types --- */

/* Success */
.toast--success .toast__icon {
    color: var(--success, #22c55e);
}
.toast--success .toast__progress {
    background-color: var(--success, #22c55e);
}

/* Error/Danger */
.toast--danger .toast__icon,
.toast--error .toast__icon {
    color: var(--danger, #ef4444);
}
.toast--danger .toast__progress,
.toast--error .toast__progress {
    background-color: var(--danger, #ef4444);
}

/* Warning */
.toast--warning .toast__icon {
    color: var(--warning, #f59e0b);
}
.toast--warning .toast__progress {
    background-color: var(--warning, #f59e0b);
}

/* Info */
.toast--info .toast__icon {
    color: var(--primary, #3b82f6);
}
.toast--info .toast__progress {
    background-color: var(--primary, #3b82f6);
}

/* Animations */
@keyframes toast-slide-in {
    0% {
        opacity: 0;
        transform: translateX(100%);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-progress {
    0% {
        transform: scaleX(1);
    }
    100% {
        transform: scaleX(0);
    }
}
