/* CSS Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: 210 100% 50%; /* #007BFF */
    --secondary-color: 220 13% 18%; /* #2C3E50 */
    --background: 210 11% 98%; /* #F8F9FA */
    --surface: 0 0% 100%; /* #FFFFFF */
    --text-primary: 220 13% 18%; /* #2C3E50 */
    --text-secondary: 220 9% 46%; /* #6C757D */
    --error: 354 70% 54%; /* #DC3545 */
    --success: 134 61% 41%; /* #28A745 */
    --warning: 45 100% 51%; /* #FFC107 */
    --border: 220 13% 91%; /* #E9ECEF */
    --shadow: 0 0% 0%; /* #000000 */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #101013 !important;
    color: hsl(var(--text-primary));
    line-height: 1.6;
    overflow-x: hidden;
}

html {
    background-color: #101013 !important;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #101013 !important;
}

/* Header styles */
.header {
    background: linear-gradient(135deg, hsl(var(--primary-color)), hsl(var(--secondary-color)));
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: 0 2px 10px hsla(var(--shadow), 0.1);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

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

.loading-overlay[style*="display: none"] {
    display: none !important;
}

.loading-spinner {
    text-align: center;
    padding: 2rem;
    background: hsl(var(--surface));
    border-radius: 12px;
    box-shadow: 0 10px 30px hsla(var(--shadow), 0.15);
    border: 1px solid hsl(var(--border));
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid hsl(var(--border));
    border-top: 4px solid hsl(var(--primary-color));
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: hsl(var(--text-secondary));
    font-size: 1.1rem;
}

/* Error message */
.error-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: hsl(var(--surface));
    border: 2px solid hsl(var(--error));
    border-radius: 12px;
    padding: 2rem;
    max-width: 90%;
    width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px hsla(var(--shadow), 0.2);
    z-index: 1001;
    transition: all 0.3s ease;
}

/* Enhanced error severity styling */
.error-message.severity-warning {
    border-color: hsl(var(--warning));
    background: linear-gradient(135deg, hsla(45, 100%, 51%, 0.05) 0%, hsl(var(--surface)) 100%);
}

.error-message.severity-error {
    border-color: hsl(var(--error));
    background: linear-gradient(135deg, hsla(354, 70%, 54%, 0.05) 0%, hsl(var(--surface)) 100%);
}

.error-message.severity-critical {
    border-color: #dc143c;
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.1) 0%, hsl(var(--surface)) 100%);
    box-shadow: 0 15px 40px hsla(354, 70%, 54%, 0.3);
}

.error-message.severity-success {
    border-color: hsl(var(--success));
    background: linear-gradient(135deg, hsla(134, 61%, 41%, 0.05) 0%, hsl(var(--surface)) 100%);
}

.error-content h3 {
    color: hsl(var(--error));
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.error-content p {
    color: hsl(var(--text-secondary));
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Enhanced recovery button styling */
.retry-button {
    background: hsl(var(--primary-color));
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0.25rem;
    position: relative;
    overflow: hidden;
}

.retry-button.primary {
    background: hsl(var(--primary-color));
    font-weight: 600;
}

.retry-button.secondary {
    background: hsl(var(--warning));
    color: #333;
}

.retry-button.tertiary {
    background: hsl(var(--error));
    color: white;
}

.retry-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px hsla(var(--shadow), 0.3);
}

.retry-button.primary:hover {
    background: hsl(var(--primary-color) / 0.9);
}

.retry-button.secondary:hover {
    background: hsl(var(--warning) / 0.9);
}

.retry-button.tertiary:hover {
    background: hsl(var(--error) / 0.9);
}

.retry-button:active {
    transform: translateY(0);
}

.retry-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Error actions container */
.error-actions {
    margin: 1.5rem 0 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

/* Error icon styling */
.error-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.severity-warning .error-icon {
    color: hsl(var(--warning));
}

.severity-error .error-icon {
    color: hsl(var(--error));
}

.severity-critical .error-icon {
    color: #dc143c;
}

.severity-success .error-icon {
    color: hsl(var(--success));
}

/* Error title styling based on severity */
.severity-warning #errorTitle {
    color: hsl(var(--warning));
}

.severity-error #errorTitle {
    color: hsl(var(--error));
}

.severity-critical #errorTitle {
    color: #dc143c;
}

.severity-success #errorTitle {
    color: hsl(var(--success));
}

/* Error details styling */
.error-details {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: hsl(var(--text-secondary));
    border-top: 1px solid hsl(var(--border));
    padding-top: 1rem;
}

.error-timestamp {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: hsl(var(--background));
    border-radius: 4px;
}

/* Map container */
.map-container {
    position: relative;
    height: 90vh;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    border: none;
    background-color: #101013;
}

.map {
    width: 100%;
    height: 100%;
}

/* Controls info */
.controls-info {
    background: hsl(var(--surface));
    margin: 0 1rem 1rem;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid hsl(var(--border));
    box-shadow: 0 2px 8px hsla(var(--shadow), 0.1);
}

.control-item {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: hsl(var(--text-secondary));
}

.control-item:last-child {
    margin-bottom: 0;
}

.control-item strong {
    color: hsl(var(--text-primary));
}

/* Data info panel */
.data-info {
    position: absolute;
    top: 20px;
    right: 20px;
    background: hsla(var(--surface), 0.95);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid hsl(var(--border));
    box-shadow: 0 4px 15px hsla(var(--shadow), 0.15);
    max-width: 250px;
    backdrop-filter: blur(10px);
    z-index: 100;
}

.data-info h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: hsl(var(--text-primary));
}

.data-info .stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.data-info .stat-label {
    color: hsl(var(--text-secondary));
}

.data-info .stat-value {
    font-weight: 600;
    color: hsl(var(--text-primary));
}

/* Utility classes */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .header {
        padding: 1.5rem 1rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .map-container {
        margin: 0.5rem;
        min-height: 600px;
    }
    
    .map {
        min-height: 600px;
    }
    
    .controls-info {
        margin: 0 0.5rem 0.5rem;
        padding: 0.75rem;
    }
    
    .data-info {
        position: relative;
        top: auto;
        right: auto;
        margin: 0.5rem;
        max-width: none;
    }
    
    .error-message {
        width: 95%;
        padding: 1.5rem;
    }
    

}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.75rem;
    }
    
    .control-item {
        font-size: 0.8rem;
    }
    
    .map-container {
        min-height: 500px;
    }
    
    .map {
        min-height: 500px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border: 220 13% 70%;
        --text-secondary: 220 13% 30%;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation: none;
    }
    
    .retry-button {
        transition: none;
    }
    
    * {
        transition: none !important;
        animation: none !important;
    }
}
