
/* ==========================================
   NYC 3D URBAN HEAT INTELLIGENCE
   Responsive Digital Twin Dashboard
========================================== */

:root {
    --background: #07101e;
    --panel: rgba(5, 16, 34, 0.48);
    --panel-strong: rgba(7, 17, 32, 0.97);

    --purple: #a56bff;
    --purple-light: #c7aaff;
    --cyan: #00cfff;
    --blue: #087cff;
    --orange: #ff642d;
    --green: #40e9a0;
    --red: #ff555d;

    --white: #f4f7ff;
    --muted: #a1aec2;
    --border: rgba(44, 172, 255, 0.35);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--background);
    color: var(--white);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button {
    font: inherit;
}

.main-scene {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: #07101e;
}

/* ==========================================
   3D CITY VIEW
========================================== */

#cesiumContainer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: #07101e;
}

.cesium-viewer {
    width: 100%;
    height: 100%;
}

.cesium-viewer-bottom,
.cesium-widget-credits {
    display: none !important;
}

/* ==========================================
   TOP HEADER
========================================== */

.topbar {
    position: absolute;
    z-index: 20;
    top: 10px;
    left: 14px;
    right: 14px;
    height: 65px;
    padding: 0 16px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border: 1px solid rgba(35, 170, 255, .45);
    border-radius: 13px;

    background: rgba(5, 14, 29, .48);
    backdrop-filter: blur(18px) saturate(145%);
    -webkit-backdrop-filter: blur(18px) saturate(145%);

    box-shadow:
        0 8px 32px rgba(0, 0, 0, .20),
        inset 0 1px 0 rgba(255, 255, 255, .07);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-icon {
    width: 43px;
    height: 43px;
    flex-shrink: 0;

    display: grid;
    place-items: center;

    border-radius: 11px;
    border: 1px solid rgba(39, 207, 255, .6);

    color: var(--cyan);
    background: rgba(39, 207, 255, .1);

    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1px;

    box-shadow: 0 0 18px rgba(0, 207, 255, .35);
}

.brand-copy {
    min-width: 0;
}

.brand-copy h1 {
    color: var(--white);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .7px;
    white-space: nowrap;
}

.brand-copy p {
    margin-top: 6px;
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 1px;
    white-space: nowrap;
}

.top-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-chip {
    min-height: 34px;
    padding: 0 13px;

    display: flex;
    align-items: center;
    gap: 9px;

    border: 1px solid rgba(55, 165, 255, .3);
    border-radius: 9px;

    background: rgba(0, 130, 255, .10);
    color: #dce6f6;

    font-size: 9px;
    letter-spacing: 1px;

    backdrop-filter: blur(12px);
}

.live-dot,
.scene-live-dot {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 12px rgba(84, 223, 160, .8);
}

.chip-icon {
    color: var(--cyan);
    font-size: 16px;
}

.home-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 10px 15px;

    color: var(--cyan);
    text-decoration: none;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    white-space: nowrap;

    background: rgba(0, 130, 255, .12);
    border: 1px solid rgba(39, 207, 255, .38);
    border-radius: 7px;

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all .3s ease;
}

.home-button:hover {
    color: #fff;
    background: rgba(0, 130, 255, .25);
    border-color: var(--cyan);
    box-shadow: 0 0 15px rgba(39, 207, 255, .22);
    transform: translateY(-2px);
}

.home-icon {
    font-size: 19px;
    line-height: 1;
}

/* ==========================================
   LEFT LAYER MENU
========================================== */

.layer-menu {
    position: absolute;
    z-index: 12;
    top: 90px;
    left: 14px;
    width: 175px;
    padding: 9px;

    border: 1px solid rgba(50, 160, 255, .32);
    border-radius: 12px;

    background: rgba(3, 15, 34, .48);
    backdrop-filter: blur(18px) saturate(145%);
    -webkit-backdrop-filter: blur(18px) saturate(145%);

    box-shadow:
        0 8px 32px rgba(0, 0, 0, .20),
        inset 0 1px 0 rgba(255, 255, 255, .07);
}

.menu-heading,
.menu-divider,
.connection-box {
    display: none;
}

