/* ============================================
   PREMIUM TOAST NOTIFICATION SYSTEM
   Modern Glassmorphism Design - 2026 Level
   ============================================ */

/* CSS Variables */
:root {
    --toast-bg: rgba(255, 255, 255, 0.08);
    --toast-bg-dark: rgba(15, 15, 20, 0.85);
    --toast-border: rgba(255, 255, 255, 0.1);
    --toast-border-dark: rgba(255, 255, 255, 0.05);
    --toast-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    --toast-radius: 14px;
    --toast-spacing: 12px;
    --toast-icon-size: 22px;
    --toast-progress-height: 3px;
    
    /* Toast Colors */
    --toast-success: #10b981;
    --toast-success-bg: rgba(16, 185, 129, 0.15);
    --toast-error: #ef4444;
    --toast-error-bg: rgba(239, 68, 68, 0.15);
    --toast-warning: #f59e0b;
    --toast-warning-bg: rgba(245, 158, 11, 0.15);
    --toast-info: #3b82f6;
    --toast-info-bg: rgba(59, 130, 246, 0.15);
    
    /* Light theme */
    --toast-text: #ffffff;
    --toast-text-dark: #1f2937;
    --toast-bg-light: rgba(255, 255, 255, 0.95);
    --toast-border-light: rgba(0, 0, 0, 0.08);
    --toast-shadow-light: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* Dark theme by default */
[data-theme="light"] {
    --toast-text-primary: #1f2937;
    --toast-bg-actual: var(--toast-bg-light);
    --toast-border-actual: var(--toast-border-light);
    --toast-shadow-actual: var(--toast-shadow-light);
}

[data-theme="dark"],
:not([data-theme="light"]) {
    --toast-text-primary: var(--toast-text);
    --toast-bg-actual: var(--toast-bg-dark);
    --toast-border-actual: var(--toast-border-dark);
    --toast-shadow-actual: var(--toast-shadow);
}

/* Toast Container */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: var(--toast-spacing);
    pointer-events: none;
    max-width: 400px;
    width: 100%;
}

.toast-container.bottom-right {
    top: auto;
    bottom: 20px;
    right: 20px;
    left: auto;
}

.toast-container.bottom-left {
    top: auto;
    bottom: 20px;
    left: 20px;
    right: auto;
}

.toast-container.top-left {
    top: 20px;
    left: 20px;
    right: auto;
}

/* Individual Toast */
.toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    background: var(--toast-bg-actual);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--toast-border-actual);
    border-radius: var(--toast-radius);
    box-shadow: var(--toast-shadow-actual);
    color: var(--toast-text-primary);
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    pointer-events: auto;
    overflow: hidden;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.hide {
    transform: translateX(120%);
    opacity: 0;
}

/* Toast Types - Glassmorphism Glow */
.toast.toast-success {
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: var(--toast-shadow-actual), 
                0 0 20px rgba(16, 185, 129, 0.15),
                inset 0 0 20px rgba(16, 185, 129, 0.05);
}

.toast.toast-error {
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: var(--toast-shadow-actual), 
                0 0 20px rgba(239, 68, 68, 0.15),
                inset 0 0 20px rgba(239, 68, 68, 0.05);
}

.toast.toast-warning {
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: var(--toast-shadow-actual), 
                0 0 20px rgba(245, 158, 11, 0.15),
                inset 0 0 20px rgba(245, 158, 11, 0.05);
}

.toast.toast-info {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: var(--toast-shadow-actual), 
                0 0 20px rgba(59, 130, 246, 0.15),
                inset 0 0 20px rgba(59, 130, 246, 0.05);
}

/* Toast Icon */
.toast-icon {
    flex-shrink: 0;
    width: var(--toast-icon-size);
    height: var(--toast-icon-size);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border-radius: 50%;
    font-weight: 700;
}

.toast-success .toast-icon {
    background: var(--toast-success-bg);
    color: var(--toast-success);
}

.toast-error .toast-icon {
    background: var(--toast-error-bg);
    color: var(--toast-error);
}

.toast-warning .toast-icon {
    background: var(--toast-warning-bg);
    color: var(--toast-warning);
}

.toast-info .toast-icon {
    background: var(--toast-info-bg);
    color: var(--toast-info);
}

/* Toast Content */
.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
    color: var(--toast-text-primary);
}

.toast-message {
    font-size: 13px;
    opacity: 0.9;
    color: var(--toast-text-primary);
    opacity: 0.85;
    word-wrap: break-word;
}

/* Toast Close Button */
.toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--toast-text-primary);
    opacity: 0.5;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    margin: -4px -4px 0 0;
}

.toast-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.toast-close svg {
    width: 14px;
    height: 14px;
}

/* Toast Progress Bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: var(--toast-progress-height);
    background: currentColor;
    opacity: 0.3;
    transition: width linear;
}

.toast-success .toast-progress { background: var(--toast-success); }
.toast-error .toast-progress { background: var(--toast-error); }
.toast-warning .toast-progress { background: var(--toast-warning); }
.toast-info .toast-progress { background: var(--toast-info); }

/* Toast Hover State */
.toast:hover .toast-progress {
    animation-play-state: paused;
}

/* Animations */
@keyframes toastSlideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

@keyframes toastFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes toastFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Stagger Animation for Multiple Toasts */
.toast-container:not(.toast-staggered) .toast:nth-child(1) { animation-delay: 0s; }
.toast-container.toast-staggered .toast:nth-child(1) { animation-delay: 0s; }
.toast-container.toast-staggered .toast:nth-child(2) { animation-delay: 0.1s; }
.toast-container.toast-staggered .toast:nth-child(3) { animation-delay: 0.2s; }
.toast-container.toast-staggered .toast:nth-child(4) { animation-delay: 0.3s; }
.toast-container.toast-staggered .toast:nth-child(5) { animation-delay: 0.4s; }

/* Mobile Responsive */
@media (max-width: 480px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        width: auto;
    }
    
    .toast-container.bottom-right,
    .toast-container.bottom-left {
        bottom: 10px;
        top: auto;
    }
    
    .toast {
        padding: 14px 16px;
        font-size: 13px;
    }
    
    .toast-icon {
        width: 20px;
        height: 20px;
        font-size: 14px;
    }
    
    .toast-title {
        font-size: 13px;
    }
    
    .toast-message {
        font-size: 12px;
    }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
    .toast-container {
        max-width: 350px;
    }
}

/* Large Screens */
@media (min-width: 1200px) {
    .toast-container {
        top: 30px;
        right: 30px;
    }
}

/* Dark Theme Toast (force dark on light backgrounds) */
.toast.force-dark {
    --toast-bg-actual: var(--toast-bg-dark);
    --toast-border-actual: var(--toast-border-dark);
    --toast-shadow-actual: var(--toast-shadow);
    --toast-text-primary: var(--toast-text);
}

/* Light Theme Toast */
.toast.force-light {
    --toast-bg-actual: var(--toast-bg-light);
    --toast-border-actual: var(--toast-border-light);
    --toast-shadow-actual: var(--toast-shadow-light);
    --toast-text-primary: var(--toast-text-dark);
}

/* Toast Clickable */
.toast.clickable {
    cursor: pointer;
}

.toast.clickable:hover {
    transform: translateX(0) scale(1.01);
}

/* Queue indicator */
.toast-queue-info {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--toast-bg-actual);
    backdrop-filter: blur(12px);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--toast-text-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 99998;
}

.toast-queue-info.show {
    opacity: 1;
}
