/* Custom Toast Notification System for ArabicDiscord */

#toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
    max-width: 420px;
    width: calc(100% - 3rem);
}

/* RTL / LTR alignment support */
[dir="rtl"] #toast-container {
    right: 1.5rem;
    left: auto;
}

[dir="ltr"] #toast-container {
    right: 1.5rem;
    left: auto;
}

@media (max-width: 639px) {
    #toast-container,
    [dir="rtl"] #toast-container,
    [dir="ltr"] #toast-container {
        top: 1rem;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: calc(100% - 2rem);
        max-width: 400px;
    }
}

.toast-item {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem 0.875rem 1.25rem;
    border-radius: 1rem;
    background: rgba(16, 22, 49, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 20px -5px var(--toast-glow-color, rgba(65, 86, 189, 0.2));
    color: #F5F7FF;
    font-family: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.925rem;
    line-height: 1.4;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[dir="rtl"] .toast-item {
    padding: 0.875rem 1.25rem 0.875rem 1rem;
}

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

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

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-12px) scale(0.92);
    }
}

.toast-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.75rem;
    flex-shrink: 0;
    background: var(--toast-icon-bg, rgba(65, 86, 189, 0.15));
    color: var(--toast-accent-color, #6679D8);
}

.toast-icon-wrap svg {
    width: 1.25rem;
    height: 1.25rem;
}

.toast-content {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.toast-message {
    font-weight: 500;
    color: #F5F7FF;
}

.toast-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 9999px;
    border: none;
    background: transparent;
    color: #9BA3C7;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
    padding: 0;
}

.toast-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
}

.toast-close svg {
    width: 1rem;
    height: 1rem;
}

/* Progress bar */
.toast-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
}

.toast-progress-fill {
    height: 100%;
    width: 100%;
    background: var(--toast-accent-color, #4156BD);
    transform-origin: left center;
    transition: transform 0.1s linear;
}

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

/* Toast Type Variations */
.toast-success {
    --toast-accent-color: #10B981;
    --toast-icon-bg: rgba(16, 185, 129, 0.15);
    --toast-glow-color: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.3);
}

.toast-error {
    --toast-accent-color: #EF4444;
    --toast-icon-bg: rgba(239, 68, 68, 0.15);
    --toast-glow-color: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
}

.toast-warning {
    --toast-accent-color: #F59E0B;
    --toast-icon-bg: rgba(245, 158, 11, 0.15);
    --toast-glow-color: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.3);
}

.toast-info {
    --toast-accent-color: #6679D8;
    --toast-icon-bg: rgba(102, 121, 216, 0.15);
    --toast-glow-color: rgba(102, 121, 216, 0.2);
    border-color: rgba(102, 121, 216, 0.3);
}

/* Pulse animation for duplicate prevention indication */
@keyframes toastShake {
    0%, 100% { transform: scale(1); }
    20%, 60% { transform: scale(1.04); }
    40%, 80% { transform: scale(0.97); }
}

.toast-shake {
    animation: toastShake 0.4s ease-in-out;
}
