/* ================================
   ORBITAL - Satellite Simulation
   Design System & Styles
   ================================ */

:root {
    /* Core palette - Deep space theme */
    --bg-primary: #0a0e17;
    --bg-secondary: #0f1520;
    --bg-tertiary: #151d2e;
    --bg-panel: rgba(15, 21, 32, 0.85);
    
    /* Accent colors - Cyan/Teal spectrum */
    --accent-primary: #00f0ff;
    --accent-secondary: #00b4d8;
    --accent-tertiary: #0077b6;
    --accent-glow: rgba(0, 240, 255, 0.3);
    
    /* Warning/Status colors */
    --status-nominal: #00ff88;
    --status-warning: #ffa500;
    --status-critical: #ff3366;
    
    /* Text colors */
    --text-primary: #e8f4f8;
    --text-secondary: #8ba3b5;
    --text-muted: #4a6073;
    
    /* Earth colors */
    --earth-ocean: #1a4b7c;
    --earth-land: #2d5a3c;
    --earth-atmosphere: rgba(100, 180, 255, 0.15);
    
    /* UI elements */
    --border-color: rgba(0, 240, 255, 0.2);
    --border-glow: rgba(0, 240, 255, 0.4);
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    /* Typography */
    --font-display: 'Orbitron', monospace;
    --font-body: 'Rajdhani', sans-serif;
    
    /* Animations */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* ================================
   Reset & Base
   ================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

/* ================================
   Starfield Background
   ================================ */

.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: 
        radial-gradient(1px 1px at 20px 30px, white, transparent),
        radial-gradient(1px 1px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 50px 160px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 90px 40px, white, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1.5px 1.5px at 160px 120px, white, transparent),
        radial-gradient(1px 1px at 200px 50px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 250px 180px, white, transparent),
        radial-gradient(1px 1px at 300px 90px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1.5px 1.5px at 350px 200px, white, transparent),
        radial-gradient(1px 1px at 400px 60px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 450px 140px, white, transparent),
        radial-gradient(1px 1px at 500px 30px, rgba(255,255,255,0.7), transparent);
    background-repeat: repeat;
    background-size: 550px 220px;
    animation: twinkle 8s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* ================================
   Layout
   ================================ */

.container {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100vh;
    z-index: 1;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 0.3em;
    color: var(--accent-primary);
    text-shadow: 0 0 30px var(--accent-glow);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.title-icon {
    font-size: 2rem;
    animation: pulse 2s ease-in-out infinite;
}

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

.title-sub {
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    color: var(--text-secondary);
    margin-left: var(--space-sm);
}

.time-display {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.time-display .label {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}

.time-display .time {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--accent-primary);
    letter-spacing: 0.1em;
}

.main-content {
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    flex: 1;
    overflow: hidden;
}

/* ================================
   Control Panel (Left)
   ================================ */

.control-panel,
.telemetry-panel {
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    backdrop-filter: blur(10px);
}

.telemetry-panel {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.panel-section {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--accent-secondary);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.section-title .icon {
    color: var(--accent-primary);
    font-size: 0.9rem;
}

/* ================================
   Form Controls
   ================================ */

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

.control-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: var(--transition-fast);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px var(--accent-glow);
}

.slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px var(--accent-glow);
}

.value-display {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: var(--accent-primary);
    white-space: nowrap;
    min-width: 60px;
    text-align: right;
    flex-shrink: 0;
}

.text-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-fast);
}

.text-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-glow);
}

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

/* Satellite Name Combobox */
.text-input[list] {
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300f0ff' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: text;
}

.text-input[list]::-webkit-calendar-picker-indicator {
    opacity: 0;
    width: 24px;
    height: 24px;
    cursor: pointer;
}

/* ================================
   Orbit Presets
   ================================ */

.orbit-presets {
    display: flex;
    gap: var(--space-xs);
    margin-top: 4px;
}

.preset-btn {
    flex: 1;
    padding: 4px var(--space-xs);
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.preset-btn:hover {
    border-color: var(--accent-secondary);
    color: var(--text-secondary);
}

.preset-btn.active {
    background: var(--accent-tertiary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-glow);
}

.orbit-type {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ================================
   Buttons
   ================================ */

.button-group {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-normal);
    text-transform: uppercase;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-secondary));
    color: var(--text-primary);
    border-color: var(--accent-secondary);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

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

