@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');

:root {
    --z-base: 0;
    --z-canvas: 0;
    --z-topbar: 1;
    --z-ui-cards: 4;
    --z-minimap: 10;
    --z-controls: 15;
}

body {
    margin: 0;
    overflow: hidden;
    background: black;
    font-family: 'Orbitron', sans-serif;
}

#leftControls {
    display: flex;
    z-index: var(--z-topbar);
    position: relative;
    /* width: -webkit-fill-available; */
    height: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    /* padding: 0.5vw; */
    /* gap: 10vw; */
    /* margin: 1vw 0.5vw 0 0.5vw; */
    width: 50vw;
    align-items: center;
}

#centerControls {
    /* position: absolute; */
    /* left: 50%; */
    /* transform: translateX(-50%); */
    display: flex;
    flex-direction: row;
    justify-content: center;
    width: 25vw;
    align-items: center;
    text-align: center;
    height: 100%;
}

#toggleControlsContainer {
    height: 100%;
}

#rightControls {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

#topBar {
    display: flex;
    z-index: var(--z-topbar);
    position: relative;
    width: -webkit-fill-available;
    height: 3vh;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    /* padding: 0.5vw; */
    gap: 1vw;
    padding: 1vh 0.5vw;
    width: 83.22vw;
    overflow-x: clip;
    border-bottom: 0.2vh solid #0ff;
}

/* Container for upload + download buttons */
#leftContainer {
    display: flex;
    gap: 1vw;
    height: 3vh;
    width: 40vw;
    margin: 0.5vw 0 0.5vw 0.5vw;
    justify-content: space-between;
}

#jsonFileInputLabel {
    background: rgba(10, 10, 30, 0.8);
    border: 2px solid #0ff;
    border-radius: 10px;
    color: #0ff;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 0 10px #0ff, 0 0 20px #0ff;
    transition: all 0.3s ease;
    font-family: 'Orbitron', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 20vw;
    /* height: 100%; */
    /* padding: 0; */
}

#jsonFileInputLabel:hover {
    background: rgba(20, 20, 60, 0.9);
    box-shadow: 0 0 15px #0ff, 0 0 30px #0ff;
    transform: scale(1.05);
}

#jsonFileInput {
    background: rgba(10, 10, 30, 0.8);
    border: 2px solid #0ff;
    border-radius: 10px;
    color: #0ff;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 0 10px #0ff, 0 0 20px #0ff;
    transition: all 0.3s ease;
    font-family: 'Orbitron', sans-serif;
    display: none;
    justify-content: center;
    align-items: center;
    width: 14vw;
    height: 100%;
}

#jsonFileInput:hover {
    background: rgba(20, 20, 60, 0.9);
    box-shadow: 0 0 15px #0ff, 0 0 30px #0ff;
    transform: scale(1.05);
}

#jsonFileInput::-webkit-file-upload-button {
    visibility: hidden;
}

#jsonFileInput::before {
    content: '🪐 Upload Solar System';
    display: flex;
    color: #0ff;
    font-weight: bold;
    background: transparent;
    padding: 0.3vh 0.5vw;
    /* border-radius: 5px; */
    align-items: center;
    text-align: center;
    justify-content: center;
    width: fit-content;
}

/* Download Button */
#downloadBtn {
    background: linear-gradient(135deg, #0ff 0%, #09f 100%);
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    border: 2px solid #0ff;
    border-radius: 10px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 0 10px #0ff, 0 0 20px #09f inset;
    transition: all 0.3s ease;
    font-weight: bold;
}

#downloadBtn:hover {
    background: #000;
    color: #0ff;
    box-shadow: 0 0 15px #0ff, 0 0 25px #0ff inset;
    border-color: #09f;
}

/* System Name Display */
#systemNameDisplay {
    /* position: absolute; */
    /* top: 20px; */
    /* left: 50%; */
    /* transform: translateX(-50%); */
    z-index: var(--z-controls);
    color: #0ff;
    /* font-size: 18px; */
    /* padding: 0 0.5vw; */
    background: rgba(10, 10, 30, 0.8);
    border: 2px solid #0ff;
    border-radius: 10px;
    box-shadow: 0 0 12px #0ff, 0 0 25px #0ff;
    text-transform: uppercase;
    /* text-align: center; */
    /* display: flex; */
    font-weight: bold;
    width: 15vw;
}

/* Minimap Container */
#minimapContainer {
    /* top: 0%; */
    /* right: 20px; */
    border: 1px solid #0ff;
    /* margin: 1vw; */
    /* background-color: black; */
    /* display: flex; */
    /* align-items: center; */
    /* justify-content: center; */
    /* z-index: var(--z-minimap); */
    /* margin: 0.5vw 0.5vw 0 0; */
    height: 15.2vw;
    display: flex;
    align-items: flex-start;
    min-height: 15.2vw;
    min-width: 15.2vw;
    position: absolute;
    right: 0;
    top: 0;
    margin: 0.5vw 0.5vw 0 0;
}

canvas {
    width: 15.2vw;
    height: 15.2vw;
}

