/**
 * SCA Air Quality Map
 * Full-screen interactive AQI map with live data
 */

/* ── Base ── */
.sca-aqi-page {
    background: #1a2c45;
    min-height: 100vh;
}

/* ── Hero / Intro Bar ── */
.sca-aqi-hero {
    background: #1a2c45;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 100px 0 0;
}

.sca-aqi-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.sca-aqi-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 40px;
    padding-bottom: 24px;
}

.sca-aqi-eyebrow {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #a07b53;
    margin-bottom: 12px;
    display: block;
}

.sca-aqi-h1 {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 0 0 8px;
}

.sca-aqi-lede {
    font-size: 15px;
    color: rgba(255,255,255,0.45);
    max-width: 480px;
    line-height: 1.6;
    margin: 0;
}

/* ── Search + Locate ── */
.sca-aqi-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.sca-aqi-search-wrap {
    position: relative;
}

.sca-aqi-search {
    width: 280px;
    padding: 12px 16px 12px 42px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #ffffff;
    outline: none;
    transition: all 0.2s;
}

.sca-aqi-search::placeholder {
    color: rgba(255,255,255,0.3);
}

.sca-aqi-search:focus {
    background: rgba(255,255,255,0.1);
    border-color: #a07b53;
    box-shadow: 0 0 0 3px rgba(160,123,83,0.15);
}

.sca-aqi-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: rgba(255,255,255,0.3);
    pointer-events: none;
}

.sca-aqi-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #1a2c45;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    overflow: hidden;
    display: none;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    max-height: 260px;
    overflow-y: auto;
    z-index: 1100;
}

.sca-aqi-search-results.active {
    display: block;
}

