/* Toast container styling */
.toast-container {
    z-index: 11000;
}

/* Mobile navigation adjustment for bottom positioned toasts */
@media (max-width: 991.98px) {
    .toast-container[id*="bottom"] {
        bottom: calc(5rem + env(safe-area-inset-bottom, 0)) !important;
    }
}

/* Toast styling */
.toast {
    min-width: 280px;
    max-width: 450px;
    animation: toast-in 0.4s cubic-bezier(0.21, 1.02, 0.73, 1);
    box-shadow: 0 0.5rem 1.5rem rgba(var(--primary-color-rgb), 0.25);
    border-radius: var(--border-radius);
    opacity: 1 !important;
    margin-bottom: 0.75rem;
    border: none;
    overflow: hidden;
}

/* Toast Header Styling */
.toast-header {
    border-bottom: none;
    color: white;
    font-weight: 600;
    padding: 0.75rem 1rem;
    background: inherit;
}

.toast-header strong {
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

/* Close button styling */
.toast-header .btn-close,
.toast-header .btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.8;
    transition: opacity 0.3s ease, transform 0.2s ease;
    font-size: 0.8rem;
    width: 0.8em;
    height: 0.8em;
}

.toast-header .btn-close:hover,
.toast-header .btn-close-white:hover {
    opacity: 1;
    transform: scale(1.1);
}

.toast-body {
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    color: white;
    font-weight: 500;
}

/* Toast colors with better contrast and header/body styling */
.toast-header.bg-success,
.toast-body.bg-success {
    background: linear-gradient(135deg, var(--success-color), #20c997) !important;
    color: #ffffff !important;
}

.toast-header.bg-warning,
.toast-body.bg-warning {
    background: linear-gradient(135deg, var(--warning-color), #fd7e14) !important;
    color: #212529 !important; /* Dark text for better contrast on yellow */
}

/* Dark close button for warning toasts */
.toast-header.bg-warning .btn-close,
.toast-header.bg-warning .btn-close-white {
    filter: none;
    opacity: 0.7;
}

.toast-header.bg-warning .btn-close:hover,
.toast-header.bg-warning .btn-close-white:hover {
    opacity: 1;
}

.toast-header.bg-danger,
.toast-body.bg-danger {
    background: linear-gradient(135deg, var(--danger-color), #e74c3c) !important;
    color: #ffffff !important;
}

.toast-header.bg-info,
.toast-body.bg-info {
    background: linear-gradient(135deg, var(--info-color), #3498db) !important;
    color: #ffffff !important;
}

.toast-header.bg-primary,
.toast-body.bg-primary {
    background: var(--primary-gradient) !important;
    color: #ffffff !important;
}

/* Toast animation */
@keyframes toast-in {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    50% {
        opacity: 1;
        transform: translateY(-5px) scale(1.01);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Different position animations */
.toast-container[id^="toast-container-top"] .toast {
    animation: toast-in-top 0.5s cubic-bezier(0.21, 1.02, 0.73, 1);
}

@keyframes toast-in-top {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.8);
    }
    50% {
        opacity: 1;
        transform: translateY(5px) scale(1.01);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.toast-container[id^="toast-container-middle"] .toast {
    animation: toast-in-middle 0.5s cubic-bezier(0.21, 1.02, 0.73, 1);
}

@keyframes toast-in-middle {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}
