/* Toast Container */
#toast-container {
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

/* Hide scrollbar but keep functionality */
#toast-container::-webkit-scrollbar {
    width: 4px;
}

#toast-container::-webkit-scrollbar-track {
    background: transparent;
}

#toast-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

/* RTL Support */
html[dir="rtl"] #toast-container {
    right: auto;
    left: 1rem;
}

/* Toast Base Styles */
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    max-width: 420px;
    padding: 14px 16px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    animation: slideInRight 0.3s ease-out forwards;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.toast:hover {
    transform: translateX(-4px);
}

html[dir="rtl"] .toast:hover {
    transform: translateX(4px);
}

/* Toast Removal Animation */
.toast.removing {
    animation: slideOutRight 0.3s ease-in forwards;
}

html[dir="rtl"] .toast.removing {
    animation: slideOutLeft 0.3s ease-in forwards;
}

/* Toast Type Colors - Matching Design */
.toast-success {
    background: #ffffff;                 /* match dashboard card bg */
    border: 1px solid #e5e7eb;           /* border-gray-200 */
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05); /* shadow-sm */
}
/* Hover elevation to match dashboard cards */
.toast-success:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08); /* hover:shadow-md */
}
.toast-info {
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    border: 1px solid #93c5fd;
}

.toast-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fef9e7 100%);
    border: 1px solid #fcd34d;
}

.toast-error,
.toast-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fef2f2 100%);
    border: 1px solid #fca5a5;
}

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

.toast-success .toast-icon {
    background-color: #ecfdf5; /* bg-green-50 */
    color: #16a34a;           /* text-green-600 */
    border: 1px solid #bbf7d0;/* border-green-200 */
}

.toast-info .toast-icon {
    background-color: #3b82f6;
    color: white;
}

.toast-warning .toast-icon {
    background-color: #f59e0b;
    color: white;
}

.toast-error .toast-icon,
.toast-danger .toast-icon {
    background-color: #ef4444;
    color: white;
}

/* Toast Content */
.toast-content {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    color: #1f2937;
    word-wrap: break-word;
}

/* Toast Close Button */
.toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    padding: 0;
}

.toast-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #374151;
}

.toast-close:active {
    transform: scale(0.95);
}

/* Toast Progress Bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.2);
    width: 100%;
    transform-origin: left;
    animation: progressBar 5s linear forwards;
}

html[dir="rtl"] .toast-progress {
    left: auto;
    right: 0;
    transform-origin: right;
}

.toast.paused .toast-progress {
    animation-play-state: paused;
}

/* Animations */
@keyframes slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(-120%);
        opacity: 0;
    }
}

@keyframes progressBar {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    #toast-container {
        right: 0.75rem;
        left: 0.75rem;
        top: 5rem;
    }

    html[dir="rtl"] #toast-container {
        right: 0.75rem;
        left: 0.75rem;
    }

    .toast {
        min-width: auto;
        width: 100%;
        max-width: 100%;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .toast {
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 4px 10px rgba(0, 0, 0, 0.2);
    }

    .toast-content {
        color: #111827; /* text-gray-900 for card content */
    }

    .toast-close {
        color: #4b5563;
    }

    .toast-close:hover {
        background-color: rgba(0, 0, 0, 0.1);
        color: #1f2937;
    }
}