:root {
    --primary-color: #003366;
    --secondary-color: #f4f4f9;
    --border-color: #ddd;
    --success-color: #d4edda;
    --error-color: #f8d7da;
    --text-color: #333;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0 0 20px 0;
    background-color: var(--secondary-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: var(--secondary-color); /* Match body for 3D effect base */
    padding: 20px;
    border-radius: 8px;
}
body > .container {
    padding-top: 20px; /* Adjust padding for the new look */
    border-radius: 0;
    box-shadow: none; /* Shadow is now on the panels themselves */
}

header h1 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 20px;
    padding-top: 20px;
    /* Give the title a slightly pressed look */
    text-shadow: 1px 1px 1px #fff, -1px -1px 1px rgba(0,0,0,0.1);
}

.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    grid-template-areas: "map controls";
}
#map-panel { grid-area: map; }
#control-panel { grid-area: controls; }


#map-panel, #control-panel, #satellite-panel, #lightning-panel, #results-panel {
    border: none;
    border-radius: 15px; /* Softer corners */
    padding: 20px; /* Slightly more padding */
    background: var(--secondary-color);
    /* The 3D effect: an even darker shadow for higher contrast */
    box-shadow: 12px 12px 18px #b1b5b9, -12px -12px 18px #ffffff;
}

#satellite-panel-container, #lightning-panel-container {
    display: none; /* Hide by default */
}

#satellite-panel-container .container, #lightning-panel-container .container {
    padding-top: 15px;
    padding-bottom: 15px;
}

h2 {
    color: var(--primary-color);
    margin-top: 0;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--primary-color);
}

.panel-header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: 15px;
}

.panel-header-wrapper h2 {
    border-bottom: none;
    margin-bottom: 0;
}

#form-reset-button {
    height: fit-content;
    width: auto;
    padding: 4px 10px;
    font-size: 14px;
}

#map {
    height: 640px;
    width: 100%;
    border-radius: 10px; /* Match panel corners */
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

.form-group h6 {
    font-size: 1em;
    font-weight: bold;
    margin: 0 0 5px 0;
}

fieldset.form-group {
    border: none;
    padding: 0;
    margin: 0;
    margin-bottom: 15px;
}

fieldset.form-group legend {
    font-weight: bold;
    margin-bottom: 5px;
    padding: 0;
    font-size: 1em;
}


input[type="text"], input[type="date"], select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
}

.time-group {
    display: flex;
    gap: 10px;
}
.time-group > div {
    flex: 1;
}

.radio-group label {
    display: block;
    font-weight: normal;
}

.combined-file-type {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px;
}
.combined-file-type .primary-type-group {
    padding-right: 20px;
    border-right: 1px solid var(--border-color);
}
.combined-file-type .options-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.combined-file-type .options-group label {
    margin-bottom: 0;
}


button {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color: 0.3s;
}

button:disabled {
    background-color: #999;
    cursor: not-allowed;
}

button:hover:not(:disabled) {
    background-color: #0055a4;
}

.error-msg {
    color: #721c24;
    background-color: var(--error-color);
    padding: 5px;
    border-radius: 4px;
}

#form-error:empty {
    display: none;
}

#station-list-container {
    background-color: var(--secondary-color);
    border-radius: 8px;
    padding: 8px;
    min-height: 22px;
    max-height: 120px;
    overflow-y: auto;
    /* Inset shadow for a "pressed in" look with more contrast */
    box-shadow: inset 3px 3px 7px #b1b5b9, inset -3px -3px 7px #ffffff;
}

#station-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

#station-list li {
    background-color: #003366;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: bold;
}

#progress-container {
    margin-bottom: 15px;
}

.progress-bar-outline {
    width: 100%;
    background-color: var(--secondary-color);
    border-radius: 25px;
    border: none;
    padding: 4px;
    /* Inset shadow for progress bar with more contrast */
    box-shadow: inset 3px 3px 7px #b1b5b9, inset -3px -3px 7px #ffffff;
}

.progress-bar-inner {
    height: 20px;
    width: 0%;
    background-color: var(--primary-color);
    border-radius: 20px;
    text-align: center;
    color: white;
    line-height: 20px;
    transition: width 0.5s ease-in-out;
}

