html, body {
    height: 100%;
    margin: 0;
    overflow: visible;
    padding: 0;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
/* Inherit font for all elements to ensure consistency */
* {
    font-family: inherit;
}

/* Container centres the whole layout */
.container {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

.site-logo {
    width: fit-content;
    margin: 0 auto;
}    

.site-logo img {
    height: 67px;      
    width: auto;       
    display: block;   
}

#help-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    border: 1px solid #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    z-index: 1000;
}

#help-panel {
    display: none;
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.95);
    padding: 10px 14px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    width: 80%;
    max-width: 700px;
    z-index: 9999;
}

#help-panel.visible {
    display: block;
}

.location-selection {
    display: flex;
    gap: 64px;  
    justify-content: center;  
    align-items: center;                        
    width: 100%;             
}

.field {
    display: flex;
    align-items: center;
    gap: 8px;  
}

.field label {
    white-space: nowrap;
    font-size: 0.9rem;
}

/* autocomplete styling */
.autocomplete-wrapper input {
    width: 100%;
    box-sizing: border-box;  
    padding: 6px 8px;         
    font-size: 0.9rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fafafa;
}

.autocomplete-wrapper {
    position: relative;
    width: 220px; 
}

.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fafafa;          
    border: 1px solid #ccc;       
    border-radius: 4px;           
    font-size: 0.9rem;            
    max-height: 200px;
    overflow-y: auto;
    z-index: 999;
}

.dropdown div {
    padding: 6px 8px;          
    cursor: pointer;
}

.dropdown div:hover {
    background: #f0f0f0;
}

.hidden {
    display: none;
}

/* Prioritise nearby checkbox */
#prioritise_nearby {
    accent-color: #2f5fa7;   
}    

/* Distance input dropdown */
#distance-input {
    width: 64px;
    padding: 6px 8px;
    font-size: 0.9rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fafafa;
}

.slider-row {
    margin: 20px 0;
    text-align: center;
}

.slider-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.weight-slider {
    width: 80%;   
    margin: 0 auto;
}

/* --- Modern slider styling --- */

input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    cursor: pointer;
}

/* Track (WebKit) */
input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(
        to right,
        #2f5fa7 var(--percent, 50%),
        #ddd var(--percent, 50%)
    );
}

/* Thumb (WebKit) */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #2f5fa7;
    border: 2px solid black;
    margin-top: -7px;
}

/* Firefox track */
input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: #ddd;
}

/* Firefox filled portion */
input[type="range"]::-moz-range-progress {
    height: 6px;
    border-radius: 3px;
    background: #2f5fa7;
}

/* Firefox thumb */
input[type="range"]::-moz-range-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid #2f5fa7;
}


.info-icon {
    display: inline-block;
    margin-left: 6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0066CC;
    color: white;
    font-size: 12px;
    line-height: 16px;
    text-align: center;
    cursor: pointer;
    z-index: 9000;
    position: relative;
}

/* Hidden popup */
.info-popup {
    display: none;
    position: absolute;
    background: #ffffff;
    color: #333;
    padding: 10px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-size: 0.85rem;
    width: 260px;
    z-index: 9000;
    margin-left: 22px;
    margin-top: -4px;
}

.info-popup a {
    color: #0066CC;
    text-decoration: underline;
}



/* Autocomplete dropdown */
#autocomplete-list {
    position: absolute;
    width: 100%;
    background: white;
    border: 1px solid #ccc;
    z-index: 9999;
}

.autocomplete-item {
    padding: 6px;
    cursor: pointer;
}

.autocomplete-item:hover {
    background: #eee;
}

/* Loading overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    display: none; /* hidden by default */
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
    color: white;
    font-size: 20px;
    font-weight: 600;
}

.loader {
    border: 6px solid rgba(255,255,255,0.3);
    border-top: 6px solid white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 0.9s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* FOR MAP PAGE */
.map-logo {
    position: absolute;
    top: 20px;
    right: 20px;
    height: 42px;   /* adjust as needed */
    width: auto;
    z-index: 1000;  /* ensures it sits above map tiles */
}


.back-icon {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;          
    align-items: center;
    gap: 8px;              /* spacing between icon + text */
    color: black;          /* makes both icon + text white */
    font-size: 20px;       /* text size */
    font-weight: 600;      /* bold text */
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
    z-index: 1000;
}

.back-icon:hover {
    color: white;
}

.back-icon svg {
    display: block;
}


.rank-marker div {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255,255,255,0.8);
    border: 2px solid black;
    text-align: center;
    line-height: 26px;
    font-weight: bold;
}

