/* Main Application Styles */


/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Sidebar Toggle */
.sidebar-toggle {
    position: fixed;
    top: var(--space-4);
    left: var(--space-4);
    z-index: 50;
    width: 48px;
    height: 48px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

/* Ensure sidebar toggle doesn't interfere with 3D filters */
.sidebar-toggle i {
    color: var(--text-primary);
}


.sidebar-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    transform: scale(1.05);
}

/* Sidebar */
.sidebar {
    width: 350px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.3s ease;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transform: translateX(-100%);
}

.sidebar.closed {
    transform: translateX(-100%);
}

.sidebar.open {
    transform: translateX(0);
}

/* Sidebar starts closed by default - handled above */

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile sidebar close button */
@media (max-width: 768px) {
    .sidebar-close {
        display: flex;
    }
}

.sidebar-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    transition: all 0.3s ease;
}

.sidebar-close:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.sidebar-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.sidebar-header h1 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-header p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Control Panel */
.control-panel {
    flex: 1;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.control-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

.control-section h3 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Controls */
.control-select {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    cursor: pointer;
}

.control-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(237, 137, 54, 0.1);
}

/* Parameter Groups */
.parameter-group {
    margin-bottom: var(--space-4);
}

.parameter-group:last-child {
    margin-bottom: 0;
}

.parameter-group label {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    font-weight: 500;
}

/* Text Input */
.text-input {
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    transition: all 0.3s ease;
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.text-input::placeholder {
    color: var(--text-muted);
}

.input-help {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

/* Sliders */
.slider-container {
    position: relative;
    margin: var(--space-3) 0;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #f6ad55;
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-md);
}

.slider-value {
    position: absolute;
    right: 0;
    top: -25px;
    font-size: var(--font-size-xs);
    color: var(--accent-color);
    font-weight: 600;
    background: var(--bg-primary);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

/* All Sliders - Progress Effect */
#asteroid-size, #asteroid-velocity, #impact-angle, #action-time {
    background: linear-gradient(to right, var(--accent-color) 0%, var(--accent-color) 0%, var(--bg-tertiary) 0%, var(--bg-tertiary) 100%);
}

#asteroid-size::-webkit-slider-thumb,
#asteroid-velocity::-webkit-slider-thumb,
#impact-angle::-webkit-slider-thumb,
#action-time::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: 2px solid var(--bg-primary);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

#asteroid-size::-webkit-slider-thumb:hover,
#asteroid-velocity::-webkit-slider-thumb:hover,
#impact-angle::-webkit-slider-thumb:hover,
#action-time::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #f6ad55;
}

#asteroid-size::-moz-range-thumb,
#asteroid-velocity::-moz-range-thumb,
#impact-angle::-moz-range-thumb,
#action-time::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: 2px solid var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

/* Strategy Options */
.strategy-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
}

.strategy-option {
    position: relative;
    cursor: pointer;
}

.strategy-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.strategy-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    text-align: center;
    gap: var(--space-2);
    font-size: var(--font-size-xs);
}

.strategy-label:hover {
    border-color: var(--accent-color);
    background: var(--bg-tertiary);
}

.strategy-option input[type="radio"]:checked + .strategy-label {
    border-color: var(--accent-color);
    background: var(--accent-color);
    color: white;
}

.strategy-label i {
    font-size: var(--font-size-lg);
}

/* View Controls */
.view-controls {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.view-btn {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.view-btn:hover {
    border-color: var(--accent-color);
    color: var(--text-primary);
}

.view-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}


/* Main Viewport */
.main-viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
    width: 100%;
    transition: width 0.3s ease;
}

/* When sidebar is closed, main viewport takes full width */
.sidebar.closed ~ .main-viewport {
    width: 100%;
    margin-left: 0;
}

/* When sidebar is open, main viewport stays full width but sidebar overlays */
.sidebar.open ~ .main-viewport {
    width: 100%;
    margin-left: 0;
}

/* View Controls Top */
.view-controls-top {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-4);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    justify-content: center;
}

