/* ===================================
   LEO Constellation Visualization Styles
   =================================== */

/* --- Fonts --- */
@font-face {
    font-family: 'Geologica';
    src: url('../font/Geologica-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Geologica';
    src: url('../font/Geologica-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'Geologica';
    src: url('../font/Geologica-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Geologica', sans-serif;
}

:root {
    --footer-bg: #4A5041;
    --footer-text: #FFFFFF;
    --footer-header: #A0A598;
}

body {
    background: #1E1E1E;
    color: #f9fafb;
    min-height: 50vh;
    overflow-y: auto !important;
    /* Force scroll */
    cursor: url('/static/icon/cursor.svg'), auto;
}

html {
    overflow-y: auto;
    height: auto;
}

/* Main Layout */
.app-container {
    display: flex;
    width: 100vw;
    height: calc(100vh - 60px);
    /* Subtract header height */
    /* Subtract header height */
    margin-top: 60px;
    /* Push down below fixed header */
    position: relative;
    z-index: 1;
    /* Ensure app acts as base layer */
}

/* Visualization Panel */
.viz-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    /* Removed padding so canvas fills area */
    background: #1E1E1E;
    position: relative;
    /* Context for absolute canvas */
}

.viz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    padding: 20px;
    /* Restore padding here */
    position: relative;
    z-index: 10;
    /* Let clicks pass through empty space */
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent);
    justify-content: flex-end;
    /* Push status to right, toggle is absolute */
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #ffffff;
    /* Changed to White */
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f97316;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: #10b981;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Canvas Container */
.canvas-container {
    position: absolute;
    /* Behind everything */
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: #111;
}

#orbit-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#orbit-container-3d {
    width: 100%;
    height: 100%;
    display: none;
    /* Hidden by default */
}

/* Satellite Info Overlay */
.satellite-info {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 12px 16px;
}

.sat-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: #06b6d4;
    margin-bottom: 6px;
}

.sat-coords {
    display: flex;
    gap: 16px;
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Legend */
.viz-legend {
    display: flex;
    gap: 24px;
    margin-top: auto;
    /* Push to bottom */
    padding: 20px;
    position: relative;
    z-index: 10;
    pointer-events: none;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    /* Optional fade for readability */
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #e5e7eb;
    /* Lightened for visibility on dark BG */
    pointer-events: auto;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.satellite {
    background: #f97316;
    box-shadow: 0 0 6px #f97316;
}

.legend-dot.beam {
    background: rgba(59, 130, 246, 0.4);
    border: 1px solid #3b82f6;
}

.legend-line {
    width: 24px;
    height: 2px;
    background: #06b6d4;
    border-radius: 1px;
}

/* Control Panel */
.control-panel {
    width: 320px;
    background: #D9D9D9;
    border-left: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    color: #171717;
}

.panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid #bbb;
}

.panel-header h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #171717;
}

/* --- Dropdown Component --- */
.dropdown-container {
    position: relative;
    border-bottom: 1px solid #bbb;
}

.dropdown-header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    overflow: hidden;
    transition: background-color 0.3s ease;
}

.dropdown-header:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.header-title {
    font-size: 16px;
    font-weight: 700;
    pointer-events: none;
}

.arrow-icon {
    width: 20px;
    height: 20px;
    stroke: #171717;
    stroke-width: 2;
    fill: none;
    transition: transform 0.4s ease;
}

.dropdown-container.is-open .arrow-icon {
    transform: rotate(135deg);
}

.dropdown-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0 20px;
    transition: all 0.4s ease;
}

.dropdown-container.is-open .dropdown-content {
    max-height: 400px;
    opacity: 1;
    padding-bottom: 20px;
    padding-top: 8px;
}

/* --- Slider Rows --- */
.slider-row {
    margin-bottom: 16px;
}

.slider-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

/* --- Custom Range Slider --- */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    /* Fix compatibility lint */
    width: 100%;
    background: transparent;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: #FFFFFF;
    border-radius: 4px;
    border: 1px solid #ccc;
}

input[type=range]::-moz-range-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: #FFFFFF;
    border-radius: 4px;
    border: 1px solid #ccc;
}

input[type=range]::-webkit-slider-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #171717;
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -7px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

