/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    background: #0f172a;
}

/* === Header === */
#header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(15, 23, 42, 0) 100%);
    padding: 16px 24px 32px;
    pointer-events: none;
    text-align: center;
}

#header h1 {
    color: #f8fafc;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

#header .subtitle {
    color: #0f172a;
    font-size: 13px;
    font-weight: 700;
    margin-top: 4px;
    text-shadow: none;
}

/* === Metro Selector === */
#metro-selector {
    position: absolute;
    top: 80px;
    left: 16px;
    z-index: 10;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    width: 272px;
}

#metro-selector label {
    display: block;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

#metro-select {
    appearance: none;
    background: rgba(30, 41, 59, 0.8);
    color: #f1f5f9;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 8px 32px 8px 12px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    min-width: 240px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8.5L1 3.5h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.2s;
}

#metro-select:hover {
    border-color: rgba(148, 163, 184, 0.4);
}

#metro-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* === Zip Code Lookup Panel === */
#zip-panel {
    position: absolute;
    top: 160px;
    left: 16px;
    z-index: 12;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 12px;
    padding: 12px 16px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    width: 272px;
}

#zip-panel label {
    display: block;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.zip-input-row {
    display: flex;
    gap: 6px;
}

#zip-input {
    flex: 1;
    appearance: none;
    background: rgba(30, 41, 59, 0.8);
    color: #f1f5f9;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 7px 12px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    transition: border-color 0.2s;
}

#zip-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

#zip-go {
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 7px 14px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#zip-go:hover {
    background: #2563eb;
}

.zip-results {
    margin-top: 10px;
}

.zip-results.hidden,
.zip-error.hidden {
    display: none;
}

.zip-geoid {
    color: #f1f5f9;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.zip-desc {
    font-size: 11.5px;
    line-height: 1.5;
    color: #cbd5e1;
    margin-bottom: 6px;
}

.zip-desc .zip-pct-value {
    font-weight: 700;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
}

/* Colorbar */
.zip-colorbar-wrap {
    margin-top: 14px;
    margin-bottom: 6px;
}

.zip-colorbar {
    position: relative;
    width: 100%;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(to right, #d73027, #ffffff, #1a9850);
    margin-top: 42px;
}

.zip-marker {
    position: absolute;
    top: -18px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    pointer-events: none;
}

.zip-marker-arrow {
    font-size: 12px;
    line-height: 1;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.zip-marker-label {
    position: absolute;
    top: -12px;
    font-size: 9px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.zip-colorbar-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 3px;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 400;
}

/* Legend row under colorbar */
.zip-legend-row {
    display: flex;
    gap: 14px;
    margin-top: 2px;
}

.zip-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 500;
}

.zip-legend-swatch {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.zip-error {
    margin-top: 8px;
    color: #f87171;
    font-size: 12px;
    font-weight: 500;
}

/* PCS Station Detail Cards */
.pcs-details {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.pcs-section-title {
    color: #94a3b8;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.pcs-card {
    background: rgba(30, 41, 59, 0.6);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-left: 3px solid transparent;
}

.pcs-card-dist {
    border-left-color: #60a5fa;
}

.pcs-card-visit {
    border-left-color: #f59e0b;
}

.pcs-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.pcs-card-dist .pcs-card-icon {
    color: #60a5fa;
    font-size: 8px;
}

.pcs-card-visit .pcs-card-icon {
    color: #f59e0b;
    font-size: 8px;
}

.pcs-card-label {
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 600;
}

.pcs-card-body {
    font-size: 11px;
    line-height: 1.55;
    color: #cbd5e1;
}

.pcs-card-body .pcs-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.pcs-card-body .pcs-stat-label {
    color: #94a3b8;
    font-size: 10.5px;
}

.pcs-card-body .pcs-stat-value {
    color: #f1f5f9;
    font-weight: 600;
    font-size: 11px;
}

.pcs-card-body .pcs-nearby-title {
    color: #94a3b8;
    font-size: 10px;
    margin-top: 6px;
    margin-bottom: 2px;
}

.pcs-card-body .pcs-nearby-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pcs-card-body .pcs-nearby-list li {
    color: #94a3b8;
    font-size: 10px;
    line-height: 1.5;
    padding-left: 8px;
    position: relative;
}

.pcs-card-body .pcs-nearby-list li::before {
    content: '\2022';
    position: absolute;
    left: 0;
    color: #64748b;
}

.pcs-card-body .pcs-nearby-list li .poi-name {
    color: #cbd5e1;
}

.pcs-no-data {
    color: #64748b;
    font-size: 10.5px;
    font-style: italic;
}

/* PCS Map Markers */
.pcs-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.8);
    cursor: default;
}

.pcs-marker-dist {
    background: #2563eb;
}

.pcs-marker-visit {
    background: #d97706;
}

/* === Loading Indicator === */
#loading {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 16px;
    padding: 24px 32px;
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    align-items: center;
    gap: 12px;
}

