/* GOES Viewer Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    overflow: hidden;
    height: 100vh;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
    height: 50px;
    z-index: 1000;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title h1 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #e94560;
}

.legal-btn {
    padding: 4px 10px;
    background: transparent;
    border: 1px solid #0f3460;
    color: #888;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
}

.legal-btn:hover, .legal-btn.active {
    background: #0f3460;
    color: #e0e0e0;
}

/* Controls */
.controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dropdown-container {
    position: relative;
}

.dropdown-btn {
    padding: 6px 12px;
    background: #0f3460;
    border: 1px solid #1a1a2e;
    color: #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.dropdown-btn:hover, .dropdown-btn.active {
    background: #e94560;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 4px;
    min-width: 180px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1001;
    margin-top: 4px;
}

.dropdown-content.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.85rem;
}

.dropdown-item:hover {
    background: #0f3460;
}

/* Main content */
.main-content {
    display: flex;
    height: calc(100vh - 50px);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #16213e;
    border-right: 1px solid #0f3460;
    padding: 16px;
    overflow-y: auto;
}

.sidebar h2 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: #e94560;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: #aaa;
}

.control-group input,
.control-group select {
    width: 100%;
    padding: 8px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    color: #e0e0e0;
    border-radius: 4px;
    font-size: 0.85rem;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: #e94560;
}

.control-group select option {
    background: #1a1a2e;
}

.control-group select optgroup {
    background: #16213e;
    color: #e94560;
    font-weight: bold;
}

.date-time-row {
    display: flex;
    gap: 8px;
}

.date-time-row > div {
    flex: 1;
}

.date-time-row > div:first-child {
    flex: 2;
}

.fetch-btn {
    width: 100%;
    padding: 12px;
    background: #e94560;
    border: none;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 8px;
}

.fetch-btn:hover:not(:disabled) {
    background: #ff6b6b;
}

.fetch-btn:disabled {
    background: #555;
    cursor: not-allowed;
}

/* Status message */
#status-message {
    margin-top: 12px;
    padding: 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    text-align: center;
}

#status-message.loading {
    background: #0f3460;
    color: #4cc9f0;
}

#status-message.success {
    background: #1a472a;
    color: #4ade80;
}

#status-message.error {
    background: #4a1a1a;
    color: #f87171;
}

/* Map container */
#map {
    flex: 1;
    background: #1a1a2e;
}

/* Legend */
#legend {
    display: none;
    position: absolute;
    bottom: 30px;
    right: 20px;
    background: rgba(22, 33, 62, 0.95);
    border: 1px solid #0f3460;
    border-radius: 4px;
    padding: 10px;
    z-index: 1000;
    min-width: 80px;
}

#legendTitle {
    font-size: 0.75rem;
    margin-bottom: 8px;
    text-align: center;
    color: #e0e0e0;
}

.legend-content {
    display: flex;
    gap: 8px;
}

#legendBar {
    width: 20px;
    height: 150px;
    background: linear-gradient(to bottom, white, black);
    border-radius: 2px;
}

#legendLabels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #aaa;
}

/* Cursor value display */
#cursorValue {
    display: none;
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(22, 33, 62, 0.95);
    border: 1px solid #0f3460;
    border-radius: 4px;
    padding: 6px 12px;
    z-index: 1000;
    font-size: 0.85rem;
}

#cursorValue.show {
    display: block;
}

/* Overlay settings */
.overlay-item {
    padding: 8px 12px;
    border-bottom: 1px solid #0f3460;
}

.overlay-item:last-child {
    border-bottom: none;
}

.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.overlay-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
}

/* Options dropdown */
.options-dropdown {
    min-width: 200px;
}

.options-item {
    padding: 8px 12px;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
}

.setting-row span {
    flex-shrink: 0;
}

.setting-row input[type="number"] {
    width: 60px;
    padding: 4px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    color: #e0e0e0;
    border-radius: 4px;
    font-size: 0.8rem;
}

.setting-row input[type="range"] {
    flex: 1;
}

.opacity-slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
}

.opacity-slider-container input {
    flex: 1;
}

.opacity-slider-container span {
    width: 40px;
    text-align: right;
    font-size: 0.8rem;
}