.view-controls-top .view-btn {
    padding: var(--space-3) var(--space-6);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.view-controls-top .view-btn:hover {
    border-color: var(--accent-color);
    color: var(--text-primary);
}

.view-controls-top .view-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

/* Viewport Containers */
.viewport-container {
    flex: 1;
    display: none;
    position: relative;
    min-height: auto;
    overflow-y: auto;
}

/* Specific viewport definitions */
.viewport-container.active {
    display: block;
}

/* 3D Viewport */
#viewport-3d {
    background: var(--space-bg);
    min-height: 400px;
    height: 100%;
    position: relative;
    z-index: 1;
    display: none; /* Hidden by default */
}

/* Show 3D viewport when active */
#viewport-3d.active {
    display: block;
}

#orbit-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    min-height: 400px;
    background: #000011;
    position: relative;
    z-index: 1;
    border-radius: var(--radius-lg);
    overflow: hidden;
    outline: none;
    border: 2px solid red !important; /* Debug border */
}

/* Ensure canvas is visible */
#orbit-canvas canvas {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    outline: none;
    border: 2px solid blue !important; /* Debug border */
    background: #ff0000 !important; /* Debug background */
}

/* Placeholder content removed - Three.js canvas is back */

/* Viewport Overlay */
.viewport-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.info-panel {
    position: absolute;
    top: var(--space-4);
    left: var(--space-4);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-lg);
}

.info-item {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    font-size: var(--font-size-sm);
}

.info-label {
    color: var(--text-secondary);
    font-weight: 500;
}

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

/* 2D Impact Map */
#viewport-2d {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    position: relative;
}

/* Removed duplicate #viewport-2d.active definition */

.impact-map-2d {
    display: flex;
    flex-direction: column;
}

#viewport-2d.active .impact-map-2d {
    flex: 1;
    overflow-y: auto;
}

.leaflet-container {
    width: 100%;
    height: 80vh;
    border-radius: var(--radius-lg);
}

#viewport-2d.active .leaflet-container {
    height: 60vh;
    flex-shrink: 0;
}


/* Map Controls */
.map-controls {
    position: fixed;
    top: calc(var(--space-4) + 70px); /* Below view controls */
    right: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    z-index: 400;
}

.map-control-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
}

.map-control-btn:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: scale(1.05);
}

/* Map Legend */
.map-legend-2d {
    position: absolute;
    bottom: var(--space-4);
    right: var(--space-4);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    display: block;
    min-width: 150px;
    max-width: 200px;
    pointer-events: auto;
}

.map-legend-2d h4 {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    align-items: stretch;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    transition: all 0.3s ease;
    border-radius: var(--radius-sm);
    padding: var(--space-1);
    white-space: nowrap;
}

.legend-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.02);
}

.legend-item.active-filter {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-primary);
    font-weight: 600;
}

.legend-item.active-filter .legend-color {
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    transform: scale(1.1);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
    display: inline-block;
}

.legend-color.impact {
    background: var(--danger-color);
}

.legend-color.blast {
    background: var(--warning-color);
}

.legend-color.seismic {
    background: var(--accent-color);
}

.legend-color.tsunami {
    background: #3b82f6;
}

.sun {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, #fbbf24, #f59e0b);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 30px #f59e0b;
    z-index: 10;
}

.orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.orbit-mercury {
    width: 120px;
    height: 120px;
}

.orbit-venus {
    width: 180px;
    height: 180px;
}

.orbit-earth {
    width: 240px;
    height: 240px;
}

.orbit-mars {
    width: 300px;
    height: 300px;
}

