/* MRMS QPE Viewer Styles */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header Styles */
header {
    background-color: #2c3e50;
    color: white;
    padding: 12px 14px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

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

header h1 {
    font-size: 16px;
    margin: 0;
}

/* Legal Button */
.legal-btn {
    padding: 4px 12px;
    font-size: 12px;
    background: transparent;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.legal-btn:hover {
    background: #e74c3c;
    color: white;
}

.legal-btn.active {
    background: #e74c3c;
    color: white;
}

/* Control Panel Styles */
.controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 9px;
    font-weight: bold;
    text-transform: uppercase;
    color: #ecf0f1;
    letter-spacing: 0.3px;
}

/* Inline controls - label and input on same line */
.control-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-inline label {
    font-size: 14px;
    font-weight: 500;
    color: #ecf0f1;
}

/* Action buttons */
.action-btn {
    padding: 9px 18px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    background-color: #3498db;
    color: white;
}

.action-btn:hover {
    background-color: #2980b9;
}

.action-btn.green {
    background-color: #27ae60;
}

.action-btn.green:hover {
    background-color: #229954;
}

.action-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.controls select,
.controls input[type="date"],
.controls input[type="time"] {
    padding: 7px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    color: #333;
}

/* Dropdown Menu Styles */
.dropdown-container {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    padding: 9px 22px;
    background: #0f3460;
    border: 1px solid #4cc9f0;
    color: #4cc9f0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.dropdown-btn:hover {
    background: #1a4a7a;
}

.dropdown-btn.active {
    background: #4cc9f0;
    color: #1a1a2e;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 140px;
    background: #16213e;
    border: 1px solid #4cc9f0;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    margin-top: 4px;
    padding: 6px 0;
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: #ccc;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s;
}

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

.dropdown-item input[type="radio"] {
    width: 14px;
    height: 14px;
    accent-color: #4cc9f0;
    cursor: pointer;
}

/* Overlay Dropdown Styles */
.overlay-dropdown {
    min-width: 200px;
    padding: 0;
}

.overlay-item {
    border-bottom: 1px solid #2a3f5f;
}

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

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

.overlay-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ccc;
    font-size: 11px;
    cursor: pointer;
}

.overlay-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #4cc9f0;
    cursor: pointer;
}

.overlay-settings-btn {
    background: transparent;
    border: 1px solid #4cc9f0;
    color: #4cc9f0;
    width: 22px;
    height: 22px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.overlay-settings-btn:hover {
    background: #4cc9f0;
    color: #1a1a2e;
}

.overlay-settings-btn.active {
    background: #4cc9f0;
    color: #1a1a2e;
}

.overlay-settings {
    background: #0f3460;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.overlay-settings.hidden {
    display: none;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    color: #aaa;
}

.setting-row span:first-child {
    min-width: 45px;
}

.setting-row input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #16213e;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.setting-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #4cc9f0;
    border-radius: 50%;
    cursor: pointer;
}

.setting-row input[type="color"] {
    width: 28px;
    height: 20px;
    padding: 0;
    border: 1px solid #4cc9f0;
    border-radius: 3px;
    background: transparent;
    cursor: pointer;
}

.setting-value {
    min-width: 30px;
    text-align: right;
    color: #7bed9f;
}

/* Setting checkbox style */
.setting-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 10px;
    color: #aaa;
}

.setting-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #4cc9f0;
}

/* Product Dropdown Styles */
.product-dropdown {
    min-width: 180px;
}

.dropdown-group-label {
    padding: 6px 12px;
    font-size: 10px;
    font-weight: bold;
    color: #4cc9f0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #0a2240;
    border-bottom: 1px solid #2a3f5f;
}

.dropdown-group-label:not(:first-child) {
    border-top: 1px solid #2a3f5f;
    margin-top: 4px;
}

#date-input {
    width: 145px;
}

#hour-input {
    width: 95px;
}

.controls button {
    background-color: #3498db;
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.controls button:hover {
    background-color: #2980b9;
}

.controls button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* Layout Styles */
#main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

#left-panel {
    width: 400px;
    display: flex;
    flex-direction: column;
    background-color: #ecf0f1;
    border-right: 2px solid #bdc3c7;
}

#scatterplot-container {
    flex: 2;
    background-color: white;
    border-bottom: 2px solid #bdc3c7;
    position: relative;
}

#scatterplot-canvas {
    width: 100%;
    height: 100%;
}

#filters-container {
    flex: 1.5;
    background-color: #ecf0f1;
    padding: 10px;
    overflow-y: auto;
}

#filters-container h3 {
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 10px;
}

#map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
}

/* Leaflet Map Styles */
.leaflet-container {
    background-color: #1a1a1a;
    touch-action: none;
}

/* Grid labels on map */
.grid-label {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Colorbar Styles */
#colorbar {
    position: absolute;
    bottom: 30px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 100px;
}

