/**
 * Error Handler & Toast Notification Styles
 * Provides visual styling for error messages, toasts, and loading indicators
 */

/* Toast Container */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

/* Individual Toast */
.toast {
    background: var(--bg-secondary, #2a2a2a);
    color: var(--text-primary, #e0e0e0);
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    pointer-events: auto;
    border-left: 4px solid var(--accent-color, #d4af37);
}

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

/* Toast Types */
.toast-error {
    border-left-color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.toast-success {
    border-left-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.toast-warning {
    border-left-color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
}

.toast-info {
    border-left-color: #17a2b8;
    background: rgba(23, 162, 184, 0.1);
}

/* Toast Icon */
.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

/* Toast Message */
.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Toast Close Button */
.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary, #999);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #e0e0e0);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    background: var(--bg-secondary, #2a2a2a);
    border-radius: 12px;
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* Spinner Animation */
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(212, 175, 55, 0.2);
    border-top-color: var(--accent-color, #d4af37);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-message {
    color: var(--text-primary, #e0e0e0);
    font-size: 16px;
    font-weight: 500;
}

/* Light Theme Overrides */
body.light-theme .toast {
    background: #ffffff;
    color: #333333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body.light-theme .toast-error {
    background: rgba(220, 53, 69, 0.05);
}

body.light-theme .toast-success {
    background: rgba(40, 167, 69, 0.05);
}

body.light-theme .toast-warning {
    background: rgba(255, 193, 7, 0.05);
}

body.light-theme .toast-info {
    background: rgba(23, 162, 184, 0.05);
}

body.light-theme .toast-close {
    color: #666;
}

body.light-theme .toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

body.light-theme .loading-spinner {
    background: #ffffff;
}

body.light-theme .loading-message {
    color: #333333;
}

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

    .toast {
        min-width: auto;
        max-width: none;
    }
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    .toast {
        transition: opacity 0.1s;
        transform: none;
    }

    .toast.toast-show {
        transform: none;
    }

    .spinner {
        animation: none;
        border-top-color: transparent;
        border-right-color: var(--accent-color, #d4af37);
    }
}
