/* Modern Toast Notification System */

/* Toast Container - Fixed position in top-right corner */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    pointer-events: none;
}

.toast-container .toast {
    pointer-events: auto;
}

/* Modern Toast Styles */
.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    margin-bottom: 12px;
    min-width: 300px;
    max-width: 400px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Toast Animation States */
.toast.show {
    transform: translateX(0);
}

.toast.hide {
    transform: translateX(100%);
    opacity: 0;
}

/* Toast Header */
.toast-header {
    background: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 12px 16px 8px;
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 14px;
}

.toast-header .toast-icon {
    margin-right: 8px;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.toast-header .btn-close {
    margin-left: auto;
    padding: 0;
    background: none;
    border: none;
    font-size: 18px;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: color 0.2s;
}

.toast-header .btn-close:hover {
    color: rgba(0, 0, 0, 0.8);
}

/* Toast Body */
.toast-body {
    padding: 8px 16px 12px;
    font-size: 14px;
    line-height: 1.4;
    color: rgba(0, 0, 0, 0.8);
}

/* Toast Types with Modern Color Scheme */
.toast.toast-success {
    border-left: 4px solid #10b981;
}

.toast.toast-success .toast-header {
    color: #10b981;
}

.toast.toast-success .toast-icon {
    color: #10b981;
}

.toast.toast-error {
    border-left: 4px solid #ef4444;
}

.toast.toast-error .toast-header {
    color: #ef4444;
}

.toast.toast-error .toast-icon {
    color: #ef4444;
}

.toast.toast-warning {
    border-left: 4px solid #f59e0b;
}

.toast.toast-warning .toast-header {
    color: #f59e0b;
}

.toast.toast-warning .toast-icon {
    color: #f59e0b;
}

.toast.toast-info {
    border-left: 4px solid #3b82f6;
}

.toast.toast-info .toast-header {
    color: #3b82f6;
}

.toast.toast-info .toast-icon {
    color: #3b82f6;
}

/* Progress Bar for Auto-dismiss */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, currentColor 0%, currentColor 100%);
    opacity: 0.3;
    transform-origin: left;
    animation: toast-progress linear;
}

@keyframes toast-progress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .toast {
        background: rgba(31, 41, 55, 0.95);
        color: rgba(255, 255, 255, 0.9);
    }

    .toast-header {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }

    .toast-body {
        color: rgba(255, 255, 255, 0.8);
    }

    .toast-header .btn-close {
        color: rgba(255, 255, 255, 0.5);
    }

    .toast-header .btn-close:hover {
        color: rgba(255, 255, 255, 0.8);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .toast {
        min-width: auto;
        max-width: none;
        margin-bottom: 8px;
    }

    .toast-header,
    .toast-body {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* Advanced Animations for Phase 3 */
@keyframes toast-slide-in-enhanced {
    0% {
        transform: translateX(100%) scale(0.95) rotateY(45deg);
        opacity: 0;
    }
    60% {
        transform: translateX(-5%) scale(1.02) rotateY(0deg);
    }
    100% {
        transform: translateX(0) scale(1) rotateY(0deg);
        opacity: 1;
    }
}

@keyframes toast-slide-out-enhanced {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateX(100%) scale(0.95);
        opacity: 0;
    }
}

@keyframes toast-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

@keyframes toast-priority-glow {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
    }
    50% {
        box-shadow: 0 6px 25px rgba(255, 107, 53, 0.6);
    }
}

/* Enhanced toast variants */
.toast.toast-priority {
    border-left: 5px solid #ff6b35;
    animation: toast-slide-in-enhanced 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55),
               toast-priority-glow 2s infinite ease-in-out;
    position: relative;
}

.toast.toast-priority::before {
    content: "⚡";
    position: absolute;
    left: -2px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    animation: toast-pulse 2s infinite;
    z-index: 1;
}

.toast.toast-persistent {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.toast.toast-persistent .btn-close {
    filter: brightness(0) invert(1);
}

.toast.toast-enhanced {
    animation: toast-slide-in-enhanced 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.toast-enhanced.hide {
    animation: toast-slide-out-enhanced 0.4s ease-in-out forwards;
}

/* Stacking effect enhancement */
.toast:nth-child(n+2) {
    transform: translateY(-2px) scale(0.98);
    opacity: 0.95;
}

.toast:nth-child(n+3) {
    transform: translateY(-4px) scale(0.96);
    opacity: 0.9;
}

/* Interaction enhancements */
.toast:hover {
    transform: translateY(-2px) scale(1.02);
    transition: all 0.2s ease;
}

.toast:hover .toast-progress {
    animation-play-state: paused;
}

/* Loading toast variant */
.toast.toast-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Smooth hover effects */
.toast:hover {
    transform: translateX(0) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Stacking effect for multiple toasts */
.toast-container .toast:nth-child(2) {
    transform: translateX(8px) scale(0.95);
    opacity: 0.8;
}

.toast-container .toast:nth-child(3) {
    transform: translateX(16px) scale(0.9);
    opacity: 0.6;
}

.toast-container .toast:nth-child(n+4) {
    display: none;
}