/* Download Modal */
.dl-modal-content { max-width: 580px; width: 95%; max-height: 88vh; }
.dl-section { margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid #34495e; }
.dl-section:last-of-type { border-bottom: none; margin-bottom: 0; }
.dl-section-title { font-size: 0.85rem; font-weight: bold; color: #3498db; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.dl-radio-row { display: flex; gap: 20px; margin-bottom: 10px; font-size: 0.9rem; flex-wrap: wrap; }
.dl-radio-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.dl-field-row { display: flex; align-items: center; gap: 8px; }
.dl-field-row input[type="text"], .dl-field-row select { width: 100%; padding: 7px 10px; background: #34495e; border: 1px solid #2c3e50; border-radius: 4px; color: #ecf0f1; font-size: 0.9rem; }
.dl-datetime-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 0.9rem; }
.dl-datetime-row input[type="date"], .dl-datetime-row select { padding: 6px 8px; background: #34495e; border: 1px solid #2c3e50; border-radius: 4px; color: #ecf0f1; font-size: 0.9rem; }
.dl-dt-label { width: 56px; color: #888; font-size: 0.82rem; }
.dl-file-list { margin-top: 8px; max-height: 200px; overflow-y: auto; }
.dl-file-item { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; margin-bottom: 4px; background: #2c3e50; border-radius: 4px; font-size: 0.8rem; gap: 8px; }
.dl-file-name { flex: 1; word-break: break-all; color: #bdc3c7; }
.dl-file-link { color: #3498db; text-decoration: none; white-space: nowrap; }
.dl-file-link:hover { color: #5dade2; }
.dl-folder-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dl-folder-btn { padding: 6px 14px; font-size: 0.85rem; background: #34495e; color: #ecf0f1; border: 1px solid #3498db; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.dl-folder-btn:hover { background: #3d5a73 !important; }
.dl-folder-path { font-size: 0.82rem; color: #888; word-break: break-all; }
.dl-filename-row label { white-space: nowrap; font-size: 0.88rem; color: #888; }
.dl-status { padding: 8px 12px; border-radius: 4px; font-size: 0.88rem; margin-bottom: 12px; background: #34495e; color: #f39c12; }
.dl-status.success { color: #2ecc71; }
.dl-status.error { color: #e74c3c; }
.dl-status.hidden { display: none; }
.dl-note { font-size: 0.8rem; color: #f39c12; margin-top: 6px; }
.dl-note.hidden { display: none; }
.dl-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.dl-download-btn { background: #27ae60; color: #fff; padding: 8px 24px; }
.dl-download-btn:hover { background: #219a52 !important; }
.dl-download-btn:disabled { background: #7f8c8d !important; }
.dl-cancel-btn { background: #7f8c8d; color: #fff; padding: 8px 24px; }
.dl-cancel-btn:hover { background: #95a5a6 !important; }

/* Legal Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
}

.modal-content h2 {
    color: #e94560;
    margin-bottom: 16px;
}

.modal-content p {
    margin-bottom: 12px;
    line-height: 1.6;
    font-size: 0.9rem;
}

.modal-content a {
    color: #4cc9f0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #34495e;
}
.modal-header h3 { margin: 0; font-size: 1.1rem; color: #ecf0f1; }
.modal-close {
    background: none; border: none; color: #888; font-size: 1.4rem;
    cursor: pointer; padding: 0 4px; line-height: 1;
}
.modal-close:hover { color: #ecf0f1; }
.modal-body { padding: 4px 0; }

.modal-close-btn {
    margin-top: 16px;
    padding: 8px 16px;
    background: #e94560;
    border: none;
    color: white;
    border-radius: 4px;
    cursor: pointer;
}

.modal-close-btn:hover {
    background: #ff6b6b;
}

/* Leaflet customizations */
.leaflet-control-zoom {
    border: 1px solid #0f3460 !important;
}

.leaflet-control-zoom a {
    background: #16213e !important;
    color: #e0e0e0 !important;
    border-color: #0f3460 !important;
}

.leaflet-control-zoom a:hover {
    background: #0f3460 !important;
}

.leaflet-control-scale-line {
    background: rgba(22, 33, 62, 0.8) !important;
    border-color: #0f3460 !important;
    color: #e0e0e0 !important;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
    }

    .main-content {
        flex-direction: column;
    }
}