.btn-launch {
    width: 100%;
    padding: var(--space-md);
    background: linear-gradient(135deg, #1a4a2e, #2d7a4c);
    color: var(--status-nominal);
    border-color: var(--status-nominal);
    margin-top: var(--space-md);
}

.btn-launch:hover {
    background: linear-gradient(135deg, #2d7a4c, #3d9a6c);
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.3);
}

.btn-icon {
    font-size: 1rem;
}

/* ================================
   Satellite List
   ================================ */

.satellite-list {
    max-height: 200px;
    overflow-y: auto;
}

.satellite-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin-bottom: var(--space-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

.satellite-item:hover,
.satellite-item.selected {
    border-color: var(--accent-primary);
    background: rgba(0, 240, 255, 0.1);
}

.satellite-item .sat-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: var(--space-sm);
    box-shadow: 0 0 8px currentColor;
}

.satellite-item .sat-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
}

.satellite-item .sat-delete {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition-fast);
}

.satellite-item .sat-delete:hover {
    background: rgba(255, 51, 102, 0.2);
    color: var(--status-critical);
}

.empty-list {
    text-align: center;
    padding: var(--space-lg);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ================================
   Simulation View (Center)
   ================================ */

.simulation-view {
    position: relative;
    background: radial-gradient(ellipse at center, #050810 0%, #000205 100%);
    overflow: hidden;
}

#earthContainer {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
}

#earthContainer:active {
    cursor: grabbing;
}

#earthContainer canvas {
    width: 100% !important;
    height: 100% !important;
}

.camera-controls {
    position: absolute;
    bottom: var(--space-md);
    right: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    z-index: 10;
}

.camera-controls-row {
    display: flex;
    gap: var(--space-xs);
}

.btn-small {
    flex: none;
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 1.1rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-fast);
    backdrop-filter: blur(10px);
}

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

.btn-small.active {
    background: var(--accent-tertiary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.view-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: var(--space-md);
    pointer-events: none;
}

.view-info {
    display: flex;
    gap: var(--space-lg);
}

.info-item {
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    padding: var(--space-sm) var(--space-md);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.info-label {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.info-value {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--accent-primary);
}

.tooltip {
    position: absolute;
    background: var(--bg-panel);
    border: 1px solid var(--accent-primary);
    border-radius: 4px;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.8rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 100;
    backdrop-filter: blur(10px);
}

.tooltip.visible {
    opacity: 1;
}

/* ================================
   Telemetry Panel (Right)
   ================================ */

.telemetry-grid {
    display: grid;
    gap: var(--space-sm);
}

.telemetry-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.telemetry-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.telemetry-value {
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--accent-primary);
}

.telemetry-value.status-nominal {
    color: var(--status-nominal);
}

.telemetry-value.status-warning {
    color: var(--status-warning);
}

/* Coordinate Format Selector */
.coord-format-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
}

.coord-select {
    width: 100%;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--accent-primary);
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300f0ff' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

.coord-select:hover {
    border-color: var(--accent-primary);
    background-color: rgba(0, 240, 255, 0.05);
}

.coord-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

.coord-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px;
}

/* ================================
   Toggle Switches
   ================================ */

.toggle-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toggle {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    cursor: pointer;
}

.toggle input {
    display: none;
}

.toggle-slider {
    width: 40px;
    height: 20px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    position: relative;
    transition: var(--transition-normal);
    border: 1px solid var(--border-color);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: var(--transition-normal);
}

.toggle input:checked + .toggle-slider {
    background: var(--accent-tertiary);
    border-color: var(--accent-secondary);
}

.toggle input:checked + .toggle-slider::after {
    left: 22px;
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-glow);
}

.toggle-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ================================
   Statistics
   ================================ */

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.stat-item {
    text-align: center;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--accent-primary);
    text-shadow: 0 0 20px var(--accent-glow);
}

.stat-label {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* ================================
   Ground Track Map
   ================================ */

.ground-track-section {
    padding: var(--space-md);
}

.ground-track-container {
    background: var(--bg-tertiary);
    border-radius: 4px;
    padding: var(--space-sm);
    border: 1px solid var(--border-color);
}

#groundTrackCanvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
}

.map-legend {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-primary);
}

.legend-dot.current {
    background: #ff3366;
    box-shadow: 0 0 8px #ff3366;
}

.legend-line {
    width: 20px;
    height: 3px;
    background: var(--status-warning);
    border-radius: 1px;
}

.legend-circle {
    width: 14px;
    height: 10px;
    border: 2px solid rgba(0, 240, 255, 0.6);
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.15);
}

/* ================================
   Scrollbar Styling
   ================================ */

::-webkit-scrollbar {
    width: 6px;
}

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

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

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

/* ================================
   Responsive Adjustments
   ================================ */

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 250px 1fr 250px;
    }
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }
    
    .control-panel,
    .telemetry-panel {
        display: none;
    }
    
    .simulation-view {
        grid-row: 1;
    }
}

