/**
 * Toaster Notification System
 * Stacked toast messages for API responses and flash messages
 */

#toaster-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    pointer-events: all;
    background: var(--background-color, #fff);
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
    min-width: 300px;
    border-left: 4px solid var(--toast-color, #333);
}

.toast.removing {
    animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(calc(100% + 20px));
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(calc(100% + 20px));
        opacity: 0;
    }
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

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

.toast-message {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary, #333);
    word-wrap: break-word;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: var(--text-tertiary, #999);
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s;
}

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

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--toast-color, #333);
    opacity: 0.3;
    animation: progress linear;
}

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

/* Toast type variants */
.toast.success {
    --toast-color: #22c55e;
    border-left-color: var(--toast-color);
}

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

.toast.error {
    --toast-color: #ef4444;
    border-left-color: var(--toast-color);
}

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

.toast.warning {
    --toast-color: #f59e0b;
    border-left-color: var(--toast-color);
}

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

.toast.info {
    --toast-color: #3b82f6;
    border-left-color: var(--toast-color);
}

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

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .toast {
        background: var(--surface-color, #1e1e1e);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .toast-message {
        color: var(--text-primary, #e0e0e0);
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    #toaster-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .toast {
        min-width: auto;
    }
}
