/* Reset & Global Styling */
:root {
    --bg-glass: rgba(15, 23, 42, 0.78);
    --border-glass: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-red: #f43f5e;
    --accent-green: #10b981;
    --accent-blue: #3b82f6;
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 1px 1px 0 rgba(255, 255, 255, 0.05) inset;
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body, html {
    font-family: var(--font-family);
    height: 100%;
    width: 100%;
    overflow: hidden;
    background-color: #0f172a;
    color: var(--text-primary);
}

/* Map Container */
#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    background-color: #0c0f16;
}

/* Glassmorphism Panel Base Class */
.glass-panel {
    position: absolute;
    background: var(--bg-glass);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: var(--shadow-premium);
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.6), 0 1px 2px 0 rgba(255, 255, 255, 0.08) inset;
}

/* 1. Main Control Dashboard (Top Left) */
#dashboard {
    top: 20px;
    left: 20px;
    width: 380px;
    padding: 24px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    font-size: 28px;
    color: var(--accent-red);
    background: linear-gradient(135deg, var(--accent-red), #fb7185);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#dashboard h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

#dashboard h2 {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.description {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Control Group Base Styles */
.control-group {
    margin-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 18px;
}

.control-group h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Elegant Button Groups */
.btn-group {
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font-family);
}

.btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.btn.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Info Alert */
.info-alert {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 11px;
    line-height: 1.4;
    margin-top: 18px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

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

.info-alert i {
    margin-top: 2px;
    font-size: 13px;
}

/* 2. Before/After Swiping Labels */
.swipe-label {
    position: absolute;
    top: 20px;
    padding: 10px 16px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-glass);
    border-radius: 30px;
    z-index: 5;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.label-left {
    left: 420px; /* Offset from dashboard */
}

.label-right {
    right: 20px;
}

/* Pulse Icons */
.pulse-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
}

.pulse-icon::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    animation: pulse 1.8s infinite ease-in-out;
}

.pulse-icon.red {
    background-color: var(--accent-red);
}
.pulse-icon.red::after {
    box-shadow: 0 0 0 6px rgba(244, 63, 94, 0.4);
}

.pulse-icon.green {
    background-color: var(--accent-green);
}
.pulse-icon.green::after {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.4);
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2.4); opacity: 0; }
}

/* 3. Docked Tooltip Building Info Card (Bottom Left) */
#info-card {
    bottom: 20px;
    left: 20px;
    width: 380px;
    padding: 20px;
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

#info-card.hidden {
    transform: translateY(30px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-primary);
}

.material-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    margin-bottom: 10px;
}

.stat-label {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-value {
    font-weight: 600;
    color: var(--text-primary);
}

.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 14px 0;
}

/* Temperature Comparison Box Styling */
.temp-comparison {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.temp-box {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.temp-box.before {
    border-left: 3px solid var(--accent-red);
}

.temp-box.after {
    border-left: 3px solid var(--accent-green);
}

.temp-box-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.temp-box-val {
    font-size: 18px;
    font-weight: 700;
}

.temp-arrow {
    color: var(--text-secondary);
    font-size: 16px;
}

/* Temperature Reduction Metric & Progress Bar */
.reduction-metric {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 12px;
    padding: 12px;
}

.reduction-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.reduction-val {
    font-weight: 700;
    color: var(--accent-green);
}

.progress-container {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), #34d399);
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 4. Color Legend Panel (Bottom Right) */
#legend-panel {
    bottom: 20px;
    right: 20px;
    width: 200px;
    padding: 16px;
}

#legend-panel h3 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    margin-bottom: 12px;
    text-align: center;
}

.legend-scale {
    display: flex;
    gap: 12px;
    height: 150px;
    margin-bottom: 10px;
    align-items: stretch;
}

.legend-gradient {
    width: 14px;
    border-radius: 7px;
    background: linear-gradient(0deg, 
        rgb(27, 138, 52) 0%,     /* <= 30.0°C - Dark Green */
        rgb(169, 223, 81) 25%,   /* 32.5°C - Light Green */
        rgb(255, 252, 162) 50%,  /* 35.0°C - Pale Yellow */
        rgb(255, 169, 92) 75%,   /* 37.5°C - Orange */
        rgb(209, 26, 26) 100%    /* >= 40.0°C - Red */
    );
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.legend-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1;
    padding: 2px 0;
}

.legend-footer {
    font-size: 9px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.3;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
    margin-top: 8px;
}

.basemap-attribution {
    font-size: 8.5px;
    color: rgba(148, 163, 184, 0.85);
    text-align: center;
    line-height: 1.35;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
    margin-top: 8px;
}

.basemap-attribution a {
    color: rgba(191, 219, 254, 0.9);
    text-decoration: none;
}

.basemap-attribution a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* OpenLayers Custom Swipe Bar overrides */
.ol-swipe {
    background-color: var(--accent-blue);
    width: 4px;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.8);
}

.ol-swipe .ol-swipe-button {
    background-color: var(--accent-blue);
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.8);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    top: 50%;
    margin-top: -16px;
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ol-swipe .ol-swipe-button::after {
    content: '\f337'; /* FontAwesome Arrows Left Right */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: #ffffff;
    font-size: 12px;
}

/* Styling OpenLayers Standard Zoom button */
.ol-zoom {
    top: auto;
    bottom: 20px;
    left: 420px;
    background: var(--bg-glass) !important;
    backdrop-filter: blur(8px) !important;
    border: 1px solid var(--border-glass) !important;
    border-radius: 10px !important;
    padding: 3px !important;
    box-shadow: var(--shadow-premium) !important;
}

.ol-zoom button {
    background: rgba(255, 255, 255, 0.06) !important;
    color: var(--text-primary) !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    border-radius: 6px !important;
    width: 26px !important;
    height: 26px !important;
    margin: 2px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-family: var(--font-family) !important;
}

.ol-zoom button:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}