.result-list {
    list-style-type: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    column-gap: 10px;
    align-items: flex-start;
}

.result-list li {
    border: none;
    padding: 0;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.thumbnail-preview {
    width: 256px;
    height: auto;
    border-radius: 8px;
    transition: transform 0.2s;
    /* Thumbnail shadow with more contrast */
    box-shadow: 6px 6px 12px #b1b5b9, -6px -6px 12px #ffffff;
}

.thumbnail-preview:hover {
    transform: scale(1.05);
}

.alternate-links {
    margin-top: 2px;
    font-size: 0.8em;
    text-align: center;
    max-width: 256px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.thumbnail-container {
    position: relative;
    display: inline-block;
    margin-bottom: 4px;
}

.thumbnail-container.video::after {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    color: white;
    text-shadow: 0 0 15px rgba(0, 0, 0, 0.8);
    opacity: 0.8;
    pointer-events: none;
    transition: transform 0.2s, opacity 0.2s;
}

.thumbnail-container.video:hover::after {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
}

.alternate-links a {
    margin: 0 3px;
    white-space: nowrap;
}

.track-link {
    font-size: 0.8em;
}

.station-separator {
    border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0));
    margin: 20px 0;
}

.time-set {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    background: var(--secondary-color);
    /* Time set shadow with more contrast */
    box-shadow: 6px 6px 12px #b1b5b9, -6px -6px 12px #ffffff;
}

.time-set h6 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1em;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 5px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.checkbox-group label {
    font-weight: normal;
    margin-bottom: 0;
}

.map-description {
    color: #6c757d;
    margin-top: 10px;
    line-height: 1.4;
    font-size: 0.875rem;
}

.form-group.date-group-flex {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group.date-group-flex label {
    flex-shrink: 0;
    margin-bottom: 0;
}

.form-group.date-group-flex input[type="date"] {
    flex-grow: 1;
}

#last-night-btn, #now-button {
    padding: 8px 12px;
    font-size: 14px;
    width: auto;
    flex-shrink: 0;
}

.button-group {
    display: flex;
    gap: 10px;
}
#download-button {
    background-color: #006400;
}
#download-button:hover:not(:disabled) {
    background-color: #008000;
}
#download-button:disabled {
    background-color: #999;
}
#form-reset-button, #cancel-button {
    background-color: #9e1b1b;
    color: white;
}
#form-reset-button:hover, #cancel-button:hover {
    background-color: #801515;
}

.checkbox-label-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
}
.checkbox-label-inline input {
    width: auto;
}

.leaflet-reset-view-control {
    background-color: #fff;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 12px;
    cursor: pointer;
    background-clip: padding-box;
    color: var(--text-color);
}

.leaflet-reset-view-control:hover {
    background-color: var(--primary-color);
    color: white;
}

.toggle-reset-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-wrapper {
    padding-bottom: 5px;
}

.full-width-container {
    padding: 0; /* Wrapper should not have padding */
    margin-top: 20px;
}

.chart-container {
    height: 200px;
    width: 95%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    border-radius: 15px;
    background: var(--secondary-color);
    box-shadow: 12px 12px 18px #b1b5b9, -12px -12px 18px #ffffff;
}

#satellite-list, #lightning-list {
    max-height: 250px; /* Adjusted height */
    overflow-y: auto;
}

.satellite-group {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}

.satellite-group.selected-pass {
    background-color: #f8d7da;
    border-left: 4px solid #721c24;
}

.satellite-group.pass-even {
    background-color: transparent;
}

.satellite-group.pass-odd {
    background-color: rgba(0,0,0,0.02);
}

.satellite-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.satellite-group h6 {
    margin: 0 0 8px 0;
    color: var(--primary-color);
    cursor: pointer;
    flex-grow: 1;
}
.satellite-group h6:hover {
    text-decoration: underline;
}

.magnitude {
    font-weight: normal;
    color: #6c757d;
    font-size: 0.9em;
}

.download-all-btn {
    padding: 4px 10px;
    font-size: 14px;
    width: auto;
    flex-shrink: 0;
}

.events-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.event-link {
    background-color: #e9ecef;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.event-link:hover {
    background-color: #ced4da;
}

