* {
    box-sizing: border-box;
}


.location-controls { display: flex; align-items: stretch; gap: 12px; margin: 10px 0; }
.location-url { display: flex; flex: 1; min-width: 0; align-items: center; border: 1px solid #cbd5e1; border-radius: 8px; overflow: hidden; }
.location-box .url-prefix { margin: 0; padding: 12px; background: #f1f5f9; overflow-wrap: anywhere; }
.location-box .location-url input { flex: 1; min-width: 0; margin: 0; border: 0; border-radius: 0; padding: 12px; font-size: 15px; }
.location-url:focus-within { outline: 2px solid #2563eb; outline-offset: 2px; }
#locationHelp { color: #6b7280; font-size: 13px; line-height: 1.5; }
@media (max-width: 800px) {
    .location-controls, .location-url { flex-direction: column; align-items: stretch; }
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f7fb;
    color: #172033;
}

.app {
    max-width: 1500px;
    margin: auto;
    padding: 24px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header h1 {
    margin: 0;
    font-size: 28px;
}

.header p {
    margin: 6px 0 0;
    color: #6b7280;
}

.refresh-button {
    border: 0;
    background: #111827;
    color: white;
    padding: 12px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.refresh-button:hover {
    opacity: .9;
}

.location-box {
    background: white;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 20px;
}

.location-box span {
    color: #4b5563;
    margin-left: 8px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.stat-label {
    display: block;
    color: #6b7280;
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: 30px;
}

.peak-zone {
    display: flex;
    justify-content: space-between;
    align-items: center;

    background: #fff7ed;
    border: 1px solid #fed7aa;

    border-radius: 12px;

    padding: 20px;

    margin-bottom: 20px;
}

.peak-zone h2 {
    margin: 6px 0 0;
}

.peak-label {
    font-weight: bold;
}

.peak-zone > strong {
    font-size: 24px;
}

.content {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
}

.map-container {
    position: relative;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

#map {
    height: 650px;
    width: 100%;
}

.loading {
    position: absolute;
    top: 20px;
    left: 20px;

    z-index: 1000;

    background: white;
    padding: 10px 15px;

    border-radius: 8px;

    box-shadow: 0 2px 10px rgba(0,0,0,.15);
}

.zones {
    background: white;
    border-radius: 12px;
    padding: 20px;
}

.zones h2 {
    margin-top: 0;
}

.zone-item {
    padding: 14px 0;
    border-bottom: 1px solid #eee;
}

.zone-item:last-child {
    border-bottom: 0;
}

.zone-name {
    font-weight: 600;
}

.zone-count {
    color: #6b7280;
    margin-top: 4px;
}

.status {
    margin-top: 15px;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
}

@media (max-width: 900px) {

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .content {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 600px) {

    .app {
        padding: 12px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .peak-zone {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    #map {
        height: 500px;
    }
}

.location-box input {
    padding: 12px;
    margin: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    max-width: 100%;
}

.refresh-button:disabled { opacity: .6; cursor: wait; }
#stateList { max-height: 260px; overflow-y: auto; margin-bottom: 24px; }

body { background: #eef2f8; }
.app { max-width: 1900px; }
.header h1 { letter-spacing: -1px; font-size: 34px; }
.stat-card { border: 1px solid #e2e8f0; border-top: 4px solid #6366f1; }
.stat-card:nth-child(2) { border-top-color: #10b981; }
.stat-card:nth-child(3) { border-top-color: #f59e0b; }
.stat-card:nth-child(4) { border-top-color: #06b6d4; }
.content { grid-template-columns: minmax(0, 1fr) 300px; align-items: stretch; }
.map-container { display: flex; flex-direction: column; min-width: 0; box-shadow: 0 12px 32px #1720330d; }
.map-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; }
#map { flex: 1 1 auto; height: auto; min-height: max(680px, 80vh); }
.zones { border: 1px solid #e2e8f0; }
.zones h2 { font-size: 19px; }
#zoneList .zone-item { display: block; width: 100%; border: 0; text-align: left; font: inherit; background: #eef2ff; color: #3730a3; border-radius: 12px; padding: 15px; margin-bottom: 10px; cursor: pointer; }
#zoneList .zone-item:nth-child(2) { background: #ecfdf5; color: #047857; }
#zoneList .zone-item:nth-child(3) { background: #fff7ed; color: #c2410c; }
#zoneList .zone-item:nth-child(4) { background: #f0f9ff; color: #0369a1; }
#zoneList .zone-item:nth-child(5) { background: #fdf2f8; color: #be185d; }
#zoneList .zone-item:hover { filter: brightness(.97); }
#zoneList .zone-item:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.zone-bar { height: 6px; background: #ffffffa0; margin-top: 12px; border-radius: 4px; overflow: hidden; }
.zone-bar span { display: block; height: 100%; background: currentColor; border-radius: inherit; }
#statusText:empty { display: none; }
.status { justify-content: flex-end; gap: 20px; font-size: 13px; }
@media (max-width: 900px) {
    .content { grid-template-columns: 1fr; }
    #map { min-height: 520px; height: 70vh; }
}

/* Shared action style, including Leaflet's link-based zoom controls. */
button, .leaflet-control-zoom a {
    background: linear-gradient(135deg, #065FE7 0%, #8330E5 100%) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 15px rgba(6,95,231,0.30), 0 2px 8px rgba(131,48,229,0.20) !important;
    transition: filter .15s ease, transform .15s ease;
}
button:not(:disabled):hover, .leaflet-control-zoom a:hover { filter: brightness(1.08); }
button:not(:disabled):active { transform: translateY(1px); }
button:focus-visible, .leaflet-control-zoom a:focus-visible {
    outline: 3px solid #065FE7 !important;
    outline-offset: 3px;
}
#zoneList .zone-count { color: #FFFFFF; opacity: .9; }
#zoneList .zone-bar { background: rgba(255,255,255,.25); }
#zoneList .zone-bar span { background: #FFFFFF; }
#zoneList .zone-item:last-child { margin-bottom: 0; }
.map-toolbar { flex: 0 0 auto; flex-wrap: wrap; }
.map-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.map-search { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 0 20px 14px; font-size: 13px; color: #4b5563; }
.map-search input { flex: 1; min-width: 160px; padding: 11px 13px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; }
.map-search input:focus { outline: 2px solid #065FE7; outline-offset: 2px; }
.map-container:fullscreen { width: 100%; height: 100%; border-radius: 0; background: white; }
.map-container:fullscreen #map { min-height: 0; height: 0; flex: 1; }
.leaflet-control-zoom a { width: 36px; height: 36px; line-height: 36px; }
@media (prefers-reduced-motion: reduce) {
    button, .leaflet-control-zoom a { transition: none; }
}