/* Centered Image inside Minimap */
#centeredImageContainer {
    position: absolute;
    /* top: 0; */
    /* left: 0; */
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    /* z-index: var(--z-minimap); */
    pointer-events: none;
    width: -webkit-fill-available;
}

#minimap_arrow {
    max-width: 25px;
    max-height: 25px;
    object-fit: contain;
}

/* Planet Info Cards */
#planetInfoContainer {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: var(--z-ui-cards);
}

.planet-card {
    position: absolute;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    transform: translate(-50%, -100%);
    z-index: var(--z-ui-cards);
}


#rightContainer {
    display: flex;
    align-items: flex-start;
    min-height: 15.2vw;
    min-width: 15.2vw;
    position: absolute;
    right: 0;
    top: 0;
    margin: 0.5vw 0.5vw 0 0;
}

#helpIcon {
    aspect-ratio: 1 / 1;
    /* width: 2vw; */
    cursor: pointer;
    filter: drop-shadow(0 0 1px #0ff);
    height: 100%;
}

#tooltip {
    display: none;
    position: absolute;
    top: 7vh;
    right: 2vw;
    background: rgba(10, 10, 30, 0.9);
    color: #0ff;
    padding: 8px 12px;
    border: 1px solid #0ff;
    border-radius: 8px;
    font-size: 12px;
    z-index: var(--z-controls);
    box-shadow: 0 0 10px #0ff;
}

#toggleControlsContainer:hover #tooltip {
    display: block;
}

#toggleControlsLabel {
    display: flex;
    align-items: center;
    justify-content: center; /* Center content horizontally */
    gap: 10px; /* spacing between checkbox and text */
    padding: 10px 20px;
    background: rgba(10, 10, 30, 0.8);
    border: 2px solid #0ff;
    border-radius: 10px;
    color: #0ff;
    font-size: 14px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 0 10px #0ff, 0 0 20px #0ff;
    transition: all 0.3s ease;
    height: 100%;
}

#toggleControlsLabel input[type="checkbox"] {
    appearance: none;
    width: 40px;
    height: 20px;
    background: #222;
    border: 2px solid #0ff;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
}

#toggleControlsLabel input[type="checkbox"]::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #0ff;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

#toggleControlsLabel input[type="checkbox"]:checked {
    background: #0ff;
}

#toggleControlsLabel input[type="checkbox"]:checked::before {
    transform: translateX(20px);
    background: #000;
}


#orbitSpeedDisplay {
    color: white;
    font-family: 'Orbitron', sans-serif;
    padding: 1vh 1vw;
    border-radius: 4px;
    align-items: center;
    display: flex;
    min-width: 7vw;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    text-align: center;
}

#orbitSpeedDisplaySpeed {
    min-width: 4vw;
}

#orbitSpeedDisplayValue {
    min-width: 3vw;
    text-align: center;
}

#orbitSpeedDisplayMultiplier {

}

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


/* Default styles work well for desktops and large tablets in landscape */

/* Tablets and small desktops */
@media (max-width: 1024px) {
    #topBar,
    #leftControls,
    #centerControls,
    #rightControls,
    #leftContainer {
        flex-direction: column;
        align-items: center;
        width: 100%;
        height: auto;
    }

    #jsonFileInput,
    #downloadBtn {
        width: 80%;
        margin-bottom: 1vh;
    }

    #centerControls {
        width: 100%;
        margin-top: 1vh;
    }

    #minimapContainer,
    #rightContainer {
        position: relative;
        margin: 1vh auto;
        min-width: 40vw;
        min-height: 40vw;
        height: 40vw;
    }

    canvas {
        width: 100% !important;
        height: auto !important;
    }

    #systemNameDisplay {
        font-size: 1rem;
        padding: 1vh;
    }

    #helpIcon {
        width: 3vw;
        height: 3vw;
    }
}

/* Phones */
@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    #topBar {
        flex-direction: column;
        align-items: center;
        height: auto;
        padding: 2vh 1vw;
        gap: 2vh;
    }

    #leftControls {
        flex-direction: column;
        align-items: center;
        gap: 2vh;
        width: 100%;
    }

    #jsonFileInput,
    #downloadBtn,
    #orbitSpeedDisplay {
        width: 90%;
    }

    #centerControls,
    #rightControls {
        width: 100%;
        justify-content: center;
        margin: 1vh 0;
    }

    #toggleControlsLabel {
        flex-direction: column;
        font-size: 12px;
    }

    #minimapContainer,
    #rightContainer {
        min-width: 60vw;
        min-height: 60vw;
        height: 60vw;
        margin: 2vh auto;
        position: relative;
    }

    #tooltip {
        top: 8vh;
        right: 5vw;
        font-size: 10px;
        padding: 6px 10px;
    }

    #systemNameDisplay {
        font-size: 14px;
        text-align: center;
        width: 100%;
        padding: 1vh;
    }

    #planetInfoContainer {
        font-size: 10px;
    }

    #minimap_arrow {
        max-width: 20px;
        max-height: 20px;
    }

    #helpIcon {
        width: 4vw;
        height: 4vw;
    }
}