.event-link.selected {
    background-color: var(--primary-color);
    color: white;
}


.ground-track-label {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid #aaa;
    border-radius: 4px;
    box-shadow: 0 0 0.2em #000;
    color: #333;
    font-size: 11px;
    line-height: 1;
    padding: 2px 4px;
    text-align: center;
    white-space: nowrap;
}

.lightning-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.lightning-list li {
    padding: 6px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lightning-list li:hover {
    background-color: rgba(0,0,0,0.03);
}

.lightning-list li.selected-lightning {
    background-color: #f8d7da;
    font-weight: bold;
    border-left: 4px solid #721c24;
    padding-left: 2px;
}

.strike-type-indicator {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.strike-type-indicator.cg { color: #FFC051; }
.strike-type-indicator.ic { color: #666; }

.lightning-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    text-shadow: 0 0 3px black;
}
.lightning-icon-yellow {
    color: #FFC051;
}
.lightning-icon-white {
    color: #666; /* Using grey for better visibility on the map */
}
.lightning-icon-red {
    color: red;
}
.icon-size-14 {
    font-size: 14px;
}
.icon-size-18 {
    font-size: 18px;
}
.icon-size-24 {
    font-size: 24px;
}


@media (max-width: 1280px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-areas:
            "map"
            "controls"
            "satellites";
    }

    .event-link {
        font-size: 10px;
        padding: 2px 6px;
    }
}

@media (min-width: 1441px) {
    .container, .full-width-container .chart-container {
        max-width: 95%;
    }
    .main-content {
        grid-template-columns: 1fr 500px;
    }
}
.date-input-wrapper {
    position: relative;
    flex-grow: 1;
    display: flex;
}

/* Style the visible text input */
#date-display {
    width: 100%;
    padding-right: 30px; /* Make space for the icon */
    cursor: pointer;
    background-color: #fff; /* Ensure it looks like an active input */
}

/* Hide the native date input and its picker icon, but keep it functional */
#date {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0; /* Make it completely transparent */
    cursor: pointer;
    border: none;
}

/* Add a calendar icon using a pseudo-element */
.date-input-wrapper::after {
    content: '📅';
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    pointer-events: none; /* Let clicks pass through to the inputs below */
}

.map-tiler-satellite {
    filter: brightness(149%);
}

/* --- NEW / MODIFIED STYLES FOR LIVE STREAM --- */
#live-stream-controls {
    margin-top: -5px;
    margin-bottom: 15px;
    border: none;
    padding: 0;
}
#live-stream-controls legend {
    font-weight: bold;
    margin-bottom: 8px;
    padding: 0;
    font-size: 1em;
}
.live-stream-res-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}
.live-stream-link {
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 12px;
    background-color: #e9ecef;
    transition: background-color 0.2s, color 0.2s;
    line-height: 1.5;
}
.live-stream-link:hover {
    background-color: var(--success-color);
    color: #155724;
}

#video-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050; /* Ensure it's on top */
}

#video-modal-content {
    background-color: var(--secondary-color);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 12px 12px 18px #b1b5b9, -12px -12px 18px #ffffff;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#video-container {
    width: 100%;
    max-width: 85vw;
    margin: 0 auto 10px auto;
    position: relative;
    overflow: hidden;
    cursor: grab;
    background-color: black;
    border-radius: 8px;
}

#video-container:active {
    cursor: grabbing;
}

#live-video {
    width: 100%;
    height: 100%;
    display: block;
}

#grid-overlay-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Changed from fill to contain to fix alignment */
    opacity: 0;
    transition: opacity 0.3s ease;
}

#video-status {
    text-align: center;
    margin-bottom: 15px;
    font-weight: bold;
    color: var(--primary-color);
    min-height: 1.2em;
}

#video-close-button {
    width: auto;
    padding: 8px 20px;
    margin: 0 auto;
    background-color: #9e1b1b;
}
#video-close-button:hover {
    background-color: #801515;
}
/* Force specific buttons in the modal to not be full-width */
#video-modal-content #fullscreen-btn,
#video-modal-content #video-close-button {
    width: auto;
    flex-grow: 0;
}
