/**
 * Universal Toast Notification System
 * Reusable toast notification components for application-wide alerts
 */

/* ===========================================
   TOAST CONTAINER
   =========================================== */

.toast-container {
    position: fixed;
    /* Clear the fixed 4rem header (+ any banner stack) instead of covering
       the hamburger / avatar for the life of the toast. */
    top: calc(4rem + var(--top-stack-height, 0px) + var(--space-md));
    right: var(--space-md);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* ===========================================
   TOAST BASE
   =========================================== */

.toast {
    position: relative;
    min-width: 300px;
    max-width: 420px;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: var(--component-radius);
    box-shadow: var(--component-shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===========================================
   TOAST VARIANTS
   =========================================== */

.toast.toast-success {
    border-left: 4px solid var(--color-success);
}

.toast.toast-error {
    border-left: 4px solid var(--color-danger);
}

.toast.toast-warning {
    border-left: 4px solid var(--color-warning);
}

.toast.toast-info {
    border-left: 4px solid var(--color-info);
}

/* ===========================================
   TOAST ICONS
   =========================================== */

.toast .toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast.toast-success .toast-icon {
    color: var(--color-success);
}

.toast.toast-error .toast-icon {
    color: var(--color-danger);
}

.toast.toast-warning .toast-icon {
    color: var(--color-warning);
}

.toast.toast-info .toast-icon {
    color: var(--color-info);
}

/* ===========================================
   TOAST CONTENT
   =========================================== */

.toast-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-width: 0;
}

.toast-message {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* ===========================================
   TOAST ACTION BUTTON
   =========================================== */

.toast-action {
    flex-shrink: 0;
    background: none;
    border: none;
    color: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    white-space: nowrap;
}

.toast-action:hover {
    opacity: 0.8;
}

/* ===========================================
   TOAST CLOSE BUTTON
   =========================================== */

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0 0 var(--space-sm);
    opacity: 0.6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    opacity: 1;
}

/* ===========================================
   RESPONSIVE TOASTS
   =========================================== */

@media (max-width: 640px) {
    .toast-container {
        top: calc(4rem + var(--top-stack-height, 0px) + var(--space-sm));
        right: var(--space-sm);
        left: var(--space-sm);
    }

    .toast {
        min-width: auto;
        max-width: none;
        width: 100%;
    }

    .toast-content {
        flex-wrap: wrap;
    }
}

/* ===========================================
   ACCESSIBILITY
   =========================================== */

@media (prefers-reduced-motion: reduce) {
    .toast {
        animation: none;
    }
}