.layer-item {
    width: 100%;
    min-height: 55px;
    padding: 7px;

    display: flex;
    align-items: center;
    gap: 8px;

    border: 1px solid transparent;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    border-radius: 9px;

    color: var(--white);
    background: transparent;
    text-align: left;
    cursor: pointer;

    transition: background .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.layer-item:hover {
    border-color: var(--cyan);
    box-shadow: 0 0 13px rgba(0, 180, 255, .2);
}

.layer-item.active {
    background: rgba(0, 130, 255, .22);
    border: 1px solid rgba(0, 190, 255, .85);

    box-shadow:
        inset 3px 0 0 var(--cyan),
        0 0 16px rgba(0, 145, 255, .25);
}

.layer-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;

    display: grid;
    place-items: center;

    border-radius: 7px;
    background: rgba(255, 255, 255, .07);

    font-size: 17px;
}

.building-icon { color: #c9d7eb; }
.temperature-icon { color: #ff825e; }
.ndvi-icon { color: var(--green); }
.density-icon { color: var(--cyan); }
.ai-icon { color: var(--purple-light); }

.layer-info {
    flex: 1;
    min-width: 0;

    display: flex;
    flex-direction: column;
    gap: 3px;
}

.layer-info b {
    color: #f0f4ff;
    font-size: 10px;
    font-weight: 600;
    white-space: normal;
}

.layer-info small {
    color: var(--muted);
    font-size: 8px;
}

.layer-state {
    flex-shrink: 0;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .5px;
}

.active-state { color: var(--green); }
.pending-state { color: #b5a2eb; }

/* ==========================================
   RIGHT OVERVIEW PANEL
========================================== */

.overview-panel {
    position: absolute;
    z-index: 12;
    top: 90px;
    right: 14px;
    width: 220px;
    padding: 14px;

    border: 1px solid rgba(0, 175, 255, .38);
    border-radius: 12px;

    background: rgba(4, 17, 39, .48);
    backdrop-filter: blur(18px) saturate(145%);
    -webkit-backdrop-filter: blur(18px) saturate(145%);

    box-shadow:
        0 8px 32px rgba(0, 0, 0, .20),
        inset 0 1px 0 rgba(255, 255, 255, .07);
}

.card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 11px;
    border-bottom: 1px solid rgba(255, 255, 255, .09);
}

.card-heading h3 {
    margin-top: 7px;
    font-size: 13px;
    font-weight: 600;
}

.heading-icon {
    color: var(--cyan);
    font-size: 22px;
}

.overview-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
}

.overview-stat span {
    color: #bdc8d9;
    font-size: 9px;
}

.overview-stat strong {
    color: var(--cyan);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .2px;
}

.overview-stat strong.hot-value {
    color: var(--orange);
}

.overview-stat strong.cool-value {
    color: #56d8ff;
}

.temperature-scale {
    margin-top: 14px;
}

.scale-gradient,
.heat-gradient {
    height: 10px;
    border-radius: 20px;

    background: linear-gradient(
        90deg,
        #258bff,
        #27d5d0,
        #bce96a,
        #ffd54c,
        #ff8a36,
        #f23e42
    );
}

.scale-gradient {
    box-shadow: 0 0 10px rgba(0, 180, 255, .2);
}

.scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 7px;

    color: #c7d1e0;
    font-size: 8px;
    font-weight: 700;
}

.overview-divider {
    height: 1px;
    margin: 12px 0;
    background: rgba(255, 255, 255, .10);
}

.compact-stat {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-top: 9px;
}

.compact-stat strong {
    font-size: 13px;
}

/* ==========================================
   SELECTED LOCATION CARD
========================================== */

.location-card {
    display: none;

    position: absolute;
    z-index: 16;
    top: 22%;
    left: 55%;

    width: 295px;
    max-height: min(70vh, 540px);
    overflow-y: auto;
    padding: 15px;

    transform: none;

    border: 1px solid rgba(0, 170, 255, .48);
    border-radius: 12px;

    background: rgba(3, 17, 39, .48);
    backdrop-filter: blur(18px) saturate(145%);
    -webkit-backdrop-filter: blur(18px) saturate(145%);

    box-shadow:
        0 8px 32px rgba(0, 0, 0, .20),
        inset 0 1px 0 rgba(255, 255, 255, .07);
}

.location-card.is-visible {
    display: block !important;
}

.location-card-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.location-card h3 {
    margin-top: 8px;
    font-size: 15px;
    font-weight: 700;
}

.location-symbol {
    color: var(--cyan);
    font-size: 23px;
}

#closeLocation {
    border: 0;
    background: transparent;
    color: white;
    font-size: 23px;
    cursor: pointer;
}

#closeLocation:hover {
    color: var(--cyan);
}

.details-description {
    margin-top: 12px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.7;
}

