/* ============================================================
   TOAST NOTIFICATION COMPONENT
   Fixed top-right container with stackable, animated toast
   items in success / error / warning / info variants.
   ============================================================ */

/* Container - fixed position, below header */
#toast-container {
    position: fixed;
    top: calc(var(--header-height) + 0.5rem);
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    pointer-events: none;         /* Allow clicks to pass through the container */
    max-width: 380px;
    width: 100%;
}

/* Individual toast */
.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.65rem 0.875rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--text);
    pointer-events: auto;
    transform: translateX(110%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Visible state */
.toast--visible {
    transform: translateX(0);
    opacity: 1;
}

/* Leaving state */
.toast--leaving {
    transform: translateX(110%);
    opacity: 0;
}

/* Icon */
.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
}

/* Message */
.toast-message {
    flex: 1;
    word-break: break-word;
}

/* Close button */
.toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: var(--gray-400);
    border-radius: var(--radius-sm);
    transition: color 0.12s, background 0.12s;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

.toast-close:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

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

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

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

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

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

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

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

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

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

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

.toast--success .toast-progress { background: var(--success); }
.toast--error .toast-progress   { background: var(--danger); }
.toast--warning .toast-progress { background: var(--warning); }
.toast--info .toast-progress    { background: var(--info); }

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

/* ----- Responsive ----- */
@media (max-width: 480px) {
    #toast-container {
        left: 0.5rem;
        right: 0.5rem;
        max-width: none;
    }
}