input[type=range]::-moz-range-thumb {
    height: 20px;
    width: 20px;
    border: none;
    border-radius: 50%;
    background: #171717;
    cursor: pointer;
}

/* --- Checkbox & Radio Rows --- */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.checkbox-row input[type="checkbox"],
.checkbox-row input[type="radio"] {
    display: none;
    /* Hide default input */
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #333;
    border-radius: 4px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.checkmark.radio {
    border-radius: 50%;
}

.checkbox-row input:checked+.checkmark {
    background: #171717;
    border-color: #171717;
}

.checkmark::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    display: none;
    margin-top: -2px;
}

.checkmark.radio::after {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
    border: none;
    transform: none;
    margin-top: 0;
}

.checkbox-row input:checked+.checkmark::after {
    display: block;
}

/* --- Playback Section --- */
.playback-section {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid #bbb;
}

.play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #171717;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.play-btn:hover {
    transform: scale(1.1);
}

.play-btn svg {
    width: 18px;
    height: 18px;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

.speed-control input[type="range"] {
    flex: 1;
    max-width: 100px;
}

#speed-value {
    min-width: 35px;
    text-align: right;
}

/* --- Time Section --- */
.time-section {
    padding: 16px 20px;
    text-align: center;
    margin-top: auto;
}

.time-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    display: block;
    margin-bottom: 6px;
}

.time-display {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: #171717;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.reset-btn {
    background: transparent;
    border: 1px solid #999;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 auto;
    transition: all 0.2s;
}

.reset-btn:hover {
    background: #e5e5e5;
    color: #171717;
    border-color: #666;
}

.reset-btn svg {
    width: 14px;
    height: 14px;
}

/* Responsive */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
    }

    .control-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid #bbb;
    }
}

/* --- 3D/2D Toggle Button --- */
.view-toggle {
    display: flex;
    background: #2a2a2a;
    border-radius: 20px;
    padding: 3px;
    border: 1px solid #444;

    /* Absolute Centering */
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.toggle-btn {
    background: transparent;
    border: none;
    color: #999;
    padding: 6px 16px;
    border-radius: 17px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.toggle-btn:hover {
    color: #fff;
}

.toggle-btn.active {
    background: #f97316;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* --- Loading Screen Styles --- */
.loader-container {
    /* Fixed positioning to cover the whole screen */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    z-index: 9999;

    /* Ensure it's hidden when done */
    opacity: 1;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
    transform: translate(-50%, -50%) scale(0.75);
    /* Scaled down for smaller appearance */
}

.loader-container.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* --- GLOBAL HEADER --- */
.global-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: #f5f5f4;
    /* Off-white like image */
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    height: 24px;
    width: auto;
}

.brand-divider {
    width: 1px;
    height: 24px;
    background-color: #d1d5db;
}

.app-name {
    font-family: 'Geologica', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: #737373;
    /* Grey text */
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.nav-link {
    font-family: 'Geologica', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: #737373;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: #171717;
    background-color: rgba(0, 0, 0, 0.05);
}

.nav-link.active {
    color: #171717;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
}

.profile-icon {
    height: 24px;
    width: 24px;
    opacity: 0.6;
    cursor: pointer;
    transition: opacity 0.2s;
}

.profile-icon:hover {
    opacity: 1.0;
}

/* --- LOADER --- */
.loader-header {
    background-color: #FFFFFF;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-top-left-radius: 4px;
    border-top-right-radius: 20px;
    position: relative;
    z-index: 2;
}

.loader-header-text {
    font-weight: 600;
    font-size: 20px;
    color: #171717;
    text-transform: uppercase;
    letter-spacing: 0.5px;

    /* Slide Animation */
    opacity: 0;
    transform: translateX(-30px);
    animation: textSlideIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: 0.2s;
}

.header-star {
    width: 28px;
    height: 28px;
    animation: spinStar 2s linear infinite;
}

/* --- DROPDOWN BODY --- */
.loader-body {
    background-color: #505544;
    /* Olive Green */
    color: #FFFFFF;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    transition: max-height 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.loader-body.is-open {
    max-height: 350px;
}

.body-padding {
    padding: 30px;
    padding-top: 15px;
}

/* --- TOP ROW: Percentage & Copyright --- */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
}

.percentage-display {
    font-size: 80px;
    font-weight: 400;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    min-width: 220px;
}

.copyright-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.9;
    margin-bottom: 8px;
    white-space: nowrap;
}

/* --- PROGRESS GRID (20 Blocks) --- */
.progress-grid {
    display: flex;
    gap: 6px;
    height: 60px;
    width: 100%;
    margin-bottom: 12px;
}

.p-block {
    flex: 1;
    border: 1px solid #FFFFFF;
    height: 100%;
    background-color: transparent;
    transition: background-color 0.1s ease;
}

.p-block.filled {
    background-color: #FFFFFF;
}

/* --- RANDOM BARS --- */
.random-bars-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 60%;
}