.location-divider {
    height: 1px;
    margin: 10px 0;
    background: rgba(255, 255, 255, .10);
}

.location-metric {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.metric-symbol {
    width: 32px;
    height: 32px;
    flex-shrink: 0;

    display: grid;
    place-items: center;

    border-radius: 9px;
    background: rgba(255, 255, 255, .07);
    font-size: 19px;
}

.thermal-symbol { color: var(--orange); }
.air-symbol { color: var(--cyan); }
.risk-symbol { color: var(--red); }

.location-metric div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.location-metric small {
    color: #c0cada;
    font-size: 9px;
}

.location-metric strong {
    color: var(--cyan);
    font-size: 16px;
}

#areaTemperature { color: var(--orange); }
#areaNDVI { color: var(--green); }
#areaClassification { color: var(--red); }

#aiInsight {
    margin-top: 9px;
    color: #aab9cf;
    font-size: 8px;
    line-height: 1.6;
}

/* ==========================================
   MINI MAP
========================================== */

.map-label {
    position: absolute;
    z-index: 10;
    left: 14px;
    bottom: 14px;

    width: 165px;
    padding: 8px;

    display: flex;
    align-items: center;
    gap: 8px;

    border: 1px solid rgba(0, 160, 255, .45);
    border-radius: 11px;

    background: rgba(3, 17, 38, .48);
    backdrop-filter: blur(18px) saturate(145%);
    -webkit-backdrop-filter: blur(18px) saturate(145%);

    box-shadow: 0 8px 32px rgba(0, 0, 0, .20);
}

.mini-map {
    position: relative;
    width: 78px;
    height: 58px;
    overflow: hidden;
    flex-shrink: 0;

    border-radius: 7px;
    background: #102c43;
}

.map-grid {
    position: absolute;
    inset: 0;

    background-image:
        linear-gradient(rgba(78, 161, 191, .20) 1px, transparent 1px),
        linear-gradient(90deg, rgba(78, 161, 191, .20) 1px, transparent 1px);

    background-size: 10px 10px;
}

.map-river {
    position: absolute;
    top: -12px;
    left: 36px;
    width: 24px;
    height: 95px;
    transform: rotate(24deg);
    background: rgba(38, 141, 202, .45);
    border-radius: 50%;
}

.map-focus {
    position: absolute;
    top: 23px;
    left: 25px;
    width: 28px;
    height: 20px;
    border: 2px solid var(--cyan);
    box-shadow: 0 0 12px var(--cyan);
}

.north-label {
    position: absolute;
    top: 4px;
    right: 5px;
    color: white;
    font-size: 8px;
}

.map-caption {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.map-caption b {
    font-size: 9px;
    letter-spacing: .5px;
}

.map-caption small {
    color: var(--muted);
    font-size: 7px;
    letter-spacing: .5px;
}

/* ==========================================
   TEMPERATURE TREND
========================================== */

.trend-panel {
    position: absolute;
    z-index: 15;
    right: 14px;
    bottom: 14px;

    width: 300px;
    min-height: 160px;
    padding: 14px;

    border: 1px solid rgba(0, 165, 255, .35);
    border-radius: 12px;

    background: rgba(3, 17, 38, .48);
    backdrop-filter: blur(18px) saturate(145%);
    -webkit-backdrop-filter: blur(18px) saturate(145%);

    box-shadow:
        0 8px 32px rgba(0, 0, 0, .20),
        inset 0 1px 0 rgba(255, 255, 255, .07);
}

.trend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.trend-header h3 {
    margin-top: 7px;
    font-size: 12px;
}

.trend-period {
    color: var(--muted);
    font-size: 6px;
    letter-spacing: .8px;
}

.trend-placeholder {
    height: 105px;
    margin-top: 8px;

    display: block;
    border: 0;
}

.trend-axis {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    color: #9aa9bf;
    font-size: 8px;
}

.trend-empty {
    flex: 1;
    height: 75px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;

    border-left: 1px solid rgba(255, 255, 255, .10);
    background: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 100% 18px;

    text-align: center;
}

.trend-line-icon {
    color: var(--orange);
    font-size: 26px;
}

.trend-empty p {
    color: #e5eaf5;
    font-size: 8px;
}

.trend-empty small {
    color: var(--muted);
    font-size: 7px;
}

/* ==========================================
   STATUS AND SCENE LABEL
========================================== */

.scene-label {
    position: absolute;
    z-index: 8;
    left: 195px;
    bottom: 17px;

    display: flex;
    align-items: center;
    gap: 9px;

    color: #dce6f5;
    font-size: 8px;
    letter-spacing: 1.2px;
    text-shadow: 0 1px 5px #000;
}

.scene-live-dot {
    width: 6px;
    height: 6px;
}

.scene-separator {
    color: var(--purple-light);
}

.status {
    position: absolute;
    z-index: 20;
    top: 88px;
    left: 155px;

    display: flex;
    align-items: center;

    padding: 7px 10px;
    border: 1px solid rgba(0, 190, 255, .3);
    border-radius: 7px;

    background: rgba(7, 18, 34, .48);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);

    color: #dce6f5;
    font-size: 7px;
    letter-spacing: 1px;
}

