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

html, body {
    width: 100%;
    height: 100%;
    min-height: 600px;
    background: transparent;
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

#sdk-map {
    width: 100%;
    height: 100%;
    min-height: 600px;
}

/* ---------------------------------------------------------------------------
   Popup styling
   --------------------------------------------------------------------------- */

.viz-popup-container .maplibregl-popup-close-button {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 20px;
    color: #9ca3af;
    z-index: 1;
    line-height: 1;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.viz-popup-container .maplibregl-popup-close-button:hover {
    color: #374151;
}

.viz-popup {
    padding: 16px 20px 14px;
    min-width: 200px;
    max-width: 320px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.viz-popup-title {
    font-size: 15px;
    color: #111827;
    font-weight: 700;
    margin-bottom: 10px;
    margin-right: 20px;
    line-height: 1.3;
}

.viz-popup-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 3px 0;
    font-size: 13px;
    color: #374151;
    line-height: 1.4;
}

.viz-popup-key {
    color: #6b7280;
    font-weight: 500;
    flex-shrink: 0;
    min-width: 60px;
}

.viz-popup-value {
    word-break: break-word;
}

/* ---------------------------------------------------------------------------
   Title overlay — top-left of map
   --------------------------------------------------------------------------- */

.viz-title {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Choropleth legend — bottom-right of map
   --------------------------------------------------------------------------- */

.viz-legend {
    position: absolute;
    bottom: 32px;
    right: 12px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    font-size: 12px;
    color: #374151;
    min-width: 140px;
}

.viz-legend-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #111827;
}

.viz-legend-bar {
    width: 100%;
    height: 12px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.viz-legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #6b7280;
}

/* ---------------------------------------------------------------------------
   Address enrichment in popups
   --------------------------------------------------------------------------- */

.viz-address-row {
    border-top: 1px solid #e5e7eb;
    margin-top: 6px;
    padding-top: 6px;
}

.viz-address-loading .viz-popup-value {
    color: #9ca3af;
    font-style: italic;
}

/* ---------------------------------------------------------------------------
   Loading indicator
   --------------------------------------------------------------------------- */

.viz-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #6b7280;
    font-size: 14px;
}

.viz-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: viz-spin 0.8s linear infinite;
}

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