/* Toast Notification System Styling */
#toast-container {
    position: fixed;
    top: 15px;
    right: 30px; /* Increased space from right edge */
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 255px; /* 30px wider than previous setting */
    width: calc(100% - 30px);
}

.toast {
    display: flex;
    align-items: center;
    background: var(--glass-background);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    padding: 7px 35px 7px 12px; /* Increased right padding */
    border-radius: 6px; /* Smaller border radius */
    box-shadow: var(--glass-shadow);
    transform: translateX(120%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
    position: relative;
    color: var(--text-color);
    min-height: 28px; /* Smaller minimum height */
    max-height: 40px; /* Smaller maximum height */
    width: 100%; /* Ensure width is 100% of container */
    opacity: 0; /* Start with 0 opacity for fade in */
}

.toast.show {
    transform: translateX(0);
    opacity: 1; /* Fully visible when shown */
}

.toast.hiding {
    transform: translateX(120%);
    opacity: 0; /* Fade out when hiding */
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px; /* Smaller icon size */
    height: 18px; /* Smaller icon size */
    border-radius: 50%;
    margin-right: 6px; /* Reduced margin */
    flex-shrink: 0;
    font-size: 9px; /* Smaller icon font size */
}

.toast-success .toast-icon {
    background-color: rgba(0, 255, 163, 0.15);
    color: var(--primary-color);
    border: 1px solid rgba(0, 255, 163, 0.3);
}

.toast-error .toast-icon {
    background-color: rgba(255, 55, 55, 0.15);
    color: var(--error-color);
    border: 1px solid rgba(255, 55, 55, 0.3);
}

.toast-warning .toast-icon {
    background-color: rgba(246, 192, 0, 0.15);
    color: var(--warning-color);
    border: 1px solid rgba(246, 192, 0, 0.3);
}

.toast-info .toast-icon {
    background-color: rgba(0, 229, 255, 0.15);
    color: var(--accent-color);
    border: 1px solid rgba(0, 229, 255, 0.3);
}

.toast-content {
    flex: 1;
    padding-right: 8px; /* Increased padding */
    font-size: 11px; /* Smaller font size */
    line-height: 1.2; /* Tighter line height */
    word-break: break-word;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 205px; /* Adjusted for wider container */
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 2px; /* Smaller padding */
    margin-left: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 16px; /* Smaller width */
    height: 16px; /* Smaller height */
    font-size: 9px; /* Smaller icon */
}

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

.toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 1px; /* Thinner progress bar */
    width: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform-origin: left center;
    animation: progress-animation linear forwards;
}

.toast-success .toast-progress {
    background: linear-gradient(to right, transparent, var(--primary-color), transparent);
}

.toast-error .toast-progress {
    background: linear-gradient(to right, transparent, var(--error-color), transparent);
}

.toast-warning .toast-progress {
    background: linear-gradient(to right, transparent, var(--warning-color), transparent);
}

.toast-info .toast-progress {
    background: linear-gradient(to right, transparent, var(--accent-color), transparent);
}

@keyframes progress-animation {
    0% {
        transform: scaleX(1);
        opacity: 0.7;
    }
    15% { /* Show full progress bar during fade-in (0.3s of 2s) */
        transform: scaleX(1);
        opacity: 0.7;
    }
    85% { /* Start fading out at 1.7s of 2s total */
        transform: scaleX(0.3);
        opacity: 0.7;
    }
    100% {
        transform: scaleX(0);
        opacity: 0;
    }
}

/* Toast animations */
.toast {
    animation: toast-glow 3s infinite alternate;
}

.toast-success {
    box-shadow: 0 4px 15px rgba(0, 255, 163, 0.15);
}

.toast-error {
    box-shadow: 0 4px 15px rgba(255, 55, 55, 0.15);
}

.toast-warning {
    box-shadow: 0 4px 15px rgba(246, 192, 0, 0.15);
}

.toast-info {
    box-shadow: 0 4px 15px rgba(0, 229, 255, 0.15);
}

@keyframes toast-glow {
    0% {
        box-shadow: 0 4px 15px rgba(0, 229, 255, 0.1);
    }
    100% {
        box-shadow: 0 4px 20px rgba(0, 229, 255, 0.25);
    }
}

.toast-success {
    animation: toast-glow-success 3s infinite alternate;
}

@keyframes toast-glow-success {
    0% {
        box-shadow: 0 4px 15px rgba(0, 255, 163, 0.1);
    }
    100% {
        box-shadow: 0 4px 20px rgba(0, 255, 163, 0.25);
    }
}

.toast-error {
    animation: toast-glow-error 3s infinite alternate;
}

@keyframes toast-glow-error {
    0% {
        box-shadow: 0 4px 15px rgba(255, 55, 55, 0.1);
    }
    100% {
        box-shadow: 0 4px 20px rgba(255, 55, 55, 0.25);
    }
}

.toast-warning {
    animation: toast-glow-warning 3s infinite alternate;
}

@keyframes toast-glow-warning {
    0% {
        box-shadow: 0 4px 15px rgba(246, 192, 0, 0.1);
    }
    100% {
        box-shadow: 0 4px 20px rgba(246, 192, 0, 0.25);
    }
}

/* Responsive adjustments */
@media (max-width: 576px) {
    #toast-container {
        top: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
    }
    
    .toast {
        padding: 10px 12px;
    }
    
    .toast-icon {
        width: 25px;
        height: 25px;
        margin-right: 10px;
    }
    
    .toast-content {
        font-size: 13px;
    }
}