/* Climate data page styles */

.climate-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 16px;
}

.climate-controls .control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.climate-controls .control-group label {
    font-size: 0.8em;
    font-weight: 600;
    color: #555;
    margin: 0;
}

.climate-controls #locationInput {
    width: 260px;
    padding: 8px 36px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95em;
}

.climate-controls select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95em;
    background: white;
}

.climate-controls .toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    color: #555;
    cursor: pointer;
    padding: 8px 0;
}

.climate-controls #searchBtn {
    padding: 8px 20px;
    background: var(--primary-gradient, linear-gradient(135deg, #FF6B35, #F7931E));
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95em;
}

.climate-controls #searchBtn:hover {
    opacity: 0.9;
}

.climate-controls #searchBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Clear location button (inside input) — matches RWGPS URL clear btn */
.input-clear-btn {
    position: absolute;
    right: 8px;
    bottom: 4px;
    width: 28px;
    height: 28px;
    border: none;
    background: #ccc;
    color: white;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
}

/* Location info row with map button */
.location-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.location-info-row .location-info {
    margin-bottom: 0;
}


/* Map modal */
.map-modal {
    max-width: 700px;
    padding: 16px;
}

/* Geocoding dropdown */
.geocode-container {
    position: relative;
}

.geocode-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
    display: none;
}

.geocode-dropdown.visible {
    display: block;
}

.geocode-dropdown .geocode-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9em;
}

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

.geocode-dropdown .geocode-item:hover {
    background: #f5f5f7;
}

.geocode-dropdown .geocode-item .place-name {
    font-weight: 600;
    color: var(--text-dark, #333);
}

.geocode-dropdown .geocode-item .place-detail {
    color: var(--text-muted, #666);
    font-size: 0.85em;
}

/* Chart grid — 2 columns on wide screens */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Chart containers */
.chart-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 16px;
}

.chart-card h3 {
    margin: 0 0 8px 0;
    font-size: 1em;
    color: var(--accent, #2D3047);
}

.chart-card canvas {
    width: 100%;
    height: 420px;
    cursor: crosshair;
}

/* Chart legend */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    font-size: 0.8em;
    color: var(--text-muted, #666);
}

.chart-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.chart-legend .legend-swatch {
    width: 20px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.chart-legend .legend-line {
    width: 20px;
    height: 2px;
    flex-shrink: 0;
}

.chart-legend .legend-dotted {
    height: 0;
    border-top: 2px dotted;
    background: none !important;
}

/* Chart tooltip */
.climate-tooltip {
    position: fixed;
    background: rgba(45, 48, 71, 0.92);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.82em;
    pointer-events: none;
    z-index: 200;
    white-space: nowrap;
    line-height: 1.5;
    display: none;
}

.climate-tooltip.visible {
    display: block;
}

.climate-tooltip .tooltip-date {
    font-weight: 600;
    margin-bottom: 2px;
}

.climate-tooltip .tooltip-high {
    color: #ff9999;
}

.climate-tooltip .tooltip-low {
    color: #99bbff;
}

.climate-tooltip .tooltip-precip {
    color: #88ccff;
}

.climate-tooltip .tooltip-snow {
    color: #cccccc;
}

/* Status / loading */
.climate-status {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted, #666);
    font-size: 0.95em;
}

.climate-status.error {
    color: #c0392b;
}

/* Location display */
.location-info {
    font-size: 0.85em;
    color: var(--text-muted, #666);
    margin-bottom: 12px;
}

/* Chart header with month nav */
.chart-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
    flex-wrap: wrap;
}

.chart-header h3 {
    margin: 0;
}

.chart-header .month-nav {
    margin-left: auto;
}

.csv-btn {
    font-size: 0.75em;
    padding: 2px 8px;
    background: none;
    border: 1px solid #ddd;
    border-radius: 3px;
    color: #888;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
}

.csv-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.month-nav {
    display: flex;
    gap: 2px;
    font-size: 0.75em;
    user-select: none;
}

.month-nav span {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    cursor: pointer;
    color: #888;
    font-weight: 500;
    transition: background 0.15s;
}

.month-nav span:hover {
    background: #f0f0f0;
    color: #333;
}

.month-nav span.active {
    background: var(--primary, #FF6B35);
    color: white;
    font-weight: 700;
}

/* Wind rose */
.wind-rose-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px 0;
}

.wind-rose-header h3 {
    margin: 0;
}

.wind-rose-stats {
    font-size: 0.8em;
    color: var(--text-muted, #666);
    margin-left: auto;
    display: flex;
    gap: 12px;
    white-space: nowrap;
}

.chart-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e8e8e8;
    color: #666;
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    position: relative;
    flex-shrink: 0;
    border: none;
    padding: 0;
    line-height: 1;
    font-family: inherit;
}

.chart-info-btn:hover .chart-info-tooltip {
    display: block;
}

.chart-info-tooltip {
    display: none;
    position: absolute;
    top: 26px;
    right: -8px;
    background: rgba(45, 48, 71, 0.95);
    color: white;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    width: 260px;
    white-space: normal;
    z-index: 150;
    pointer-events: none;
}

.wind-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.wind-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78em;
    color: var(--text-muted, #666);
}

.wind-legend .legend-swatch {
    width: 14px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}

.wind-rose-loading {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 0.9em;
}

/* Responsive: single column below 900px */
@media (max-width: 900px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .climate-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .climate-controls #locationInput {
        width: 100%;
    }

    .chart-card canvas {
        height: 300px;
    }

    .wind-rose-stats {
        display: none;
    }
}

/* Data source credit */
.data-credit {
    text-align: center;
    font-size: 0.8em;
    color: #999;
    margin: 24px 0 0;
    padding: 0 16px;
}
.data-credit a {
    color: #888;
}
