/* ============================================
   Toast Notification System
   Modern, Clean Design
   ============================================ */

/* Toast Container */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    max-width: 380px;
    width: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (max-width: 576px) {
    .toast-container {
        top: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
        width: calc(100% - 20px);
    }
}

/* Individual Toast */
.toast {
    pointer-events: auto;
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 100%;
    min-width: 300px;
    position: relative;
    border: 1px solid var(--border-color);
}

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

.toast.hiding {
    opacity: 0;
    transform: translateX(100%);
}

/* Toast Header */
.toast-header {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    background-color: transparent;
    border-bottom: none;
    gap: 0.75rem;
}

/* Toast Icon */
.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.875rem;
}

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

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

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

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

/* Toast Title */
.toast-title {
    flex: 1;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
}

/* Toast Close Button */
.toast-close {
    background: transparent;
    border: none;
    padding: 0.25rem;
    margin: -0.25rem;
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0.7;
    transition: all var(--transition-fast);
    font-size: 1.25rem;
    line-height: 1;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.toast-close:hover {
    opacity: 1;
    background-color: var(--surface-hover);
    color: var(--text-primary);
}

/* Toast Body */
.toast-body {
    padding: 0 1rem 1rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    word-wrap: break-word;
    line-height: 1.5;
}

.toast-body a {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
}

.toast-body a:hover {
    color: var(--primary-hover);
}

/* Toast Progress Bar */
.toast-progress {
    height: 3px;
    background-color: var(--border-color);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.toast-progress-bar {
    height: 100%;
    transition: width linear;
    width: 100%;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

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

.toast.toast-success .toast-progress-bar {
    background-color: var(--success-color);
}

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

.toast.toast-warning .toast-progress-bar {
    background-color: var(--warning-color);
}

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

.toast.toast-error .toast-progress-bar {
    background-color: var(--danger-color);
}

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

.toast.toast-info .toast-progress-bar {
    background-color: var(--info-color);
}

/* Dark Theme Support */
[data-theme="dark"] .toast {
    background-color: var(--surface-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .toast-progress {
    background-color: var(--border-color);
}

/* Toast Stacking Animation */
.toast-container .toast:nth-child(2) {
    transform-origin: top center;
}

.toast-container .toast:nth-child(3) {
    transform-origin: top center;
}

/* Hover pause animation */
.toast:hover .toast-progress-bar {
    animation-play-state: paused;
}

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

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

.toast.show {
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast.hiding {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Mobile Responsive */
@media (max-width: 576px) {
    .toast {
        min-width: 0;
        width: 100%;
    }

    .toast-header {
        padding: 0.75rem;
    }

    .toast-body {
        padding: 0 0.75rem 0.75rem 0.75rem;
        font-size: 0.8125rem;
    }

    .toast-title {
        font-size: 0.875rem;
    }
}
