/* Toast Messages Container - Bottom Right, Above Feedback Widget */
#toast-container {
    position: fixed;
    bottom: 100px; /* Above feedback widget (which is at 24px) */
    right: 24px;
    z-index: 10000; /* Above feedback widget (9999) */
    display: flex;
    flex-direction: column-reverse; /* New toasts appear at bottom */
    gap: 12px;
    max-width: 400px;
    pointer-events: none; /* Allow clicks through container */
}

#toast-container .toast {
    pointer-events: all; /* But allow clicks on toasts themselves */
    min-width: 320px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: none;
    border-radius: 12px;
    overflow: hidden;
}

/* Toast Animation */
.toast.show {
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.hide {
    animation: slideOutRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Toast Header Styling */
.toast-header {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Toast Body Styling */
.toast-body {
    padding: 14px 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #374151;
    overflow: hidden;
}

/* Toast Icon */
.toast-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    flex-shrink: 0;
}

/* Success Toast */
.toast.toast-success .toast-header {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: white;
}

.toast.toast-success .toast-icon {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.toast.toast-success .toast-body {
    background: #f0fdf4;
}

/* Error/Danger Toast */
.toast.toast-danger .toast-header {
    background: linear-gradient(135deg, #ef4444, #f87171);
    color: white;
}

.toast.toast-danger .toast-icon {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.toast.toast-danger .toast-body {
    background: #fef2f2;
}

/* Warning Toast */
.toast.toast-warning .toast-header {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: white;
}

.toast.toast-warning .toast-icon {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.toast.toast-warning .toast-body {
    background: #fffbeb;
}

/* Info Toast */
.toast.toast-info .toast-header {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    color: white;
}

.toast.toast-info .toast-icon {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.toast.toast-info .toast-body {
    background: #eff6ff;
}

/* Close Button */
.toast .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

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

/* Progress Bar (optional enhancement) */
.toast-progress {
    position: absolute;
    top: 52px;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    transition: width linear;
}

.toast.toast-success .toast-progress {
    background: linear-gradient(135deg, #10b981, #34d399);
}

.toast.toast-info .toast-progress {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #toast-container {
        right: 12px;
        bottom: 80px;
        max-width: calc(100vw - 24px);
    }

    #toast-container .toast {
        min-width: 280px;
        max-width: 100%;
    }
}

/* RTL Support (if needed in future) */
[dir="rtl"] #toast-container {
    right: auto;
    left: 24px;
}

[dir="rtl"] @keyframes slideInRight {
    from {
        transform: translateX(calc(-100% - 24px));
    }
    to {
        transform: translateX(0);
    }
}
