/* ==============================================
   Toast / Snackbar — Material Design 3
   ============================================== */

/* Container — holds all toasts */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}

/* Single toast */
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    max-width: 480px;
    padding: 14px 16px;
    background: var(--md-on-surface);
    color: var(--md-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--elevation-3);
    pointer-events: auto;
    transform: translateX(calc(100% + 24px));
    opacity: 0;
    animation: toast-slide-in var(--duration-medium) var(--easing-standard) forwards;
}

/* Slide-in animation */
@keyframes toast-slide-in {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Auto-dismiss animation */
.toast.toast--dismissing {
    animation: toast-slide-out var(--duration-medium) var(--easing-standard) forwards;
}

@keyframes toast-slide-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(calc(100% + 24px));
        opacity: 0;
    }
}

/* Icon */
.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    font-size: 1.125rem;
}

/* Message */
.toast-message {
    flex: 1 1 auto;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Action button */
.toast-action {
    flex-shrink: 0;
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--md-primary-container);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    transition: background var(--duration-short) var(--easing-standard);
}

.toast-action:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Close button */
.toast-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--md-surface-variant);
    font-size: 1rem;
    flex-shrink: 0;
    cursor: pointer;
    transition: background var(--duration-short) var(--easing-standard);
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ---- Type variants ---- */

/* Success */
.toast--success {
    background: #1b5e20;
    color: #e8f5e9;
}

.toast--success .toast-icon {
    color: #66bb6a;
}

.toast--success .toast-action {
    color: #a5d6a7;
}

/* Error */
.toast--error {
    background: #7f1d1d;
    color: #fde8e8;
}

.toast--error .toast-icon {
    color: #ef5350;
}

.toast--error .toast-action {
    color: #ef9a9a;
}

/* Info */
.toast--info {
    background: #0d47a1;
    color: #e3f2fd;
}

.toast--info .toast-icon {
    color: #42a5f5;
}

.toast--info .toast-action {
    color: #90caf9;
}

/* Progress bar for auto-dismiss */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    animation: toast-progress-shrink linear forwards;
}

@keyframes toast-progress-shrink {
    from {
        width: 100%;
    }
    to {
        width: 0;
    }
}

.toast--success .toast-progress {
    background: rgba(102, 187, 106, 0.4);
}

.toast--error .toast-progress {
    background: rgba(239, 83, 80, 0.4);
}

.toast--info .toast-progress {
    background: rgba(66, 165, 245, 0.4);
}
