/* modules/toast.css
 * Phase 5: Toast notification component (migrated from components/shared/toast.css)
 * Only toast-specific styles retained. Keyframes moved to animations.css (toast-progress).
 */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: var(--spacing-sm);
    max-width: 400px;
    pointer-events: none;
}

.toast {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: translateY(100%);
    transition: all .3s ease;
    pointer-events: auto;
    overflow: hidden;
}

.toast--show {
    opacity: 1;
    transform: translateY(0);
}

.toast--hide {
    opacity: 0;
    transform: translateY(100%);
}

.toast__content {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    position: relative;
}

.toast__icon {
    font-size: var(--font-size-lg);
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.toast__message {
    flex: 1;
    font-size: var(--font-size-sm);
    line-height: 1.4;
    color: var(--color-text);
    word-wrap: break-word;
}

.toast__close {
    position: absolute;
    top: var(--spacing-xs);
    right: var(--spacing-xs);
    background: none;
    border: none;
    font-size: var(--font-size-lg);
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: var(--spacing-xs);
    border-radius: var(--radius-sm);
    transition: all .2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast__close:hover {
    background: var(--color-gray-100);
    color: var(--color-text);
}

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

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

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

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

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

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

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

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

/* Timed progress bar relies on @keyframes toast-progress in animations.css */
.toast--timed {
    position: relative;
}

.toast--timed::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: currentColor;
    opacity: .3;
    animation: toast-progress linear;
}

.toast--success.toast--timed::after {
    background: var(--color-success);
}

.toast--error.toast--timed::after {
    background: var(--color-error);
}

.toast--warning.toast--timed::after {
    background: var(--color-warning);
}

.toast--info.toast--timed::after {
    background: var(--color-info);
}

/* Variants */
.toast--slide-up {
    transform: translateY(100%);
}

.toast--slide-up.toast--show {
    transform: translateY(0);
}

.toast--slide-up.toast--hide {
    transform: translateY(100%);
}

.toast--fade {
    transform: none;
}

.toast--fade.toast--show {
    transform: none;
}

.toast--fade.toast--hide {
    transform: none;
}

/* Hover */
.toast:hover,
.toast--show:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width:480px) {
    .toast-container {
        bottom: 10px;
        left: 10px;
        right: 10px;
        transform: none;
        max-width: none;
    }

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

    .toast__content {
        padding: var(--spacing-sm);
    }

    .toast__message {
        font-size: var(--font-size-xs);
    }
}

/* Dark scheme fallback (optional semantic vars) */
@media (prefers-color-scheme: dark) {
    .toast {
        background: var(--color-surface-dark, #1f2937);
        border-color: var(--color-border-dark, #374151);
        color: var(--color-text-dark, #f9fafb);
    }

    .toast__message {
        color: var(--color-text-dark, #f9fafb);
    }

    .toast__close {
        color: var(--color-text-muted-dark, #9ca3af);
    }

    .toast__close:hover {
        background: var(--color-gray-700, #374151);
        color: var(--color-text-dark, #f9fafb);
    }
}