:root {
    --light-bg: #ffffff;
    --light-text: #000000;
    --dark-bg: #000000;
    --dark-text: #ffffff;
    --med-color: #888888;
    --graphbg-color-light: #FFFFFF;
    --graphbg-color-dark: #222;
    --graphborder-color-light: #000;
    --graphborder-color-dark: #FFF;
    --buttonbg-color-light: #EEEEEE;
    --buttonbg-color-dark: #000000;
    --buttontext-color-light: #000;
    --buttontext-color-dark: #FFF;
    --red: #b40000;
    --blue: #0000ce;
    --yellow: #eac700;
    --primary-color: #4a4a4a;
    --primary-color-light: #6a6a6a;
    --headertext: #ffffff;
}

[data-theme="dark"] {
    --primary-color: #2a2a2a;
    --primary-color-light: #4a4a4a;
    --headertext: #ffffff;
    background-color: var(--dark-bg);
    color: var(--dark-text);
}

[data-theme="light"] {
    background-color: var(--light-bg);
    color: var(--light-text);
}

html, body {
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit;
}

body {
    font-family: 'Open Sans', Arial, sans-serif;
    margin: 0;
    padding-top: 0px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;

}

header {
    position: relative;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(to right, var(--primary-color), var(--primary-color-light));
    color: var(--headertext);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

header h1 {
    margin: 0;
    font-size: 1.3rem;
    text-align: center;
    flex-grow: 1;
}

#theme-toggle {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    overflow: hidden;
}

#theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#theme-toggle svg {
    width: 24px;
    height: 24px;
    position: absolute;
    transition: transform 0.7s cubic-bezier(0.45, 0.05, 0.55, 0.95), opacity 0.7s ease, stroke 0.3s ease;
}

#theme-toggle .sun-icon {
    stroke: #eac700; /* Yellow color */
}

#theme-toggle .moon-icon {
    stroke: #ffffffe1; /* White color */
}

[data-theme="light"] #theme-toggle .sun-icon {
    opacity: 1;
    transform: translateY(0) rotate(540deg);
}

[data-theme="light"] #theme-toggle .moon-icon {
    opacity: 0;
    transform: translateY(20px) translateX(20px) rotate(1turn);
}

[data-theme="dark"] #theme-toggle .sun-icon {
    opacity: 0;
    transform: translateY(20px) translateX(-20px) rotate(-45deg);
}

[data-theme="dark"] #theme-toggle .moon-icon {
    opacity: 1;
    transform: translateY(0) rotate(180);
}

.container {
    text-align: center;
    padding: 1rem;
    width: 92%;
    max-width: 1600px;
}

.info-container {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 1rem;
    margin: 1rem 0;
    flex-wrap: wrap;
    width: 100%;
}

.info-field {
    background-color: var(--graphbg-color-light);
    border: 3px solid var(--graphborder-color-light);
    padding: .5rem;
    border-radius: 25px;
    flex: 1;
    min-width: 200px;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

[data-theme="dark"] .info-field {
    background-color: var(--graphbg-color-dark);
    border: 3px solid var(--graphborder-color-dark);
    color: var(--dark-text);
}

.info-field label {
    display: block;
    font-size: 0.9rem;
    color: var(--med-color);
    margin-bottom: .25rem;
}

.info-field span {
    font-size: 1.5rem;
    display: block;
}

#epoch {
    font-size: 1.5rem;
    display: block;
}

.graph-box {
    margin: 1vh auto;
    background-color: var(--graphbg-color-light);
    border: 3px solid var(--graphborder-color-light);
    border-radius: 25px;
    padding: 1rem;
    box-sizing: border-box;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
    height: 95vh;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    padding-bottom: 40px;
}

[data-theme="dark"] .graph-box {
    background-color: var(--graphbg-color-dark);
    border: 3px solid var(--graphborder-color-dark);
}

#graph-container {
    width: 100%;
    flex-grow: 1;
    min-height: 300px; 
}

.graphs {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

#controls {
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-top: 1rem;
}

#time-range {
    width: 100%;
    max-width: 500px;
    margin-bottom: 10px;
}

#time-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    width: 100%;
}

#time-buttons button {
    padding: 5px 10px;
    border: 2px solid var(--graphborder-color-light);
    border-radius: 5px;
    cursor: pointer;
    background-color: var(--buttonbg-color-light);
    color: var(--buttontext-color-light);
    flex: 0 1 auto;
    min-width: 40px;
    font-size: 0.8rem;
}

#time-buttons button.active, #reentry-button.active {
    font-weight: bold;
}

[data-theme="dark"] #time-buttons button {
    background-color: var(--buttonbg-color-dark);
    border: 2px solid var(--graphborder-color-dark);
    color: var(--buttontext-color-dark);
}

.graph-controls {
    display: flex;
    flex-wrap: wrap;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 1rem;
    width: 100%;
}

.graph-controls button,
.graph-controls label {
    white-space: nowrap;
    font-size: 0.9rem;
}

.graph-controls button {
    padding: 7px 10px;
    border: 2px solid var(--graphborder-color-light);
    border-radius: 5px;
    cursor: pointer;
    background-color: var(--buttonbg-color-light);
    color: var(--buttontext-color-light);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

[data-theme="dark"] .graph-controls button {
    background-color: var(--buttonbg-color-dark);
    color: var(--buttontext-color-dark);
    border: 2px solid var(--graphborder-color-dark);
}

.graph-controls button .status {
    font-weight: bold;
    transition: color 0.3s ease;
}

.graph-controls button.active .status {
    color: var(--yellow);
}

#animateButton .status {
    transition: color 0.3s ease;
}

#animateButton {
    transition: transform 0.2s ease;
}

.js-plotly-plot .plotly .modebar {
    position: absolute !important;
    top: auto;
    left: 0 !important;
    right: 0 !important;
    display: flex !important;
    justify-content: center;
    padding: 10px 0;
}

.js-plotly-plot .plotly .modebar-btn {
    opacity: 1 !important;
    font-size: 25px !important;
}

.fancy-paragraph {
    margin-top: 1.5em;
    padding: 30px;
    padding-top: 10px;
    background-color: var(--graphbg-color-light);
    border: 3px solid var(--graphborder-color-light);
    border-radius: 25px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.fancy-paragraph p {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--light-text);
    text-align: justify;
}

[data-theme="dark"] .fancy-paragraph {
    background-color: var(--graphbg-color-dark);
    border: 3px solid var(--graphborder-color-dark);
    border-radius: 25px;
}

[data-theme="dark"] .fancy-paragraph p {
    color: var(--dark-text);
}

.custom-link {
    color: #002fca;
    text-decoration: none;
}

.custom-link:hover {
    text-decoration: underline;
}

@media (max-width: 1000px) {
    header h1 {
        font-size: 1.1rem;
    }

    .info-container {
        flex-direction: column;
        align-items: center;
    }

    .info-field {
        width: 100%;
        max-width: 1100px;
    }

    #graph-container {
        height: 60vh;
    }
    
    .js-plotly-plot .plotly .modebar-btn {
        font-size: 14px !important;
    }
}

@media (max-width: 600px) {
    header h1 {
        font-size: .8rem;
    }

    .info-container {
        flex-direction: column;
        align-items: center;
    }

    .info-field {
        width: 100%;
        max-width: 700px;
    }

    #graph-container {
        height: 40vh;
    }

    .graph-box {
        padding: 0.5rem;
    }

    #time-buttons button {
        padding: 5px;
        font-size: 0.8rem;
    }
    
    .js-plotly-plot .plotly .modebar-btn {
        font-size: 12px !important;
    }
}