/* Legend container */
.legend {
    position: absolute;
    bottom: 90px;
    left: 10px;
    background: rgba(255,255,255,0.9);
    padding: 10px 12px;
    border: 1px solid #aaa;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    font-size: 13px;
    z-index: 1000;
    width: 160px;
}

/* Header */
.legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-weight: 600;
}

.legend-left {
    display: flex;
    align-items: center;
    gap: 6px; 
}

.legend-toggle.off {
    opacity: 0.35;
}

.legend-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 2px 6px;
}


/* Labels above/below ramp */
.legend-text {
    margin-left: 8px;
    font-size: 12px;
    white-space: nowrap;
}

/* Each row of the legend */
.legend-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

/* Colour bars */
.legend-row span {
    width: 48px;                
    height: 18px;
    margin: 0;
    border-radius: 0;
}

/* ZOOM BUTTONS */
#zoom-controls {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    flex-direction: row;
    gap: 12px;
    z-index: 1000;
}

.zoom-btn {
    width: 64px;
    height: 64px;
    border: 1px solid #aaa;
    border-radius: 4px;
    background: #fff;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.zoom-btn:hover {
    background: #f0f0f0;
}

/* Map container */
#map,
.maplibregl-map {
    width: 100%;
    height: 100vh;
}

#map {
    min-height: 600px;
    position: relative;
}

#map canvas {
    cursor: default;
}

/* map attribution */
#map-attribution {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-size: 11px;
    line-height: 1.3;
}

.maplibregl-ctrl-scale {
    position: absolute !important;
    bottom: 20px;
    right: 60px;
    z-index: 1000;
    margin: 0 !important;
}


/* The small circular info icon */
#attrib-icon {
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    border: 1px solid #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

/* The hidden panel */
#attrib-panel {
    display: none;
    margin-top: 6px;
    background: rgba(255,255,255,0.9);
    padding: 8px 12px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    max-width: 600px;
}

/* When visible */
#attrib-panel.visible {
    display: block;
}

#map-help-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    border: 1px solid #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    z-index: 1000;
}

#map-help-panel {
    display: none;
    position: absolute;
    top: 50px;
    right: 20px;
    background: rgba(255,255,255,0.95);
    padding: 10px 14px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    max-width: 680px;
    z-index: 1000;
}

#map-help-panel.visible {
    display: block;
}


/* Sidebar styling */
.sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: 360px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -2px 0 10px rgba(0,0,0,0.15);
    padding: 20px 20px 24px 20px;
    box-sizing: border-box;
    overflow-y: auto;       
    overflow-x: hidden; 
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.25s ease-out;
    box-shadow: -2px 0 6px rgba(0,0,0,0.15);
    scroll-behavior: smooth;
}

.sidebar.visible {
    transform: translateX(0);
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    float: right;
    color: #555;
}

#sidebar-title {
    margin: 8px 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2f5fa7;
}

#sidebar-composite {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #333;
}

.sidebar-info {
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f5f5f7;
    border-left: 3px solid #2f5fa7; /* subtle premium blue */
    border-radius: 4px;
    font-size: 0.9rem;
    line-height: 1.35;
}

.sidebar-info p {
    margin: 0.25rem 0;
}

.sidebar-info strong {
    font-weight: 600;
    color: #333;
}

.sidebar-note {
    margin: 0 0 12px 0;
    font-size: 10px;
    color: #333;
}

/* rank RUC21CD */
#rank-section {
    margin-top: 12px;
    padding: 10px 0;
    border-top: 1px solid #ddd;
}

#ruc-description {
    font-size: 0.9rem;
    margin-bottom: 10px;
    line-height: 1.35;
}

.rank-label {
    font-size: 0.9rem;
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
}

#rank-select {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.9rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fafafa;
}

#rank-display {
    margin-top: 10px;
    font-size: 0.9rem;
    line-height: 1.35;
}

.rank-row {
    display: flex;
    align-items: center;
    gap: 8px; 
}

.rank-label {
    display: inline-block;
    margin-bottom: 0;
    white-space: nowrap;
}

#rank-select {
    flex: 1; /
}



/* Top 5 markers */

.top-marker {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #2f5fa7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: #2f5fa7;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

/* MapLibre popup for top 5 */

.maplibregl-popup-content {
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 13px;
}

.maplibregl-popup-content strong {
    font-weight: 600;
}
