/* Enhanced Features CSS */

/* PWA Install Button */
.pwa-install-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
    display: none;
}

.pwa-install-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.pwa-install-button.show {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.toast {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #3b82f6;
    pointer-events: auto;
    transform: translateX(100%);
    transition: all 0.3s ease;
    opacity: 0;
}

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

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

.toast.error {
    border-left-color: #ef4444;
}

.toast.warning {
    border-left-color: #f59e0b;
}

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

.toast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.toast-title {
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
}

.toast-close {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    font-size: 16px;
}

.toast-message {
    color: #6b7280;
    font-size: 13px;
    line-height: 1.4;
}

/* Dark mode toast styles */
.dark .toast {
    background: #374151;
    color: white;
}

.dark .toast-title {
    color: #f9fafb;
}

.dark .toast-message {
    color: #d1d5db;
}

.dark .toast-close {
    color: #9ca3af;
}

/* Export Modal */
.export-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.export-modal.show {
    opacity: 1;
    visibility: visible;
}

.export-modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.export-modal.show .export-modal-content {
    transform: scale(1);
}

.dark .export-modal-content {
    background: #1f2937;
    color: white;
}

/* Theme Selector */
.theme-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.theme-option {
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.theme-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.theme-option.active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.theme-preview {
    width: 100%;
    height: 60px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    overflow: hidden;
}

.theme-preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.theme-preview-header {
    height: 20px;
}

.theme-preview-body {
    flex: 1;
}

.theme-preview-sidebar {
    width: 30%;
}

/* Advanced Chart Controls */
.chart-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.chart-control-button {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.chart-control-button:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.chart-control-button.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.dark .chart-control-button {
    background: #374151;
    color: #d1d5db;
    border-color: #4b5563;
}

.dark .chart-control-button:hover {
    background: #4b5563;
    border-color: #6b7280;
}

/* Loading Enhancements */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-logo {
    font-size: 4rem;
    margin-bottom: 2rem;
    animation: pulse 2s infinite;
}

.loading-progress {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin: 2rem auto;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #34d399);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.loading-status {
    font-size: 1.1rem;
    margin-top: 1rem;
    opacity: 0.9;
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .toast-container {
        left: 20px;
        right: 20px;
        max-width: none;
    }
    
    .pwa-install-button {
        bottom: 80px;
        right: 20px;
    }
    
    .export-modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
    
    .theme-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-controls {
        justify-content: center;
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    .toast,
    .export-modal,
    .export-modal-content,
    .theme-option,
    .chart-control-button,
    .pwa-install-button {
        transition: none;
    }
    
    .loading-logo {
        animation: none;
    }
}

/* Focus styles for accessibility */
.toast-close:focus,
.chart-control-button:focus,
.theme-option:focus,
.pwa-install-button:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .toast {
        border: 2px solid currentColor;
    }
    
    .theme-option {
        border: 2px solid currentColor;
    }
    
    .chart-control-button {
        border: 2px solid currentColor;
    }
}