#colorbar h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
}

.colorbar-scale {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.colorbar-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.colorbar-color {
    width: 20px;
    height: 15px;
    border: 1px solid #ccc;
}

.colorbar-label {
    font-size: 11px;
    color: #333;
    font-family: monospace;
}

#bias-colorbar {
    position: absolute;
    bottom: 30px;
    right: 130px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 100px;
}

#bias-colorbar h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
}

/* Time Input Styles - Force 24-hour format */
input[type="time"]::-webkit-datetime-edit-ampm-field {
    display: none;
}

/* Loading Indicator */
#loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.9);
    padding: 20px 40px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    display: none;
}

/* Overlay Controls Panel */
#overlay-controls {
    background-color: #2c3e50;
    color: white;
    padding: 8px 12px;
    border-top: 1px solid #34495e;
}

#overlay-controls h2 {
    font-size: 12px;
    margin-bottom: 6px;
    color: #ecf0f1;
}

.overlay-section {
    margin-bottom: 6px;
    padding: 6px;
    background-color: rgba(52, 73, 94, 0.5);
    border-radius: 3px;
}

.overlay-section h3 {
    font-size: 10px;
    margin-bottom: 4px;
    color: #3498db;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.overlay-control-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.overlay-control-row label {
    font-size: 10px;
    min-width: 60px;
    color: #ecf0f1;
}

.overlay-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
}

.overlay-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}

.color-picker-wrapper input[type="color"] {
    width: 20px;
    height: 22px;
    border: none;
    border-radius: 2px;
    cursor: pointer;
}

.color-preview {
    padding: 2px 6px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 2px;
    font-family: monospace;
    font-size: 9px;
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.slider-wrapper input[type="range"] {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: #34495e;
    outline: none;
    cursor: pointer;
}

.slider-wrapper input[type="range"]::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
}

.slider-value {
    min-width: 20px;
    text-align: center;
    font-family: monospace;
    font-size: 9px;
    color: #ecf0f1;
}

/* Checkbox Toggle Styles */
.checkbox-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 12px;
}

.checkbox-toggle input[type="checkbox"] {
    margin-right: 8px;
}

.checkbox-description {
    font-size: 10px;
    color: #7f8c8d;
    margin-left: 24px;
    margin-top: 4px;
}

/* Statistics Panel */
#statistics-panel {
    background-color: white;
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#statistics-panel h3 {
    font-size: 11px;
    color: #2c3e50;
    margin-bottom: 6px;
    font-weight: bold;
}

.statistics-content {
    font-size: 10px;
    color: #2c3e50;
    line-height: 1.4;
}

.statistics-content > div {
    margin-bottom: 2px;
}

.statistics-content strong {
    font-weight: bold;
}

/* Export Button */
#export-gauge-btn {
    padding: 8px 16px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    width: 100%;
    font-weight: bold;
}

#export-gauge-btn:hover {
    background-color: #229954;
}

/* Gauge Source Controls */
.gauge-source-title {
    font-size: 11px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #bdc3c7;
}

#gauge-source-controls {
    background-color: #fff;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#gauge-source-controls .checkbox-toggle {
    font-size: 11px;
}

#gauge-source-controls .checkbox-description {
    font-size: 9px;
    margin-left: 22px;
}

/* Gauge Source Header Controls */
.gauge-source-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gauge-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #ecf0f1;
    cursor: pointer;
}

.gauge-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #4cc9f0;
}

.gauge-checkbox input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.gauge-checkbox input[type="checkbox"]:disabled + span {
    opacity: 0.5;
}

/* Options Dropdown Styles */
.options-dropdown {
    min-width: 180px;
    padding: 8px 12px;
}

.options-item {
    margin-bottom: 8px;
}

.options-item:last-child {
    margin-bottom: 0;
}

.options-item .setting-row span {
    min-width: 80px;
}

.options-item input[type="number"] {
    flex: 1;
    padding: 4px 8px;
    background: #0f3460;
    border: 1px solid #1a3a5c;
    border-radius: 4px;
    color: #eaeaea;
    font-size: 0.85rem;
    min-width: 80px;
}

.options-item input[type="number"]:focus {
    outline: none;
    box-shadow: 0 0 6px rgba(76, 201, 240, 0.4);
}

.options-divider {
    border-top: 1px solid #0f3460;
    padding-top: 8px;
    margin-top: 4px;
}

.options-btn {
    width: 100%;
    padding: 8px 12px;
    background: #0f3460;
    border: 1px solid #4cc9f0;
    color: #4cc9f0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.options-btn:hover {
    background: #4cc9f0;
    color: #1a1a2e;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #16213e;
    border: 1px solid #4cc9f0;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #0f3460;
}

