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

#toast-container::-webkit-scrollbar {
    display: none;
}

/* Toast Base Styles */
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 340px;
    max-width: 480px;
    padding: 12px 14px;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 16px rgba(110, 79, 162, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
}

.toast.removing {
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.toast:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(110, 79, 162, 0.12), 0 3px 8px rgba(0, 0, 0, 0.06);
}

/* Toast Type Variants */
.toast-success {
    border-left: 3px solid #10b981;
}

.toast-info {
    border-left: 3px solid #6E4FA2;
}

.toast-warning {
    border-left: 3px solid #f59e0b;
}

.toast-error,
.toast-danger {
    border-left: 3px solid #ef4444;
}

html[dir="rtl"] .toast-success,
html[dir="rtl"] .toast-info,
html[dir="rtl"] .toast-warning,
html[dir="rtl"] .toast-error,
html[dir="rtl"] .toast-danger {
    border-left: none;
    border-right: 3px solid;
}

html[dir="rtl"] .toast-success { border-right-color: #10b981; }
html[dir="rtl"] .toast-info { border-right-color: #6E4FA2; }
html[dir="rtl"] .toast-warning { border-right-color: #f59e0b; }
html[dir="rtl"] .toast-error,
html[dir="rtl"] .toast-danger { border-right-color: #ef4444; }

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

.toast-success .toast-icon {
    background-color: #ecfdf5;
    color: #10b981;
}

.toast-info .toast-icon {
    background-color: #f3f0f9;
    color: #6E4FA2;
}

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

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

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

html[dir="rtl"] .toast-content {
    text-align: right;
    unicode-bidi: plaintext;
}

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

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

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

/* Toast Progress Bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    transform-origin: left;
    animation: progressBar 5s linear forwards;
}

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

.toast-success .toast-progress { background: #10b981; }
.toast-info .toast-progress { background: #6E4FA2; }
.toast-warning .toast-progress { background: #f59e0b; }
.toast-error .toast-progress,
.toast-danger .toast-progress { background: #ef4444; }

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

/* Animations */
@keyframes slideDown {
    from {
        transform: translateY(-16px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-16px);
        opacity: 0;
    }
}

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

/* Mobile Responsiveness */
@media (max-width: 640px) {
    #toast-container {
        width: calc(100% - 1.5rem);
    }

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

    .toast-close {
        opacity: 1;
    }
}
