/* ============================================================
   HEATMAP & PRESSURE MAP STYLES
   Shared styles for Leaflet map pages
   ============================================================ */

/* ─── Map Container ─── */
.map-wrapper {
    display: flex;
    gap: 0;
    height: calc(100vh - 180px);
    min-height: 500px;
    border-radius: var(--fish-radius-lg, 12px);
    overflow: hidden;
    border: 1px solid var(--fish-card-border, rgba(255,255,255,0.08));
}
.map-area {
    flex: 1;
    position: relative;
    min-width: 0;
}
#map {
    width: 100%;
    height: 100%;
    background: var(--fish-bg-deep, #040d14);
}

/* Leaflet dark theme overrides */
.leaflet-container { background: var(--fish-bg-deep, #040d14) !important; }
.leaflet-control-zoom a {
    background: var(--fish-bg-elevated, #112a45) !important;
    color: var(--fish-text, #e0e8f0) !important;
    border-color: var(--fish-card-border, rgba(255,255,255,0.08)) !important;
}
.leaflet-control-zoom a:hover {
    background: var(--fish-bg-surface, #163352) !important;
    color: var(--fish-accent, #06b6d4) !important;
}
.leaflet-control-attribution {
    background: rgba(10, 22, 40, 0.85) !important;
    color: var(--fish-text-dim, #64748b) !important;
    font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--fish-text-muted, #94a3b8) !important; }
.leaflet-popup-content-wrapper {
    background: var(--fish-bg-elevated, #112a45) !important;
    color: var(--fish-text, #e0e8f0) !important;
    border-radius: var(--fish-radius-md, 8px) !important;
    border: 1px solid var(--fish-card-border, rgba(255,255,255,0.08)) !important;
    box-shadow: var(--fish-shadow-lg) !important;
}
.leaflet-popup-tip { background: var(--fish-bg-elevated, #112a45) !important; }
.leaflet-popup-content { margin: 10px 14px !important; font-size: 0.85rem !important; line-height: 1.5 !important; }

/* ─── Side Panel ─── */
.side-panel {
    width: 320px;
    background: var(--fish-glass, rgba(10, 22, 40, 0.65));
    backdrop-filter: blur(12px);
    border-left: 1px solid var(--fish-glass-border, rgba(255,255,255,0.06));
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.panel-section {
    background: var(--fish-card, rgba(255,255,255,0.04));
    border: 1px solid var(--fish-card-border, rgba(255,255,255,0.08));
    border-radius: var(--fish-radius-md, 8px);
    padding: 14px;
}
.panel-section h3 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fish-accent, #06b6d4);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.panel-toggle {
    width: 100%;
    cursor: pointer;
}

/* ─── Filter Bar ─── */
.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(6,182,212,0.06), rgba(16,185,129,0.04));
    border: 1px solid rgba(6,182,212,0.15);
    border-radius: var(--fish-radius-lg, 12px);
    align-items: center;
}
.filter-bar label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--fish-text-muted, #94a3b8);
    white-space: nowrap;
}
.filter-bar select,
.filter-bar input[type="date"] {
    background: var(--fish-bg-elevated, #112a45);
    color: var(--fish-text, #e0e8f0);
    border: 1px solid var(--fish-card-border, rgba(255,255,255,0.08));
    border-radius: var(--fish-radius-sm, 4px);
    padding: 6px 10px;
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.filter-bar select:focus,
.filter-bar input[type="date"]:focus {
    border-color: var(--fish-accent, #06b6d4);
}

/* ─── Toggle Switch ─── */
.toggle-group {
    display: flex;
    border-radius: var(--fish-radius-md, 8px);
    overflow: hidden;
    border: 1px solid var(--fish-card-border, rgba(255,255,255,0.08));
}
.toggle-btn {
    background: var(--fish-bg-elevated, #112a45);
    color: var(--fish-text-muted, #94a3b8);
    border: none;
    padding: 6px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.toggle-btn.active {
    background: var(--fish-accent, #06b6d4);
    color: var(--fish-text-inverse, #0a1628);
}
.toggle-btn:hover:not(.active) {
    background: var(--fish-bg-surface, #163352);
}

/* ─── Stat Items ─── */
.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--fish-divider, rgba(255,255,255,0.06));
    font-size: 0.82rem;
}
.stat-item:last-child { border-bottom: none; }
.stat-item .label { color: var(--fish-text-muted, #94a3b8); }
.stat-item .value { color: var(--fish-text, #e0e8f0); font-weight: 600; }
.stat-item .value.hot { color: var(--fish-red, #ef4444); }
.stat-item .value.warm { color: var(--fish-orange, #f97316); }
.stat-item .value.cool { color: var(--fish-accent, #06b6d4); }

/* ─── Hotspot List ─── */
.hotspot-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.hotspot-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--fish-divider, rgba(255,255,255,0.06));
    font-size: 0.82rem;
    cursor: pointer;
    transition: color 0.2s;
}
.hotspot-item:last-child { border-bottom: none; }
.hotspot-item:hover { color: var(--fish-accent, #06b6d4); }
.hotspot-rank {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}
.hotspot-rank.r1 { background: #f59e0b; color: #0a1628; }
.hotspot-rank.r2 { background: #94a3b8; color: #0a1628; }
.hotspot-rank.r3 { background: #a87c4f; color: #fff; }
.hotspot-rank.r4, .hotspot-rank.r5 { background: var(--fish-bg-surface, #163352); color: var(--fish-text-muted); }
.hotspot-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hotspot-count { font-weight: 700; color: var(--fish-accent-bright, #22d3ee); }

/* ─── Timelapse Controls ─── */
.timelapse-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.timelapse-btn {
    background: var(--fish-bg-elevated, #112a45);
    color: var(--fish-accent, #06b6d4);
    border: 1px solid var(--fish-card-border, rgba(255,255,255,0.08));
    border-radius: var(--fish-radius-sm, 4px);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    font-family: inherit;
}
.timelapse-btn:hover { background: var(--fish-bg-surface, #163352); }
.timelapse-btn.playing { background: var(--fish-accent); color: var(--fish-text-inverse); }
.timelapse-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--fish-text, #e0e8f0);
    min-width: 100px;
    text-align: center;
}
.timelapse-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    border-radius: 2px;
    background: var(--fish-bg-surface, #163352);
    outline: none;
}
.timelapse-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--fish-accent, #06b6d4);
    cursor: pointer;
}

/* ─── Pressure Markers ─── */
.pressure-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}
.pressure-marker:hover { transform: scale(1.3); }
.pressure-low { background: #10b981; }
.pressure-moderate { background: #f59e0b; }
.pressure-high { background: #f97316; }
.pressure-extreme { background: #ef4444; }

/* ─── Best Time Card ─── */
.best-time-card {
    background: linear-gradient(135deg, rgba(6,182,212,0.08), rgba(16,185,129,0.06));
    border: 1px solid rgba(6,182,212,0.2);
    border-radius: var(--fish-radius-md, 8px);
    padding: 10px 12px;
    margin-top: 8px;
}
.best-time-card .time-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--fish-text-muted, #94a3b8);
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}
.best-time-card .time-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--fish-green, #10b981);
}

/* ─── Forecast Row ─── */
.forecast-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0;
}
.forecast-day {
    flex: 0 0 auto;
    width: 50px;
    text-align: center;
    padding: 8px 4px;
    background: var(--fish-card, rgba(255,255,255,0.04));
    border-radius: var(--fish-radius-sm, 4px);
    border: 1px solid var(--fish-card-border, rgba(255,255,255,0.08));
}
.forecast-day .day-name {
    font-size: 0.65rem;
    color: var(--fish-text-muted, #94a3b8);
    font-weight: 600;
    margin-bottom: 4px;
}
.forecast-day .day-score {
    font-size: 0.9rem;
    font-weight: 800;
}
.forecast-day .day-score.low { color: var(--fish-green, #10b981); }
.forecast-day .day-score.moderate { color: var(--fish-gold, #f59e0b); }
.forecast-day .day-score.high { color: var(--fish-orange, #f97316); }
.forecast-day .day-score.extreme { color: var(--fish-red, #ef4444); }

/* ─── Hidden Gems ─── */
.gem-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--fish-divider, rgba(255,255,255,0.06));
    font-size: 0.82rem;
    cursor: pointer;
    transition: color 0.2s;
}
.gem-item:last-child { border-bottom: none; }
.gem-item:hover { color: var(--fish-accent, #06b6d4); }
.gem-icon { font-size: 1.1rem; }
.gem-name { flex: 1; }
.gem-score {
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--fish-radius-full, 9999px);
    font-size: 0.72rem;
}
.gem-score.low { background: rgba(16,185,129,0.15); color: #34d399; }

/* ─── Loading Overlay ─── */
.map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 13, 20, 0.7);
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.3s;
}
.map-loading.hidden { opacity: 0; }
.map-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--fish-bg-surface, #163352);
    border-top-color: var(--fish-accent, #06b6d4);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive ─── */
@media (max-width: 900px) {
    .map-wrapper {
        flex-direction: column;
        height: auto;
    }
    .map-area { height: 55vh; min-height: 350px; }
    .side-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--fish-glass-border, rgba(255,255,255,0.06));
        max-height: 45vh;
    }
    .filter-bar { padding: 10px 14px; gap: 8px; }
}
@media (max-width: 640px) {
    .filter-bar select,
    .filter-bar input[type="date"] { max-width: 120px; }
    .side-panel { padding: 12px; }
}
