/**
 * 3Syxty Studio — Toast Notification Component
 *
 * Non-blocking, stackable notifications with success, info, warning,
 * and error variants. Elegant slide-in animations and auto-dismiss.
 */

/* -----------------------------------------------------------------------
   Toast Container
   ----------------------------------------------------------------------- */

.toast-container {
    position: fixed;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
    max-width: 420px;
    width: 100%;
}

.toast-container-tr {
    top: var(--space-4);
    right: var(--space-4);
}

.toast-container-tl {
    top: var(--space-4);
    left: var(--space-4);
}

.toast-container-br {
    bottom: var(--space-4);
    right: var(--space-4);
}

.toast-container-bl {
    bottom: var(--space-4);
    left: var(--space-4);
}

.toast-container-tc {
    top: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
}

.toast-container-bc {
    bottom: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
}

/* -----------------------------------------------------------------------
   Toast Item
   ----------------------------------------------------------------------- */

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background-color: var(--surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-heavy);
    pointer-events: auto;
    animation: toast-slide-in var(--motion-normal) forwards;
    max-width: 100%;
    overflow: hidden;
}

.toast[data-dismissing="true"] {
    animation: toast-slide-out var(--motion-fast) forwards;
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

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

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font: var(--type-body);
    font-weight: 600;
    color: var(--text-primary);
}

.toast-message {
    font: var(--type-body-sm);
    color: var(--text-secondary);
    margin-top: 2px;
}

.toast-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.toast-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: color var(--motion-instant), background-color var(--motion-instant);
}

.toast-close:hover {
    color: var(--text-primary);
    background-color: var(--accent-primary-subtle);
}

.toast-close svg {
    width: 14px;
    height: 14px;
}

/* Progress bar for auto-dismiss */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    animation: toast-progress-shrink linear forwards;
}

/* -----------------------------------------------------------------------
   Toast Variants
   ----------------------------------------------------------------------- */

.toast-success {
    border-left: 3px solid var(--success);
}
.toast-success .toast-icon { color: var(--success); }
.toast-success .toast-progress { background-color: var(--success); }

.toast-error {
    border-left: 3px solid var(--error);
}
.toast-error .toast-icon { color: var(--error); }
.toast-error .toast-progress { background-color: var(--error); }

.toast-warning {
    border-left: 3px solid var(--warning);
}
.toast-warning .toast-icon { color: var(--warning); }
.toast-warning .toast-progress { background-color: var(--warning); }

.toast-info {
    border-left: 3px solid var(--info);
}
.toast-info .toast-icon { color: var(--info); }
.toast-info .toast-progress { background-color: var(--info); }

/* -----------------------------------------------------------------------
   Animations
   ----------------------------------------------------------------------- */

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-slide-out {
    from {
        opacity: 1;
        transform: translateX(0);
        max-height: 200px;
        margin-bottom: var(--space-2);
    }
    to {
        opacity: 0;
        transform: translateX(24px);
        max-height: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-width: 0;
    }
}

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