/* Three.js Viewer Specific Styles */

/* Main Viewer Layout */
.viewer-container {
    display: flex;
    height: 100vh;
    background: var(--bg-primary);
    overflow: hidden;
}

/* Sidebar Toggle */
.sidebar-toggle {
    position: fixed;
    top: var(--space-4);
    left: var(--space-4);
    z-index: 1001;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.sidebar-toggle:hover {
    background: var(--accent-primary);
    transform: scale(1.1);
}

.sidebar-toggle i {
    font-size: var(--font-size-lg);
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    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;
}

/* Sidebar Styles */
.viewer-sidebar {
    position: fixed;
    top: 0;
    left: -350px;
    width: 350px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: left 0.3s ease;
}

.viewer-sidebar.active {
    left: 0;
}

/* Sidebar Header */
.sidebar-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-4);
    position: relative;
}

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

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

.sidebar-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
    cursor: pointer;
    transition: color 0.3s ease;
}

.sidebar-close:hover {
    color: var(--accent-color);
}

.viewer-sidebar::-webkit-scrollbar {
    width: 6px;
}

.viewer-sidebar::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.viewer-sidebar::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 3px;
}

.viewer-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Main Content Area */
.viewer-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg-primary);
}


/* 3D Canvas Container */
.viewer-canvas {
    flex: 1;
    background: #000011;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    margin: var(--space-2);
}

.viewer-canvas canvas {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    border-radius: var(--radius-lg);
}

/* Floating Controls */
.viewer-controls {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 200px;
}

.control-group {
    margin-bottom: var(--space-4);
}

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

.control-group h4 {
    margin-bottom: var(--space-2);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--space-1);
}

.control-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: background-color 0.3s ease;
    cursor: pointer;
}

.control-toggle:hover {
    background: rgba(30, 58, 138, 0.1);
}

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

.control-toggle label {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    flex: 1;
}

.control-btn {
    width: 100%;
    padding: var(--space-3);
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.3);
}

.control-btn:hover {
    background: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.4);
}

.control-select {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.control-select:hover {
    border-color: var(--accent-hover);
}

.neo-label {
    z-index: 1000;
    pointer-events: none;
}

/* Planet and NEO Label Styles */
.planet-label, .neo-label {
    z-index: 1000;
    pointer-events: none;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.label-header {
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.label-name {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 2px;
}

.label-id {
    font-size: 10px;
    opacity: 0.7;
    font-weight: 500;
}

.label-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.label-type, .label-risk, .label-period, .label-distance, 
.label-temp, .label-diameter, .label-velocity, .label-source {
    font-size: 9px;
    opacity: 0.8;
    font-weight: 500;
}

.label-risk {
    font-weight: 600;
}

.label-source {
    font-weight: 600;
    font-size: 8px;
    opacity: 1;
}

/* Hover effects for labels */
.planet-label:hover, .neo-label:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

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

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

/* Sidebar Sections */
.sidebar-section {
    margin: var(--space-4);
    padding: var(--space-4);
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.sidebar-section:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.sidebar-section h3 {
    margin-bottom: var(--space-4);
    color: var(--accent-color);
    font-size: var(--font-size-lg);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: var(--space-2);
}

.sidebar-section h3 i {
    font-size: var(--font-size-xl);
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.info-item {
    text-align: center;
    padding: var(--space-3);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.info-item:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

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

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

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

.loading-content {
    text-align: center;
    color: white;
    max-width: 400px;
    padding: var(--space-6);
}

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

.loading-content h3 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-2);
    color: var(--accent-color);
}

.loading-content p {
    font-size: var(--font-size-base);
    opacity: 0.8;
}

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

/* 3D Labels */
.label {
    color: #FFF !important;
    font-family: 'Inter', sans-serif !important;
    padding: 4px 8px !important;
    background: rgba(0, 0, 0, 0.6) !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    pointer-events: none !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(5px) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) !important;
    transition: all 0.3s ease !important;
}

.label:hover {
    background: rgba(30, 58, 138, 0.8) !important;
    transform: scale(1.1) !important;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .viewer-sidebar {
        width: 300px;
    }
    
    .viewer-controls {
        top: var(--space-2);
        right: var(--space-2);
        padding: var(--space-3);
        min-width: 180px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .viewer-container {
        flex-direction: column;
    }
    
    .viewer-sidebar {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        overflow-y: auto;
    }
    
    .viewer-main {
        flex: 1;
    }
    
    .viewer-navbar {
        padding: var(--space-3);
    }
    
    .viewer-title {
        font-size: var(--font-size-lg);
    }
    
    .nav-btn {
        padding: var(--space-1) var(--space-3);
        font-size: var(--font-size-sm);
    }
    
    .viewer-controls {
        position: relative;
        top: auto;
        right: auto;
        margin: var(--space-2);
        background: var(--bg-primary);
        border: 1px solid var(--border-color);
    }
    
    .sidebar-section {
        margin-bottom: var(--space-4);
        padding: var(--space-3);
    }
}

@media (max-width: 480px) {
    .viewer-sidebar {
        height: 150px;
    }
    
    .nav-buttons {
        flex-direction: column;
        gap: var(--space-2);
    }
    
    .nav-btn {
        width: 100%;
        justify-content: center;
    }
    
    .viewer-title {
        font-size: var(--font-size-base);
    }
    
    .viewer-title i {
        font-size: var(--font-size-lg);
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .viewer-controls {
        background: rgba(0, 0, 0, 0.9);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .control-toggle:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Performance Optimizations */
.viewer-canvas {
    will-change: transform;
    transform: translateZ(0);
}

.viewer-controls {
    will-change: transform;
}

.control-btn {
    will-change: transform;
}

/* Accessibility */
.nav-btn:focus,
.control-btn:focus,
.control-toggle input:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .viewer-container {
        display: none;
    }
}