#loading.visible {
    display: flex;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(148, 163, 184, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Map Container === */
#comparison-container {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
}

.map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
}

/* === Swipe Labels === */
.swipe-label {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(8px);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 6px 14px;
    border-radius: 20px;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s;
}

#left-label {
    left: 16px;
}

#right-label {
    right: 16px;
}

/* === Legends === */
.legend {
    position: absolute;
    bottom: 32px;
    z-index: 10;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    width: 272px;
    transition: opacity 0.3s;
}

#legend-left {
    left: 16px;
}


.legend h4 {
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 0.01em;
}

.legend-gradient {
    width: 100%;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 400;
}

/* === Tooltip === */
.tooltip {
    display: none;
    position: absolute;
    z-index: 15;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    padding: 12px 16px;
    color: #e2e8f0;
    font-size: 12px;
    line-height: 1.6;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    max-width: 260px;
    white-space: nowrap;
}

.tooltip-title {
    font-weight: 600;
    font-size: 12px;
    color: #f1f5f9;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.tooltip-key {
    color: #94a3b8;
}

.tooltip-value {
    font-weight: 600;
    color: #f1f5f9;
}

/* === Mapbox GL Compare overrides === */
.mapboxgl-compare {
    z-index: 6;
}

.compare-swiper-vertical {
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.3) !important;
}

/* === Info Button === */
#info-btn {
    position: absolute;
    bottom: 32px;
    right: 16px;
    z-index: 12;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(10px);
    color: #94a3b8;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

#info-btn:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(148, 163, 184, 0.5);
    color: #e2e8f0;
    transform: scale(1.08);
}

/* === Info Modal === */
.info-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: infoFadeIn 0.2s ease;
}

.info-overlay.hidden {
    display: none;
}

@keyframes infoFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.info-modal {
    position: relative;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 16px;
    padding: 32px 36px;
    max-width: 520px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
    animation: infoSlideUp 0.25s ease;
}

@keyframes infoSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.info-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: #64748b;
    font-size: 22px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.15s;
}

.info-close:hover {
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.12);
}

.info-title {
    color: #f1f5f9;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
    letter-spacing: -0.01em;
}

.info-version {
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 20px;
}

.info-section {
    margin-bottom: 18px;
}

.info-section h3 {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.info-section p {
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.65;
    margin-bottom: 6px;
}

.info-steps {
    list-style: none;
    counter-reset: info-step;
    padding: 0;
    margin: 0;
}

.info-steps li {
    counter-increment: info-step;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.6;
    padding-left: 28px;
    position: relative;
    margin-bottom: 8px;
}

.info-steps li::before {
    content: counter(info-step);
    position: absolute;
    left: 0;
    width: 20px;
    height: 20px;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    font-size: 11px;
    font-weight: 700;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-metric {
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 10px;
    padding-left: 12px;
    border-left: 2px solid rgba(148, 163, 184, 0.2);
}

.info-metric strong {
    color: #e2e8f0;
}

.info-color-low {
    color: #f87171;
    font-weight: 600;
}

.info-color-high {
    color: #4ade80;
    font-weight: 600;
}

.info-footer {
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    margin-bottom: 0;
}

.info-footer p {
    color: #64748b;
    font-size: 12px;
    font-style: italic;
}

/* === Mobile Warning === */
#mobile-warning {
    display: none;
}

@media (max-width: 768px) {
    #mobile-warning {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        background: #0f172a;
        color: #94a3b8;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 32px;
        font-size: 16px;
        line-height: 1.6;
    }

    #comparison-container,
    #header,
    #metro-selector,
    #zip-panel,
    #info-btn,
    .legend,
    .swipe-label {
        display: none;
    }
}

/* === Mapbox attribution styling === */
.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right {
    opacity: 0.6;
}

.mapboxgl-ctrl-attrib {
    font-size: 10px !important;
}