.pulse {
    width: 7px;
    height: 7px;
    margin-right: 8px;
    flex-shrink: 0;

    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 10px var(--green);

    animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}

/* ==========================================
   THERMAL LEGEND
========================================== */

.thermal-legend {
    display: none;
}

.heat-gradient {
    margin-top: 10px;
}

.heat-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    color: var(--muted);
    font-size: 8px;
}

/* ==========================================
   TABLET
========================================== */

@media (max-width: 950px) {
    .topbar {
        left: 10px;
        right: 10px;
        padding: 0 12px;
    }

    .brand-copy h1 {
        font-size: 12px;
    }

    .brand-copy p {
        font-size: 8px;
    }

    .top-info {
        gap: 6px;
    }

    .top-chip {
        padding: 0 8px;
        font-size: 8px;
    }

    .home-button {
        padding: 8px 10px;
        font-size: 8px;
    }

    .layer-menu {
        left: 10px;
        width: 155px;
    }

    .overview-panel {
        right: 10px;
        width: 190px;
    }

    .location-card {
        left: 38%;
        width: 245px;
    }

    .trend-panel {
        right: 10px;
        width: 220px;
    }

    .map-label {
        left: 10px;
    }

    .scene-label {
        display: none;
    }

    .status {
        left: 175px;
    }
}

/* ==========================================
   MOBILE
========================================== */