.random-bar {
    height: 4px;
    background-color: #FFFFFF;
    width: 100%;
    transform-origin: left;
    opacity: 0.8;
}

.bar-1 {
    animation: glitchBar1 2.5s infinite alternate;
}

.bar-2 {
    animation: glitchBar2 3.1s infinite alternate-reverse;
}


/* --- KEYFRAMES --- */
@keyframes textSlideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes spinStar {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes glitchBar1 {
    0% {
        width: 10%;
    }

    20% {
        width: 60%;
    }

    40% {
        width: 30%;
    }

    60% {
        width: 90%;
    }

    80% {
        width: 40%;
    }

    100% {
        width: 100%;
    }
}

@keyframes glitchBar2 {
    0% {
        width: 80%;
    }

    25% {
        width: 20%;
    }

    50% {
        width: 50%;
    }

    75% {
        width: 10%;
    }

    100% {
        width: 70%;
    }
}

/* --- FOOTER STYLES --- */
.site-footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 50px 60px;
    font-size: 12px;
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 2;
    /* Above app container if needed */
}

.footer-content {
    display: flex;
    justify-content: space-between;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    align-items: flex-start;
}

.footer-left {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    flex: 1;
    max-width: 350px;
    padding-right: 30px;
}

.footer-logo {
    height: 20px;
    margin-bottom: 15px;
    display: block;
}

.copyright-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.copyright-text {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.3px;
    color: var(--footer-text);
}

.legal-links {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 10px;
    font-weight: 300;
    line-height: 1.4;
    opacity: 0.8;
}

.legal-links li {
    margin-bottom: 1px;
}

.legal-links a {
    color: var(--footer-text);
    text-decoration: none;
    transition: opacity 0.2s;
}

.legal-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

.footer-right {
    display: flex;
    gap: 80px;
    flex: 2;
    justify-content: flex-start;
}

.footer-column {
    display: flex;
    flex-direction: column;
}

.column-header {
    color: var(--footer-header);
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--footer-text);
    text-decoration: none;
    font-weight: 400;
    font-size: 13px;
    transition: opacity 0.2s;
}

.footer-links a:hover {
    opacity: 0.8;
}

@media (max-width: 900px) {
    .site-footer {
        padding: 40px;
    }

    .footer-content {
        flex-direction: column;
        gap: 40px;
    }

    .footer-logo {
        margin-bottom: 20px;
    }

    .footer-right {
        flex-wrap: wrap;
        gap: 40px;
    }
}

/* --- Local Loader Styles --- */
.loader-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #e5e5e5;
    z-index: 50;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem;
    box-sizing: border-box;
    transition: opacity 0.8s ease-out;
    pointer-events: auto;
}

.loader-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.loader-header-text {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #171717;
}

.header-star {
    width: 24px;
    height: 24px;
    animation: spin 4s linear infinite;
}

.loader-body {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.percentage-display {
    font-family: 'Inter', sans-serif;
    font-size: 4rem;
    font-weight: 300;
    color: #171717;
    line-height: 1;
}

.copyright-tag {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 500;
    color: #666;
    text-transform: uppercase;
}

.progress-grid {
    display: flex;
    gap: 2px;
    height: 4px;
    width: 100%;
    margin-bottom: 10px;
}

.progress-segment {
    flex: 1;
    background: #ccc;
    height: 100%;
    transition: background 0.3s;
}

.progress-segment.active {
    background: #171717;
}

.random-bars-container {
    display: flex;
    gap: 4px;
    height: 4px;
}

.random-bar {
    width: 20%;
    height: 100%;
    background: #999;
}

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

    100% {
        transform: rotate(360deg);
    }
}