.modal-header h3 {
    color: #4cc9f0;
    font-size: 1.1rem;
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #ff4444;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* Marker Add Section */
.marker-add-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #0f3460;
}

.marker-add-section h4,
.marker-list-section h4 {
    color: #4cc9f0;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.marker-input-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.marker-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.marker-input-group label {
    font-size: 0.8rem;
    color: #888;
}

.marker-input-group input[type="number"],
.marker-input-group input[type="text"] {
    padding: 8px 10px;
    background: #0f3460;
    border: 1px solid #1a3a5c;
    border-radius: 4px;
    color: #eaeaea;
    font-size: 0.9rem;
}

.marker-input-group input[type="number"]:focus,
.marker-input-group input[type="text"]:focus {
    border-color: #4cc9f0;
    outline: none;
}

.marker-input-group input[type="color"] {
    width: 100%;
    height: 32px;
    padding: 2px;
    background: #0f3460;
    border: 1px solid #1a3a5c;
    border-radius: 4px;
    cursor: pointer;
}

.marker-input-group input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #0f3460;
    border-radius: 3px;
    cursor: pointer;
}

.marker-input-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #4cc9f0;
    border-radius: 50%;
    cursor: pointer;
}

.marker-input-group span#markerSizeValue {
    min-width: 24px;
    text-align: center;
    color: #7bed9f;
    font-size: 0.85rem;
}

.marker-input-row .marker-input-group:has(input[type="range"]) {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.marker-input-row .marker-input-group:has(input[type="range"]) label {
    min-width: 35px;
}

.primary-btn {
    padding: 10px 20px;
    background: #4cc9f0;
    border: none;
    color: #1a1a2e;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.primary-btn:hover {
    background: #3ab4d4;
}

/* Marker List Section */
.marker-list-section h4 span {
    color: #7bed9f;
    font-weight: normal;
}

.marker-list-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.small-btn {
    padding: 6px 12px;
    background: #0f3460;
    border: 1px solid #1a3a5c;
    color: #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.small-btn:hover {
    background: #1a3a5c;
    color: #fff;
}

.small-btn.danger {
    border-color: #ff4444;
    color: #ff4444;
}

.small-btn.danger:hover {
    background: #ff4444;
    color: #fff;
}

.marker-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #0f3460;
    border-radius: 6px;
    background: #0d1a30;
}

.marker-list .placeholder {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
    font-size: 0.85rem;
}

.marker-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #0f3460;
    transition: background 0.15s;
}

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

.marker-list-item:hover {
    background: #1a2a4a;
}

.marker-item-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    flex-shrink: 0;
}

.marker-item-info {
    flex: 1;
    min-width: 0;
}

.marker-item-label {
    display: block;
    font-size: 0.9rem;
    color: #eaeaea;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.marker-item-coords {
    display: block;
    font-size: 0.75rem;
    color: #888;
}

.marker-item-actions {
    display: flex;
    gap: 4px;
}

.marker-action-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    background: #0f3460;
    border: 1px solid #1a3a5c;
    color: #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.marker-action-btn:hover {
    background: #1a3a5c;
    color: #fff;
}

.marker-action-btn.goto:hover {
    border-color: #4cc9f0;
    color: #4cc9f0;
}

.marker-action-btn.toggle.hidden-marker {
    opacity: 0.5;
}

.marker-action-btn.delete:hover {
    border-color: #ff4444;
    color: #ff4444;
}

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

.legal-modal.hidden {
    display: none !important;
}

.legal-modal-content {
    background-color: #2c3e50;
    border-radius: 8px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.legal-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #34495e;
}

.legal-modal-header h2 {
    color: #3498db;
    font-size: 24px;
    margin: 0;
}

.legal-close-btn {
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.legal-close-btn:hover {
    color: #e74c3c;
}

.legal-modal-body {
    padding: 25px;
    overflow-y: auto;
    color: #ecf0f1;
}

.legal-section {
    margin-bottom: 30px;
}

.legal-section h3 {
    color: #3498db;
    font-size: 18px;
    margin-bottom: 12px;
    border-bottom: 1px solid #34495e;
    padding-bottom: 8px;
}

.legal-section p {
    margin-bottom: 10px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.legal-section ul {
    margin-left: 25px;
    margin-bottom: 10px;
}

.legal-section li {
    margin-bottom: 6px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.legal-section a {
    color: #3498db;
    text-decoration: none;
}

.legal-section a:hover {
    text-decoration: underline;
}

.warning-box {
    background-color: #e67e22;
    border-left: 4px solid #d35400;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
}

.warning-box p {
    margin: 0;
    color: #ffffff;
}

.warning-box p:first-child {
    margin-bottom: 8px;
}

.warning-box strong {
    font-size: 16px;
}

.legal-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #34495e;
    text-align: center;
    color: #95a5a6;
    font-size: 14px;
}
