* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1f2937;
    background: #f5f7f8;
}

.station-map-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.station-map-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.station-map-header h1 {
    margin: 0;
    font-size: 20px;
}

.station-map-header p {
    margin: 3px 0 0;
    font-size: 12px;
    color: #6b7280;
}

.back-button {
    text-decoration: none;
    color: #1f2937;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    white-space: nowrap;
}

.station-map-toolbar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 7px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.station-summary {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13px;
}

#rain-updated-at {
    color: #64748b;
    font-size: 12px;
}

.station-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
}

.station-filters label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.station-map-legend {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 7px 16px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 12px;
}

.station-map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, .14);
}

.dot.green,
.station-marker.green {
    background: #22c55e;
}

.dot.yellow,
.station-marker.yellow {
    background: #facc15;
}

.dot.orange,
.station-marker.orange {
    background: #f97316;
}

.dot.red,
.station-marker.red {
    background: #dc2626;
}

.dot.stale,
.station-marker.stale {
    background: #cbd5e1;
}

.station-marker.no_data {
    background: #94a3b8;
}

main {
    flex: 1;
    min-height: 0;
}

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

.station-marker {
    width: 19px;
    height: 19px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 5px rgba(0, 0, 0, .45);
    transition:
        background-color .25s ease,
        transform .25s ease,
        box-shadow .25s ease;
}

.station-marker.has-water {
    width: 23px;
    height: 23px;
    border-width: 3px;
    box-shadow:
        0 0 0 2px rgba(37, 99, 235, .42),
        0 1px 5px rgba(0, 0, 0, .45);
}

.station-marker.red {
    transform: scale(1.08);
}

.station-map-error {
    display: none;
    background: #fff7ed;
    color: #9a3412;
    border-bottom: 1px solid #fed7aa;
    padding: 6px 16px;
    font-size: 12px;
}

.station-map-error.show {
    display: block;
}

.station-popup {
    min-width: 225px;
}

.station-popup h3 {
    margin: 0 0 3px;
    font-size: 16px;
}

.station-popup .code,
.station-popup .owner {
    font-size: 11px;
    color: #6b7280;
}

.station-popup .owner {
    margin-top: 2px;
    margin-bottom: 8px;
}

.rain-box {
    border-radius: 10px;
    padding: 9px 10px;
    margin: 8px 0;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.rain-box.yellow {
    background: #fefce8;
    border-color: #fde047;
}

.rain-box.orange {
    background: #fff7ed;
    border-color: #fb923c;
}

.rain-box.red {
    background: #fef2f2;
    border-color: #f87171;
}

.rain-box.stale {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.rain-box.no_data {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.rain-label {
    color: #475569;
    font-size: 11px;
}

.rain-value {
    font-size: 21px;
    font-weight: 750;
    line-height: 1.2;
    margin-top: 2px;
}

.rain-value span {
    font-size: 12px;
    font-weight: 500;
}

.rain-time,
.rain-freshness {
    margin-top: 3px;
    color: #64748b;
    font-size: 11px;
}

.sensor-list {
    padding-top: 7px;
    border-top: 1px solid #e5e7eb;
    font-size: 12px;
    line-height: 1.6;
}

.coordinate {
    margin-top: 7px;
    font-size: 10px;
    color: #94a3b8;
}

@media (max-width: 640px) {
    .station-map-header {
        padding: 8px 10px;
    }

    .station-map-header h1 {
        font-size: 16px;
    }

    .station-map-header p {
        display: none;
    }

    .back-button {
        padding: 6px 8px;
        font-size: 11px;
    }

    .station-map-toolbar,
    .station-map-legend {
        padding: 6px 10px;
    }

    .station-summary {
        gap: 6px;
    }

    .station-filters {
        gap: 8px;
        font-size: 11px;
    }

    .station-map-legend {
        gap: 9px;
        font-size: 11px;
    }
}