.planet {
    position: absolute;
    border-radius: 50%;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.mercury {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    top: -4px;
}

.venus {
    width: 12px;
    height: 12px;
    background: #fbbf24;
    top: -6px;
}

.earth {
    width: 14px;
    height: 14px;
    background: #3b82f6;
    top: -7px;
}

.moon {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #e5e7eb;
    border-radius: 50%;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.mars {
    width: 10px;
    height: 10px;
    background: #ef4444;
    top: -5px;
}

.asteroid-trail-2d {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 400px;
    height: 400px;
    border: 2px dashed var(--accent-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: orbit-2d 20s linear infinite;
}

.asteroid-2d {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px var(--accent-color);
}

@keyframes orbit-2d {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Statistics Panel */
.stats-panel {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: var(--space-4);
    max-height: 300px;
    overflow-y: auto;
}

.stats-panel h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
    display: flex;
    padding: 20px;
    align-items: center;
    gap: var(--space-2);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.stat-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-color);
    color: var(--space-dark);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.stat-label {
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

.stat-description {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* Impact Map Container */
.impact-map-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-3);
}

.impact-map-container h4 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.impact-map {
    height: 150px;
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.impact-point {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.impact-center {
    width: 12px;
    height: 12px;
    background: var(--danger-color);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--danger-color);
    animation: pulse 2s infinite;
}

.impact-ring {
    position: absolute;
    top: -25px;
    left: -25px;
    width: 50px;
    height: 50px;
    border: 2px solid var(--danger-color);
    border-radius: 50%;
    animation: expand 3s infinite;
}

.seismic-waves {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.wave {
    position: absolute;
    border: 2px solid rgba(251, 191, 36, 0.6);
    border-radius: 50%;
    animation: seismic-wave 4s infinite;
}

.wave-1 {
    width: 40px;
    height: 40px;
    top: -20px;
    left: -20px;
    animation-delay: 0s;
}

.wave-2 {
    width: 70px;
    height: 70px;
    top: -35px;
    left: -35px;
    animation-delay: 1s;
}

.wave-3 {
    width: 100px;
    height: 100px;
    top: -50px;
    left: -50px;
    animation-delay: 2s;
}

.tsunami-zone {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(to top, rgba(59, 130, 246, 0.8), rgba(59, 130, 246, 0.2));
    animation: tsunami 3s infinite;
}

.map-legend {
    position: absolute;
    bottom: var(--space-2);
    right: var(--space-2);
    background: rgba(26, 32, 44, 0.9);
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}


/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

@keyframes expand {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

@keyframes seismic-wave {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

@keyframes tsunami {
    0%, 100% { height: 30px; }
    50% { height: 60px; }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .sidebar {
        width: 300px;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 50vh;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 100;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateY(0);
    }
    
    .sidebar.closed {
        transform: translateY(-100%);
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .stats-panel-2d .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1.2rem;
    
        padding: var(--spacing-md);
    }
    
    .strategy-options {
        grid-template-columns: 1fr;
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 14, 26, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(10px);
}

.loading-content {
    text-align: center;
    color: var(--text-primary);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-tertiary);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-4);
}

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

/* Notifications */
.notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    border: 2px solid transparent;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1500;
    max-width: 650px;
    text-align: center;
    line-height: 1.6;
    white-space: pre-line;
    backdrop-filter: blur(10px);
}

.notification.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.notification.hide {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
}

.notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    transform: scale(1.1);
}

.notification-success {
    border: 2px solid #16a34a;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #ffffff;
    box-shadow: 0 20px 40px rgba(22, 163, 74, 0.4), 0 0 0 1px rgba(22, 163, 74, 0.5);
}

.notification-error {
    border: 2px solid #dc2626;
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    color: #ffffff;
    box-shadow: 0 20px 40px rgba(220, 38, 38, 0.3), 0 0 0 1px rgba(220, 38, 38, 0.4);
}

.notification-info {
    border: 2px solid #2563eb;
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    color: #ffffff;
    box-shadow: 0 20px 40px rgba(37, 99, 235, 0.3), 0 0 0 1px rgba(37, 99, 235, 0.4);
}

.notification-warning {
    border: 2px solid #d97706;
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    color: #ffffff;
    box-shadow: 0 20px 40px rgba(217, 119, 6, 0.3), 0 0 0 1px rgba(217, 119, 6, 0.4);
}

.notification i {
    font-size: 24px;
    margin-right: 8px;
    flex-shrink: 0;
}

.notification-success i {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.notification-error i {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.notification-info i {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.notification-warning i {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* Camera Controls */
.camera-controls {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.camera-btn {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
}

.camera-btn:hover {
    border-color: var(--accent-color);
    color: var(--text-primary);
}

.camera-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--space-dark);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Main Viewport */
.main-viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
    width: 100%;
    transition: width 0.3s ease;
}

/* When sidebar is closed, main viewport takes full width */
.sidebar.closed ~ .main-viewport {
    width: 100%;
    margin-left: 0;
}

/* When sidebar is open, main viewport stays full width but sidebar overlays */
.sidebar.open ~ .main-viewport {
    width: 100%;
    margin-left: 0;
}

/* Viewport Container */
.viewport-container {
    flex: 1;
    display: none;
    position: relative;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* Removed duplicate viewport-container.active definition */

/* 3D Viewport specific styles moved to main definition above */

/* 2D Viewport specific */
#viewport-2d.active {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

/* 3D Canvas Styles */

#leaflet-map {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border-radius: var(--radius-lg);
    position: relative;
    z-index: 1;
}

.leaflet-container {
    width: 100%;
    height: 100%;
    min-height: 400px;
}

/* Map Markers */
.ny-marker {
    background: transparent;
    border: none;
}

.ny-marker-inner {
    background: #2563eb;
    color: white;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.impact-marker {
    background: transparent;
    border: none;
}

.impact-marker-inner {
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    animation: pulse 2s infinite;
}

/* Location Marker */
.location-marker {
    background: transparent;
    border: none;
}

.location-marker-inner {
    background: #2563eb;
    color: white;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Impact Circles - Perfect Round */
.impact-circle {
    border-radius: 50% !important;
    shape-rendering: geometricPrecision;
}

.impact-circle path {
    border-radius: 50% !important;
    shape-rendering: geometricPrecision;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Impact Popup Styles */
.impact-popup {
    min-width: 300px;
    max-width: 400px;
}

.impact-popup h4 {
    color: var(--accent-color);
    margin-bottom: var(--space-3);
    font-size: var(--font-size-lg);
}

.impact-details {
    margin-bottom: var(--space-4);
}

.impact-details p {
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

.impact-details strong {
    color: var(--text-primary);
    font-weight: 600;
}

.impact-popup button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
}

.impact-popup button:hover {
    background: #1e40af;
    transform: translateY(-1px);
}

.impact-popup .info-text {
    background: var(--bg-secondary);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    text-align: center;
    margin-top: var(--space-3);
    border-left: 3px solid var(--accent-color);
}

/* Location Popup Styles */
.location-popup {
    min-width: 320px;
    max-width: 420px;
}

.popup-actions {
    margin-top: var(--space-4);
    text-align: center;
}

.btn-simulate-popup {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    border: none;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(30,58,138,0.3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0 auto;
}

.btn-simulate-popup:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30,58,138,0.4);
    background: linear-gradient(135deg, #3b82f6 0%, #1e3a8a 100%);
}

.btn-simulate-popup i {
    font-size: var(--font-size-sm);
}

/* Asteroid Trajectory Styles */
.asteroid-trajectory {
    stroke-dasharray: 20 10 !important;
    animation: dash 2s linear infinite !important;
    stroke-width: 6px !important;
    stroke: #ff6b35 !important;
    opacity: 0.9 !important;
}

@keyframes dash {
    0% {
        stroke-dashoffset: 0;
    }
    100% {
        stroke-dashoffset: -30;
    }
}

.trajectory-arrow {
    background: transparent !important;
    border: none !important;
}

.trajectory-arrow-inner {
    background: #ff6b35;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
    animation: pulse 2s infinite;
}

.trajectory-start {
    background: transparent !important;
    border: none !important;
}

.trajectory-start-inner {
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    animation: pulse 2s infinite;
}

.trajectory-impact {
    background: transparent !important;
    border: none !important;
}

.trajectory-impact-inner {
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.location-popup h4 {
    color: var(--accent-color);
    margin-bottom: var(--space-3);
    font-size: var(--font-size-lg);
    text-align: center;
}

.location-details {
    background: var(--bg-secondary);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
}

.location-details p {
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

.location-details strong {
    color: var(--text-primary);
    font-weight: 600;
}

.risk-level {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
}

.risk-level.critical {
    background: #ef4444;
    color: white;
}

.risk-level.high {
    background: #f97316;
    color: white;
}

.risk-level.medium {
    background: #eab308;
    color: white;
}

.risk-level.low {
    background: #22c55e;
    color: white;
}

.risk-level.unknown {
    background: var(--text-secondary);
    color: white;
}

.impact-simulation {
    margin-bottom: var(--space-4);
}

.impact-simulation h5 {
    color: var(--accent-color);
    margin-bottom: var(--space-2);
    font-size: var(--font-size-md);
}

.simulation-details {
    background: var(--bg-tertiary);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent-color);
}

.simulation-details p {
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
}

.defense-strategies h5 {
    color: var(--accent-color);
    margin-bottom: var(--space-3);
    font-size: var(--font-size-md);
}

.strategy-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.strategy-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.strategy-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.strategy-btn.evacuation {
    background: #22c55e;
    color: white;
}

.strategy-btn.deflection {
    background: #3b82f6;
    color: white;
}

.strategy-btn.nuclear {
    background: #ef4444;
    color: white;
}

.strategy-btn.shelter {
    background: #8b5cf6;
    color: white;
}

.strategy-btn.early_warning {
    background: #f59e0b;
    color: white;
}

/* NY Popup Styles */
.ny-popup {
    text-align: center;
}

.ny-popup h4 {
    color: var(--accent-color);
    margin-bottom: var(--space-2);
}

/* Defense Strategies Vertical Layout */
.defense-strategies-vertical {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.defense-strategy-btn {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
}

.defense-strategy-btn:hover {
    border-color: var(--accent-color);
    background: var(--bg-tertiary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.defense-strategy-btn.active {
    border-color: var(--accent-color);
    background: var(--accent-color);
    color: white;
}

.defense-strategy-btn i {
    font-size: var(--font-size-lg);
    width: 24px;
    text-align: center;
}

.defense-strategy-btn.kinetic i {
    color: #3b82f6;
}

.defense-strategy-btn.gravity i {
    color: #8b5cf6;
}

.defense-strategy-btn.active i {
    color: white;
}

.strategy-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.strategy-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.defense-strategy-btn.active .strategy-name {
    color: white;
}

.strategy-desc {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.defense-strategy-btn.active .strategy-desc {
    color: rgba(255, 255, 255, 0.8);
}


.ny-popup p {
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Planet Labels */
.planet-label {
    position: absolute;
    color: #FFF;
    font-family: 'Arial', sans-serif;
    font-size: 14px;
    font-weight: bold;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
    user-select: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    transition: opacity 0.2s ease;
}

.planet-label:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* 3D Filters */
.filters-3d {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 100;
    min-width: 200px;
}

.filter-group {
    margin-bottom: 12px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.filter-group label:last-child {
    margin-bottom: 0;
}

.filter-group input[type="checkbox"] {
    margin-right: 8px;
    accent-color: var(--accent-primary);
}

.filter-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    margin-right: 8px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.filter-btn i,
.filter-btn .fas,
.filter-btn .far,
.filter-btn .fab {
    color: white !important;
}

.filter-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
}

.filter-btn:active {
    transform: translateY(0);
}

.zoom-slider {
    width: 100%;
    margin: 8px 0;
    accent-color: var(--accent-primary);
}

#zoom-value {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Statistics Panel for 2D View Only */
.stats-panel-2d {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    width: calc(100% - 2 * var(--spacing-lg));
    display: flex;
    padding: 20px;
    gap: 1.2rem;
    flex-direction: column;
    flex-shrink: 0;
    min-height: 300px;
}

.stats-panel-2d h3 {
    margin: 0 0 var(--spacing-md) 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--space-4) var(--space-6);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(255,255,255,0.02) 100%);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stats-panel-2d .stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.2rem;
    margin-top: var(--spacing-lg);
    padding: var(--spacing-lg);
    align-items: start;
    width: 100%;
}

.stats-panel-2d .stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: space-between;
    min-height: 120px;
    gap: var(--space-2);
}

.stats-panel-2d .stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stats-panel-2d .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 4px 8px rgba(30, 58, 138, 0.3);
    flex-shrink: 0;
    margin-bottom: var(--spacing-sm);
}

.stats-panel-2d .stat-icon i,
.stats-panel-2d .stat-icon .fas,
.stats-panel-2d .stat-icon .far,
.stats-panel-2d .stat-icon .fab {
    color: white !important;
}

.stats-panel-2d .stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin: 0;
    line-height: 1.2;
    text-align: center;
}

.stats-panel-2d .stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.3;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stats-panel-2d .stat-description {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.8;
    line-height: 1.2;
    margin-top: auto;
}

/* Leaflet Marker Styles */
.impact-marker {
    background: #ef4444;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.8);
    animation: pulse 2s infinite;
}

.marker-pulse {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.3);
    animation: markerPulse 2s infinite;
}

.marker-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
}


.custom-marker {
    background: #3b82f6;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.8);
}

.custom-marker-pulse {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.3);
    animation: markerPulse 1.5s infinite;
}

.custom-marker-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
}

.custom-marker-label {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
}

/* Marker Animations */
@keyframes markerPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Popup Styles */
.marker-popup {
    font-family: var(--font-family);
    min-width: 200px;
}

.marker-popup.detailed {
    min-width: 280px;
    max-width: 300px;
    padding: 0;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--accent-primary);
}

.popup-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.popup-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.marker-popup h4 {
    margin: 0;
    color: var(--accent-primary);
    font-size: 14px;
    font-weight: 600;
}

.marker-popup h5 {
    margin: 0 0 6px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.marker-popup h5 i {
    color: var(--accent-primary);
    width: 12px;
    text-align: center;
    font-size: 11px;
}

.marker-popup p {
    margin: 3px 0;
    font-size: 11px;
    color: var(--text-primary);
    line-height: 1.3;
}

.impact-data-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0;
}

.impact-section {
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 8px;
    border-left: 3px solid var(--accent-primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.impact-section:nth-child(1) {
    border-left-color: #ef4444; /* Red for blast */
}

.impact-section:nth-child(2) {
    border-left-color: #f59e0b; /* Orange for seismic */
}

.impact-section:nth-child(3) {
    border-left-color: #3b82f6; /* Blue for tsunami */
}

.coordinates-info {
    margin-top: 8px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    font-size: 10px;
    color: var(--text-secondary);
    text-align: center;
    border: 1px solid var(--border-color);
}

.risk-level {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
}

.risk-level.high {
    background: #fee2e2;
    color: #dc2626;
}

.risk-level.medium {
    background: #fef3c7;
    color: #d97706;
}

.risk-level.low {
    background: #d1fae5;
    color: #059669;
}

/* Configuration Modal */
.config-form {
    padding: var(--space-4);
    background: var(--bg-primary);
}

.form-group {
    margin-bottom: var(--space-6);
    background: var(--bg-secondary);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-3);
    color: var(--text-primary);
    font-weight: 600;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Config Modal Sliders */
#config-asteroid-size, #config-asteroid-velocity {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    margin: var(--space-3) 0;
    border: 1px solid var(--border-color);
}

#config-asteroid-size::-webkit-slider-thumb,
#config-asteroid-velocity::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s ease;
    border: 3px solid white;
}

#config-asteroid-size::-webkit-slider-thumb:hover,
#config-asteroid-velocity::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #f6ad55;
}

#config-asteroid-size::-moz-range-thumb,
#config-asteroid-velocity::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-md);
}

/* Config Modal Slider Values */
.slider-display-value {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    font-weight: 700;
    color: var(--accent-color);
    font-size: var(--font-size-sm);
    background: var(--bg-primary);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    pointer-events: none;
    z-index: 10;
    min-width: 60px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#config-size-value, #config-velocity-value {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    font-weight: 700;
    color: var(--accent-color);
    font-size: var(--font-size-sm);
    background: var(--bg-primary);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    pointer-events: none;
    z-index: 10;
    min-width: 60px;
    text-align: center;
}

.slider-value {
    text-align: center;
    margin-top: var(--space-2);
    font-weight: 700;
    color: var(--accent-color);
    font-size: var(--font-size-base);
}

/* Specific styling for config modal slider values */
.config-form .slider-value {
    background: linear-gradient(135deg, var(--accent-color), #f6ad55);
    color: white !important;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border: 2px solid var(--accent-color);
    font-size: var(--font-size-lg);
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    box-shadow: 0 4px 12px rgba(237, 137, 54, 0.4);
    margin-top: var(--space-3);
}

.fixed-value {
    text-align: center;
    margin-top: var(--space-3);
    padding: var(--space-4);
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    border-radius: var(--radius-md);
    border: 2px solid #1e3a8a;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.4);
}

.fixed-value-display {
    font-weight: 800;
    color: white;
    font-size: var(--font-size-lg);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Simulation Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 15000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-6);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* Loading Container */
.loading-container {
    text-align: center;
    padding: var(--space-8);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-tertiary);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-4);
}

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

.loading-container p {
    color: var(--text-secondary);
    margin: 0;
}

/* Simulation Results */
.simulation-results {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.location-info {
    text-align: center;
    padding: var(--space-6);
    background: #1e3a8a;
    border-radius: var(--radius-lg);
    border: 2px solid #1e3a8a;
    margin-bottom: var(--space-6);
    box-shadow: 0 4px 12px rgba(30,58,138,0.3);
}

.location-info h4 {
    color: #ffffff;
    margin: 0 0 var(--space-3);
    font-size: var(--font-size-xl);
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.location-info p {
    color: #ffffff;
    margin: 0;
    font-size: var(--font-size-base);
    font-weight: 500;
    opacity: 0.9;
}

.impact-effects, .terrain-info, .location-statistics {
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(255,255,255,0.02) 100%);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: var(--space-4);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.impact-effects h5, .terrain-info h5, .location-statistics h5 {
    color: var(--accent-color);
    margin: 0 0 var(--space-5);
    font-size: var(--font-size-base);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: var(--space-2);
}

.impact-params, .effects-grid, .terrain-details, .stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.param-item, .effect-item, .terrain-item, .stat-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: var(--space-4) var(--space-3);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.2s ease;
    gap: var(--space-2);
}

.param-item:hover, .effect-item:hover, .terrain-item:hover, .stat-item:hover {
    background: rgba(255,255,255,0.06);
    transform: translateY(-1px);
}

.param-item:last-child, .effect-item:last-child, .terrain-item:last-child, .stat-item:last-child {
    border-bottom: none;
}

.param-label, .effect-label, .terrain-label, .stat-label {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.param-value, .effect-value, .terrain-value, .stat-value {
    color: var(--text-primary);
    font-weight: 700;
    font-size: var(--font-size-base);
    text-align: right;
}

.stat-value.risk-critical {
    color: #dc2626;
}

.stat-value.risk-high {
    color: #ea580c;
}

.stat-value.risk-medium {
    color: #d97706;
}

.stat-value.risk-low {
    color: #059669;
}

/* 3D Controls */
#3d-controls {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-md);
}

#3d-controls h3 {
    color: var(--accent-color);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-lg);
    font-weight: 600;
}

#3d-filters-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.filter-group {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    transition: all 0.3s ease;
}

.filter-group:hover {
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filter-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) 0;
    cursor: pointer;
    transition: color 0.3s ease;
}

.filter-toggle:hover {
    color: var(--accent-color);
}

.filter-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-color);
}

.filter-toggle label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-weight: 500;
}

.filter-toggle i {
    width: 16px;
    text-align: center;
}

.focus-button {
    width: 100%;
    padding: var(--space-3);
    background: #1e3a8a;
    color: white;
    border: 2px solid #1e3a8a;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: var(--space-2);
}

.focus-button:hover {
    background: #1e40af;
    border-color: #1e40af;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.reset-view-btn {
    width: 100%;
    padding: var(--space-3);
    background: #1e3a8a;
    color: white;
    border: 2px solid #1e3a8a;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: var(--space-2);
}

.reset-view-btn:hover {
    background: #1e40af;
    border-color: #1e40af;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Modal Responsive */
@media (max-width: 768px) {
    .impact-params, .effects-grid, .terrain-details {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: var(--space-4);
    }
}