.sca-aqi-search-item {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.sca-aqi-search-item:hover {
    background: rgba(255,255,255,0.06);
    color: #ffffff;
}

.sca-aqi-search-item:last-child {
    border-bottom: none;
}

.sca-aqi-search-item small {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    margin-top: 2px;
    font-weight: 400;
}

.sca-aqi-locate {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sca-aqi-locate:hover {
    background: rgba(255,255,255,0.1);
    color: #ffffff;
    border-color: rgba(255,255,255,0.2);
}

.sca-aqi-locate svg {
    width: 18px;
    height: 18px;
}

/* ── Map Container ── */
.sca-aqi-map-wrap {
    position: relative;
    height: calc(100vh - 180px);
    min-height: 500px;
}

#sca-aqi-map {
    width: 100%;
    height: 100%;
}

/* Override Leaflet */
.sca-aqi-map-wrap .leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.sca-aqi-map-wrap .leaflet-control-zoom a {
    background: #1a2c45 !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 18px !important;
    border-radius: 8px !important;
}

.sca-aqi-map-wrap .leaflet-control-zoom a:first-child {
    border-radius: 8px 8px 0 0 !important;
}

.sca-aqi-map-wrap .leaflet-control-zoom a:last-child {
    border-radius: 0 0 8px 8px !important;
}

.sca-aqi-map-wrap .leaflet-control-zoom a:hover {
    background: #243a57 !important;
}

.sca-aqi-map-wrap .leaflet-control-attribution {
    background: rgba(26,44,69,0.85) !important;
    color: rgba(255,255,255,0.4) !important;
    font-size: 10px !important;
    padding: 2px 8px !important;
}

.sca-aqi-map-wrap .leaflet-control-attribution a {
    color: #a07b53 !important;
}

/* ── Map Toggles ── */
.sca-aqi-toggles {
    position: absolute;
    top: 16px;
    right: 60px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sca-aqi-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1a2c45;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.sca-aqi-toggle:hover {
    border-color: rgba(255,255,255,0.2);
    background: #243a57;
}

.sca-aqi-toggle input {
    appearance: none;
    -webkit-appearance: none;
    width: 36px;
    height: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 99px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.sca-aqi-toggle input::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    transition: all 0.2s;
}

.sca-aqi-toggle input:checked {
    background: #a07b53;
}

.sca-aqi-toggle input:checked::after {
    left: 18px;
    background: #fff;
}

.sca-aqi-toggle-label {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
}

/* ── Legend ── */
.sca-aqi-legend {
    position: absolute;
    bottom: 24px;
    left: 24px;
    z-index: 1000;
    background: #1a2c45;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 20px;
    width: 240px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.sca-aqi-legend-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #a07b53;
    margin-bottom: 14px;
}

.sca-aqi-legend-scale {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sca-aqi-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sca-aqi-legend-color {
    width: 28px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
}

.sca-aqi-legend-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
}

.sca-aqi-legend-range {
    font-size: 11px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: rgba(255,255,255,0.3);
    margin-left: auto;
}

/* ── Detail Panel ── */
.sca-aqi-panel {
    position: absolute;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    background: #1a2c45;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 28px;
    width: 320px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    transform: translateY(calc(100% + 40px));
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.sca-aqi-panel.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.sca-aqi-panel-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.15s;
}

.sca-aqi-panel-close:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.sca-aqi-panel-eyebrow {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #a07b53;
    margin-bottom: 4px;
}

.sca-aqi-panel-city {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    padding-right: 32px;
}

.sca-aqi-panel-reading {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.sca-aqi-panel-number {
    font-size: 52px;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    line-height: 1;
    letter-spacing: -0.03em;
}

.sca-aqi-panel-meta {
    flex: 1;
}

.sca-aqi-panel-status {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 2px;
}

.sca-aqi-panel-desc {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    line-height: 1.4;
}

.sca-aqi-panel-pollutants {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.sca-aqi-pollutant {
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

.sca-aqi-pollutant-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.sca-aqi-pollutant-value {
    font-size: 16px;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    color: rgba(255,255,255,0.8);
}

.sca-aqi-panel-cta {
    display: block;
    width: 100%;
    padding: 14px;
    background: #a07b53;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
}

.sca-aqi-panel-cta:hover {
    background: #8a6540;
    color: #fff;
    transform: translateY(-1px);
}

.sca-aqi-panel-tip {
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    text-align: center;
    margin-top: 10px;
    line-height: 1.4;
}

/* ── AQI Markers ── */
.sca-aqi-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    border: 3px solid rgba(255,255,255,0.9);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.2s;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.sca-aqi-marker:hover {
    transform: scale(1.2);
    z-index: 999 !important;
}

/* ── Loading ── */
.sca-aqi-loading {
    position: absolute;
    inset: 0;
    z-index: 2000;
    background: #1a2c45;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    transition: opacity 0.6s, visibility 0.6s;
}

.sca-aqi-loading.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.sca-aqi-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: #a07b53;
    border-radius: 50%;
    animation: scaAqiSpin 0.8s linear infinite;
}

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

.sca-aqi-loading-text {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.4);
}

/* ── Bottom CTA Section ── */
.sca-aqi-bottom-cta {
    background: #0f1d30;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 64px 0;
}

.sca-aqi-cta-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 40px;
    align-items: center;
}

.sca-aqi-cta-inner h2 {
    font-size: 28px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.02em;
    margin: 0 0 8px;
}

.sca-aqi-cta-inner p {
    font-size: 15px;
    color: rgba(255,255,255,0.4);
    margin: 0;
    max-width: 480px;
    line-height: 1.6;
}

.sca-aqi-cta-btns {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.sca-aqi-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid transparent;
    white-space: nowrap;
}

.sca-aqi-btn--primary {
    background: #a07b53;
    color: #ffffff;
}

.sca-aqi-btn--primary:hover {
    background: #8a6540;
    color: #ffffff;
}

.sca-aqi-btn--ghost {
    background: transparent;
    color: #ffffff;
    border-color: rgba(255,255,255,0.2);
}

.sca-aqi-btn--ghost:hover {
    border-color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.05);
    color: #ffffff;
}

/* ── Location Toast ── */
.sca-aqi-toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #1a2c45;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 16px 24px;
    z-index: 2000;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.sca-aqi-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.sca-aqi-toast strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
}

.sca-aqi-toast span {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .sca-aqi-intro {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    
    .sca-aqi-search {
        width: 220px;
    }
    
    .sca-aqi-map-wrap {
        height: calc(100vh - 240px);
    }
    
    .sca-aqi-panel {
        width: calc(100% - 32px);
        left: 16px;
        right: 16px;
    }
    
    .sca-aqi-legend {
        width: 200px;
        padding: 16px;
        bottom: 16px;
        left: 16px;
    }
    
    .sca-aqi-toggles {
        right: 52px;
        top: 12px;
    }
    
    .sca-aqi-cta-inner {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .sca-aqi-cta-btns {
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .sca-aqi-search {
        width: 160px;
    }
    
    .sca-aqi-panel-number {
        font-size: 40px;
    }
}