@media (max-width: 650px) {

    html,
    body,
    .main-scene {
        width: 100%;
        height: 100%;
        height: 100dvh;
        overflow: hidden;
    }

    /* HEADER */

    .topbar {
        top: 8px;
        left: 8px;
        right: 8px;
        height: 54px;
        padding: 0 9px;
        border-radius: 10px;
    }

    .brand {
        gap: 7px;
    }

    .brand-icon {
        width: 34px;
        height: 34px;
        border-radius: 8px;
        font-size: 12px;
    }

    .brand-copy h1 {
        font-size: 9px;
        letter-spacing: .3px;
    }

    .brand-copy p {
        margin-top: 3px;
        font-size: 6px;
        letter-spacing: .3px;
    }

    .top-info {
        display: flex;
        gap: 5px;
    }

    .top-chip {
        display: none;
    }

    .home-button {
        padding: 7px 9px;
        gap: 4px;
        font-size: 7px;
        letter-spacing: .5px;
        border-radius: 6px;
    }

    .home-icon {
        font-size: 14px;
    }

    /* LAYER MENU */

    .layer-menu {
        top: 72px;
        left: 8px;
        width: min(145px, 39vw);
        padding: 7px;
        border-radius: 10px;
    }

    .layer-item {
        min-height: 44px;
        padding: 5px 4px;
        gap: 6px;
    }

    .layer-icon {
        width: 25px;
        height: 26px;
        font-size: 14px;
    }

    .layer-info {
        gap: 2px;
    }

    .layer-info b {
        font-size: 8px;
        line-height: 1.3;
    }

    .layer-info small {
        display: none !important;
    }

    .layer-state {
        font-size: 6px;
        letter-spacing: 0;
    }

    /* OVERVIEW PANEL */

    .overview-panel {
        top: 72px;
        right: 8px;
        width: min(155px, 43vw);
        max-height: 38vh;
        overflow-y: auto;
        padding: 9px;
        border-radius: 10px;
    }

    .card-heading {
        padding-bottom: 7px;
    }

    .card-heading h3 {
        margin-top: 4px;
        font-size: 10px;
    }

    .heading-icon {
        font-size: 17px;
    }

    .overview-stat {
        margin-top: 8px;
        gap: 3px;
    }

    .overview-stat span {
        font-size: 7px;
        line-height: 1.3;
    }

    .overview-stat strong {
        font-size: 16px;
    }

    .temperature-scale {
        margin-top: 9px;
    }

    .scale-gradient {
        height: 7px;
    }

    .scale-labels {
        margin-top: 5px;
        font-size: 6px;
    }

    .overview-divider {
        margin: 8px 0;
    }

    .compact-stat {
        margin-top: 6px;
    }

    .compact-stat strong {
        font-size: 11px;
    }

    /* LOCATION CARD */

    .location-card {
        top: auto !important;
        bottom: 12px;
        left: 50% !important;

        width: min(290px, calc(100vw - 24px)) !important;
        max-height: 42dvh;

        padding: 12px;
        transform: translateX(-50%) !important;

        border-radius: 11px;
        z-index: 25;
    }

    .location-card h3 {
        font-size: 13px;
    }

    .location-symbol {
        font-size: 19px;
    }

    .details-description {
        margin-top: 7px;
        font-size: 8px;
    }

    .location-divider {
        margin: 7px 0;
    }

    .location-metric {
        margin: 7px 0;
        gap: 8px;
    }

    .metric-symbol {
        width: 27px;
        height: 27px;
        font-size: 15px;
    }

    .location-metric small {
        font-size: 8px;
    }

    .location-metric strong {
        font-size: 13px;
    }

    #aiInsight {
        margin-top: 6px;
        font-size: 8px;
        line-height: 1.5;
    }

    /* TREND PANEL */

    .trend-panel {
        display: block !important;

        right: 8px !important;
        left: 8px;
        bottom: 10px !important;

        width: auto !important;
        min-height: 0 !important;
        padding: 9px !important;

        border-radius: 9px;
        z-index: 14;
    }

    .trend-header h3 {
        margin-top: 3px;
        font-size: 10px;
    }

    .trend-period {
        font-size: 6px;
    }

    .trend-placeholder {
        height: 55px !important;
        margin-top: 5px !important;
    }

    .trend-empty {
        height: 48px;
    }

    .trend-line-icon {
        font-size: 17px;
    }

    .trend-empty p {
        font-size: 7px;
    }

    .trend-empty small {
        font-size: 6px;
    }

    /* MAP LABEL */

    .map-label {
        display: none !important;
    }

    /* STATUS */

    .status {
        display: none !important;
    }

    .scene-label {
        display: none !important;
    }

    .thermal-legend {
        display: none !important;
    }

    /* LOCATION CARD WHEN OPEN:
       Keep other floating panels out of its way. */

    .main-scene:has(.location-card.is-visible) .trend-panel {
        display: none !important;
    }

    .main-scene:has(.location-card.is-visible) .overview-panel {
        opacity: .35;
        pointer-events: none;
    }
}

/* ==========================================
   SMALL MOBILE SCREENS
========================================== */

@media (max-width: 380px) {

    .brand-copy h1 {
        font-size: 8px;
    }

    .brand-copy p {
        font-size: 5px;
    }

    .home-button {
        padding: 6px 7px;
        font-size: 6px;
    }

    .layer-menu {
        width: 132px;
    }

    .layer-item {
        min-height: 41px;
    }

    .layer-info b {
        font-size: 7px;
    }

    .overview-panel {
        width: 143px;
        padding: 8px;
    }

    .overview-stat strong {
        font-size: 14px;
    }

    .location-card {
        width: calc(100vw - 18px) !important;
    }
}

/* ==========================================
   LANDSCAPE MOBILE
========================================== */

@media (max-width: 900px) and (max-height: 500px) {

    .topbar {
        height: 46px;
    }

    .brand-icon {
        width: 30px;
        height: 30px;
    }

    .layer-menu {
        top: 62px;
        width: 145px;
        max-height: calc(100dvh - 75px);
        overflow-y: auto;
    }

    .layer-item {
        min-height: 38px;
    }

    .overview-panel {
        top: 62px;
        max-height: calc(100dvh - 75px);
        overflow-y: auto;
    }

    .trend-panel {
        bottom: 8px !important;
        left: 165px;
        right: auto !important;
        width: 210px !important;
    }

    .location-card {
        top: 60px !important;
        bottom: 8px;
        left: 50% !important;
        max-height: calc(100dvh - 75px);
        width: 250px !important;
        overflow-y: auto;
    }
}

/* ==========================================
   GLASS CONSISTENCY
========================================== */

.topbar *,
.layer-menu *,
.overview-panel *,
.location-card *,
.trend-panel *,
.map-label *,
.status * {
    opacity: 1;
}

.layer-icon,
.metric-symbol {
    background: rgba(255, 255, 255, .07);
}
