/* Shared Marine Legend Styles */
.marine-legend-container {
    background: var(--dark-panel) !important;
    color: var(--text-light) !important;
    border-radius: var(--border-radius) !important;
    box-shadow: var(--shadow) !important;
    border-left: 4px solid var(--primary-color) !important;
    padding: 15px !important;
    z-index: 9999 !important;
    font-family: var(--font-family-primary) !important;
    min-width: 200px !important;
    max-width: 300px !important;
    font-size: 0.9rem !important;
    transition: all var(--transition-speed) ease !important;
}

/* Light theme support */
body.light-theme .marine-legend-container {
    background: var(--light-panel) !important;
    color: var(--text-dark) !important;
    border-left: 4px solid var(--primary-color) !important;
    box-shadow: var(--shadow) !important;
}

/* Header styling */
.marine-legend-container .legend-header {
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.light-theme .marine-legend-container .legend-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.marine-legend-container .legend-title {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 6px;
}

.marine-legend-container .legend-main-title {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.marine-legend-container .legend-caption {
    font-size: 11px;
    font-style: italic;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.2;
}

body.light-theme .marine-legend-container .legend-caption {
    color: var(--text-muted-dark);
}

.marine-legend-container .settings-toggle-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.marine-legend-container .settings-toggle-btn:hover {
    background: var(--primary-color-hover, var(--primary-color));
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.marine-legend-container .settings-toggle-btn.active {
    background: var(--primary-color-active, var(--primary-color));
    transform: translateY(0px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Settings toggle button maintains same appearance in both themes */
body.light-theme .marine-legend-container .settings-toggle-btn {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.light-theme .marine-legend-container .settings-toggle-btn:hover {
    background: var(--primary-color-hover, var(--primary-color));
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

body.light-theme .marine-legend-container .settings-toggle-btn.active {
    background: var(--primary-color-active, var(--primary-color));
    transform: translateY(0px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Visualization type buttons */
.marine-legend-container .viz-type-buttons {
    display: flex;
    gap: 3px;
    margin-bottom: 15px;
}

.marine-legend-container .viz-type-btn {
    flex: 1;
    padding: 6px;
    border: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.marine-legend-container .viz-type-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.marine-legend-container .viz-type-btn.active {
    background: var(--primary-color);
    color: white;
}

body.light-theme .marine-legend-container .viz-type-btn {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-dark);
}

body.light-theme .marine-legend-container .viz-type-btn:hover {
    background: rgba(0, 0, 0, 0.2);
}

body.light-theme .marine-legend-container .viz-type-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Settings panel */
.marine-legend-container .visual-settings-panel {
    background: rgba(0, 0, 0, 0.2);
    margin: 0 -15px 15px -15px;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.light-theme .marine-legend-container .visual-settings-panel {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.marine-legend-container .settings-title {
    color: var(--text-light);
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 12px;
}

body.light-theme .marine-legend-container .settings-title {
    color: var(--text-dark);
}

.marine-legend-container .setting-group {
    margin-bottom: 12px;
}

.marine-legend-container .setting-group-title {
    color: var(--text-muted);
    font-size: 11px;
    margin-bottom: 6px;
}

body.light-theme .marine-legend-container .setting-group-title {
    color: var(--text-muted-dark);
}

.marine-legend-container .setting-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.marine-legend-container .setting-label {
    color: var(--text-light);
    font-size: 10px;
    width: 40px;
    flex-shrink: 0;
}

body.light-theme .marine-legend-container .setting-label {
    color: var(--text-dark);
}

.marine-legend-container .setting-slider {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

body.light-theme .marine-legend-container .setting-slider {
    background: rgba(0, 0, 0, 0.2);
}

.marine-legend-container .setting-slider::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}

.marine-legend-container .setting-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.marine-legend-container .setting-value {
    color: var(--text-muted);
    font-size: 10px;
    width: 30px;
    text-align: right;
    flex-shrink: 0;
}

body.light-theme .marine-legend-container .setting-value {
    color: var(--text-muted-dark);
}

.marine-legend-container .reset-btn {
    width: 100%;
    padding: 6px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.marine-legend-container .reset-btn:hover {
    background: #c0392b;
}

body.light-theme .marine-legend-container .reset-btn {
    background: #e74c3c;
    color: white;
}

body.light-theme .marine-legend-container .reset-btn:hover {
    background: #c0392b;
}

/* Scale styling - works for both temp and anomaly ranges */
.marine-legend-container .temp-scale,
.marine-legend-container .anomaly-scale {
    font-size: 12px;
    line-height: 1.4;
}

/* Scale titles */
.marine-legend-container .temp-scale-title,
.marine-legend-container .anomaly-scale-title {
    color: var(--text-light);
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 8px;
    margin-top: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 4px;
}

body.light-theme .marine-legend-container .temp-scale-title,
body.light-theme .marine-legend-container .anomaly-scale-title {
    color: var(--text-dark);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.marine-legend-container .temp-range-item,
.marine-legend-container .anomaly-range-item {
    margin: 3px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.marine-legend-container .temp-color-box,
.marine-legend-container .anomaly-color-box {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.marine-legend-container .temp-range-text,
.marine-legend-container .anomaly-range-text {
    color: var(--text-light);
    font-size: 12px;
}

body.light-theme .marine-legend-container .temp-range-text,
body.light-theme .marine-legend-container .anomaly-range-text {
    color: var(--text-dark);
}

/* Attribution */
.marine-legend-container .attribution {
    margin-top: 12px;
    font-size: 11px;
    color: #999999; /* Default dark theme - lighter gray */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 8px;
    text-align: center;
    line-height: 1.4;
}

.marine-legend-container .attribution a {
    color: var(--primary-color);
    text-decoration: none;
}

.marine-legend-container .attribution a:hover {
    text-decoration: underline;
}

body.light-theme .marine-legend-container .attribution {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    color: #666666; /* Light theme - darker gray */
}

body.light-theme .marine-legend-container .attribution a {
    color: var(--primary-color);
}

/* Temperature color classes for legend */
.legend-color.marine-temp-arctic { background-color: #1a237e; }
.legend-color.marine-temp-cold { background-color: #0d47a1; }
.legend-color.marine-temp-cool { background-color: #1976d2; }
.legend-color.marine-temp-cool-moderate { background-color: #2196f3; }
.legend-color.marine-temp-moderate { background-color: #4caf50; }
.legend-color.marine-temp-warm-moderate { background-color: #8bc34a; }
.legend-color.marine-temp-warm { background-color: #ffc107; }
.legend-color.marine-temp-hot { background-color: #ff9800; }
.legend-color.marine-temp-very-hot { background-color: #f44336; }
.legend-color.marine-temp-extreme-hot { background-color: #b71c1c; }

/* Anomaly color classes for legend */
.legend-color.marine-anomaly-extreme-cold-anom { background-color: #0d1e4a; }
.legend-color.marine-anomaly-very-cold-anom { background-color: #1a237e; }
.legend-color.marine-anomaly-cold-anom { background-color: #0d47a1; }
.legend-color.marine-anomaly-cool-anom { background-color: #1976d2; }
.legend-color.marine-anomaly-normal-anom { background-color: #4caf50; }
.legend-color.marine-anomaly-warm-anom { background-color: #ffc107; }
.legend-color.marine-anomaly-hot-anom { background-color: #ff9800; }
.legend-color.marine-anomaly-very-hot-anom { background-color: #f44336; }
.legend-color.marine-anomaly-extreme-hot-anom { background-color: #b71c1c; }

/* Mobile responsiveness */
@media (max-width: 768px) {
    .marine-legend-container {
        max-width: 250px !important;
        font-size: 0.85rem !important;
    }
    
    .marine-legend-container .legend-title {
        font-size: 13px;
    }
    
    .marine-legend-container .viz-type-btn {
        font-size: 10px;
        padding: 5px;
    }
} 