/* Modern Toast Notification System */
/* Responsive design for mobile and desktop */

.toast-container {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    max-width: 100vw;
    padding: 1rem;
}

/* Desktop positioning - top right */
@media (min-width: 768px) {
    .toast-container {
        top: 1rem;
        right: 1rem;
        max-width: 420px;
    }
}

/* Mobile positioning - top center, full width */
@media (max-width: 767px) {
    .toast-container {
        top: 1rem;
        left: 1rem;
        right: 1rem;
        max-width: calc(100vw - 2rem);
    }
}

.modern-toast {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 0.75rem;
    overflow: hidden;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 100%;
    word-wrap: break-word;
}

/* Mobile toast adjustments */
@media (max-width: 767px) {
    .modern-toast {
        transform: translateY(-100%);
        margin-bottom: 0.5rem;
    }
    
    .modern-toast.show {
        transform: translateY(0);
    }
}

.modern-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.modern-toast.hiding {
    transform: translateX(100%);
    opacity: 0;
}

@media (max-width: 767px) {
    .modern-toast.hiding {
        transform: translateY(-100%);
    }
}

.toast-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 600;
    font-size: 0.9rem;
}

.toast-body {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #374151;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    margin-left: auto;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #374151;
}

.toast-icon {
    margin-right: 0.5rem;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.toast-title {
    flex: 1;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Toast type styles */
.modern-toast.success {
    border-left: 4px solid #10b981;
}

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

.modern-toast.success .toast-header {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
}

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

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

.modern-toast.error .toast-header {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
}

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

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

.modern-toast.warning .toast-header {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
}

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

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

.modern-toast.info .toast-header {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .modern-toast {
        background: rgba(31, 41, 55, 0.95);
        border: 1px solid rgba(75, 85, 99, 0.3);
        color: #f9fafb;
    }
    
    .toast-body {
        color: #e5e7eb;
    }
    
    .toast-header {
        border-bottom: 1px solid rgba(75, 85, 99, 0.2);
    }
    
    .toast-close {
        color: #9ca3af;
    }
    
    .toast-close:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: #f9fafb;
    }
    
    .modern-toast.success .toast-header {
        background: linear-gradient(90deg, rgba(16, 185, 129, 0.1) 0%, rgba(31, 41, 55, 0) 100%);
    }
    
    .modern-toast.error .toast-header {
        background: linear-gradient(90deg, rgba(239, 68, 68, 0.1) 0%, rgba(31, 41, 55, 0) 100%);
    }
    
    .modern-toast.warning .toast-header {
        background: linear-gradient(90deg, rgba(245, 158, 11, 0.1) 0%, rgba(31, 41, 55, 0) 100%);
    }
    
    .modern-toast.info .toast-header {
        background: linear-gradient(90deg, rgba(59, 130, 246, 0.1) 0%, rgba(31, 41, 55, 0) 100%);
    }
}

/* Progress bar for auto-dismiss */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    transition: width linear;
}

.modern-toast.success .toast-progress {
    background: #10b981;
}

.modern-toast.error .toast-progress {
    background: #ef4444;
}

.modern-toast.warning .toast-progress {
    background: #f59e0b;
}

.modern-toast.info .toast-progress {
    background: #3b82f6;
}

/* Action buttons in toasts */
.toast-actions {
    padding: 0 1rem 0.75rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.toast-action-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    border: 1px solid currentColor;
    background: transparent;
    color: currentColor;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.toast-action-btn:hover {
    background: currentColor;
    color: white;
}

.modern-toast.success .toast-action-btn {
    color: #10b981;
}

.modern-toast.error .toast-action-btn {
    color: #ef4444;
}

.modern-toast.warning .toast-action-btn {
    color: #f59e0b;
}

.modern-toast.info .toast-action-btn {
    color: #3b82f6;
}

/* Animation keyframes */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Accessibility improvements */
.modern-toast:focus-within {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .modern-toast {
        transition: opacity 0.2s ease;
    }
    
    .modern-toast.show {
        transform: none;
    }
    
    .modern-toast.hiding {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .modern-toast {
        border: 2px solid;
        background: white;
    }
    
    .modern-toast.success {
        border-color: #10b981;
    }
    
    .modern-toast.error {
        border-color: #ef4444;
    }
    
    .modern-toast.warning {
        border-color: #f59e0b;
    }
    
    .modern-toast.info {
        border-color: #3b82f6;
    }
}
