/******************************************/
/*  Modern Toast Notifications            */
/******************************************/

/* Container - centered overlay */
.modern-toast-container {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    z-index: 99999 !important;
    pointer-events: none;
}

.modern-toast-container > .modern-toast {
    margin: 0 !important;
    pointer-events: auto;
}

/* Base toast styles - glassmorphism effect */
.modern-toast {
    position: relative;
    min-width: 320px !important;
    max-width: 480px !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 16px !important;
    overflow: hidden !important;

    /* Glassmorphism */
    background: rgba(30, 41, 59, 0.92) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;

    /* Modern shadow */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset !important;

    /* Animation setup */
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* Show state with spring animation */
.modern-toast.show {
    opacity: 1 !important;
    transform: scale(1) translateY(0) !important;
}

/* Hide state */
.modern-toast.hiding,
.modern-toast:not(.show) {
    opacity: 0 !important;
    transform: scale(0.9) translateY(-20px) !important;
}

/* Toast header */
.modern-toast-header {
    background: transparent !important;
    border-bottom: none !important;
    padding: 1.25rem 1.5rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.875rem !important;
}

/* Icon styling */
.modern-toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

/* Success variant */
.modern-toast-icon.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

/* Error variant */
.modern-toast-icon.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

/* Info variant */
.modern-toast-icon.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

/* Warning variant */
.modern-toast-icon.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

/* Toast message */
.modern-toast-message {
    color: #fff !important;
    font-size: 1.0625rem !important;
    font-weight: 600 !important;
    letter-spacing: -0.01em !important;
    flex: 1 !important;
    line-height: 1.4 !important;
}

/* Close button */
.modern-toast-close {
    background: rgba(255, 255, 255, 0.1) !important;
    border: none !important;
    border-radius: 8px !important;
    color: rgba(255, 255, 255, 0.7) !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-size: 0.875rem !important;
}

.modern-toast-close:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    transform: scale(1.05) !important;
}

/* Auto-dismiss progress bar */
.modern-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    border-radius: 0 0 16px 16px;
    animation: modern-toast-progress 4s linear forwards;
}

.modern-toast-success .modern-toast-progress {
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

.modern-toast-error .modern-toast-progress {
    background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
}

.modern-toast-info .modern-toast-progress {
    background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
}

.modern-toast-warning .modern-toast-progress {
    background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
}

@keyframes modern-toast-progress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Shimmer effect on icon */
.modern-toast-icon::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
            90deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent
    );
    animation: modern-toast-shimmer 2s ease-in-out infinite;
}

@keyframes modern-toast-shimmer {
    0% {
        left: -100%;
    }
    50%, 100% {
        left: 100%;
    }
}

/* Light mode adjustments */
@media (prefers-color-scheme: light) {
    .modern-toast {
        background: rgba(255, 255, 255, 0.95) !important;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(0, 0, 0, 0.05) inset !important;
    }

    .modern-toast-message {
        color: #1e293b !important;
    }

    .modern-toast-close {
        background: rgba(0, 0, 0, 0.05) !important;
        color: rgba(0, 0, 0, 0.5) !important;
    }

    .modern-toast-close:hover {
        background: rgba(0, 0, 0, 0.1) !important;
        color: #1e293b !important;
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .modern-toast {
        transition: opacity 0.2s ease !important;
    }

    .modern-toast.show {
        transform: scale(1) translateY(0) !important;
    }

    .modern-toast-progress {
        animation: none;
        width: 100%;
    }

    .modern-toast-icon::after {
        animation: none;
    }
}

/* Legacy Bootstrap toast overrides (keep existing functionality) */
.toast-container {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    z-index: 99999 !important;
}

.toast-container > .toast {
    margin: 0 !important;
}
