/* General Layout */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #e0e0e0;
    background-color: #1a1a1a;
}

.container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background-color: #242424;
    padding: 20px; 
    box-shadow: 2px 0 5px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 2;
}

h1 {
    font-size: 1.4rem;
    margin-bottom: 2px;
    color: #4db8ff; 
}

.subtitle {
    font-size: 0.95rem; 
    color: #e0e0e0;
    margin-bottom: 5px;
    line-height: 1.3;
}

h3 {
    font-size: 1rem;
    margin-bottom: 3px;
    color: #4db8ff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

hr {
    border: 0;
    border-top: 1px solid #444;
    width: 100%;
    margin-bottom: 4px;
    margin-top: 4px;
}

.legend h3 {
    font-size: 0.95rem; 
    margin-top: 0;       
    margin-bottom: 3px;
    color: #4db8ff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.control-group {
    margin-bottom: 8px;
}

/* Radio Button */
.radio-option {
    display: flex;
    align-items: center;
    margin-bottom: 2px;
    cursor: pointer;
    font-size: 0.95rem;
}

.radio-option input {
    margin-right: 10px;
    cursor: pointer;
}

.year-selector {
    display: flex;
    justify-content: space-between;
    background: #333;
    border-radius: 5px;
    padding: 5px;
}

.radio-button {
    flex: 1;
    text-align: center;
    cursor: pointer;
}

.radio-button input {
    display: none; 
}

.radio-button span {
    display: block;
    padding: 8px 0;
    border-radius: 4px;
    transition: background 0.2s;
    font-size: 0.9rem;
}

.radio-button input:checked + span {
    background-color: #4db8ff;
    color: #121212;
    font-weight: bold;
}

/* Buttons */
.primary-btn {
    background-color: #e63946; 
    color: white;
    border: none;
    padding: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
    margin-top: 10px;
    margin-bottom: 10px;
    transition: background 0.2s;
}

.primary-btn:hover {
    background-color: #ff4d5a;
}

.secondary-btn {
    background-color: #444;
    color: white;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 5px;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.secondary-btn:hover {
    background-color: #555;
}

#about-btn {
    margin-top: 5px;      
    margin-bottom: 5px;  
}

/* Map Area */
.map {
    flex-grow: 1;
    background-color: #121212;
}

/* Popup */
.ol-popup {
    position: absolute;
    background-color: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #cccccc;
    bottom: 12px;
    left: -50px;
    min-width: 280px;
    color: #333;
}

.ol-popup:after, .ol-popup:before {
    top: 100%;
    border: solid transparent;
    content: " ";
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
}

.ol-popup:after {
    border-top-color: white;
    border-width: 10px;
    left: 48px;
    margin-left: -10px;
}

.ol-popup:before {
    border-top-color: #cccccc;
    border-width: 11px;
    left: 48px;
    margin-left: -11px;
}

.ol-popup-closer {
    text-decoration: none;
    position: absolute;
    top: 2px;
    right: 8px;
    color: #999;
    font-size: 1.2rem;
}

.ol-popup-closer:after {
    content: "✖";
}

.popup-title {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    color: #e63946;
}

.popup-type {
    font-style: italic;
    color: #666;
    margin-bottom: 10px;
}

.popup-link {
    display: inline-block;
    margin-top: 8px;
    color: #007bff;
    text-decoration: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; box-sizing: border-box; }
    .map { height: 60vh; }
}

.toggle-control {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 4px;
    background: #333;
    padding: 6px 10px;
    border-radius: 5px;
    border: 1px solid #444;
}

.toggle-control input {
    margin-right: 12px;
    transform: scale(1.3); 
    cursor: pointer;
}

.toggle-label {
    font-size: 0.95rem;
    color: #ffffff;
}

.toggle-control:hover {
    background: #444;
}

.blend-layer {
    mix-blend-mode: screen;  
    opacity: 0.9;            
}


/* Loading Screen */

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #121212;
    z-index: 9999; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-out; 
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #333;
    border-top: 5px solid #00e5ff; 
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-text {
    color: #e0e0e0;
    font-family: 'Segoe UI', sans-serif;
    letter-spacing: 1px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* Modal */

.modal-overlay {
    display: none; 
    position: fixed;
    z-index: 5000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); 
    backdrop-filter: blur(4px); 
}

.modal-content {
    background-color: #242424;
    margin: 5% auto; 
    padding: 30px;
    border: 1px solid #444;
    border-radius: 8px;
    width: 80%;
    max-width: 600px; 
    color: #e0e0e0;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    max-height: 80vh; 
    overflow-y: auto; 
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close-btn:hover {
    color: #fff;
}

.modal-content h2 {
    color: #4db8ff; 
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    margin-top: 0;
}

.modal-content h3 {
    color: #78c5f8; 
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.modal-body p, .modal-body li {
    text-align: justify;
    
    -webkit-hyphens: auto; 
    -ms-hyphens: auto;     
    hyphens: auto;        
}

.modal-body ul {
    margin-left: 20px;
    line-height: 1.6;
}

.modal-footer {
    margin-top: 30px;
    font-size: 0.85rem;
    color: #888;
    text-align: center;
    border-top: 1px solid #333;
    padding-top: 15px;
}

/* Legend */

.legend {
    margin-bottom: 0;
    padding-bottom: 0;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 2px;
    font-size: 0.95rem;
    color: #cccccc; 
}

/* Dot */
.dot {
    height: 12px;
    width: 12px;
    border-radius: 50%; 
    display: inline-block;
    margin-right: 19px; 
    flex-shrink: 0;     
}

/* Rectangle 3:5 Ratio */
.rectangle {
    height: 12px;
    width: 20px;
    border-radius: 2px; 
    display: inline-block;
    margin-right: 12px;
    flex-shrink: 0;
}

/* Legend Classes */

/* Sites */
.dot.blue {
    background: #1f78b4;
    border: 1px solid #fff;
}

/* Flood */
.rectangle.red {
    background-color: rgb(230, 57, 70);
    border: 1px solid #f1656c;
    opacity: 0.9;
}

/* Vegetation */
.rectangle.green {
    background-color: #3D4839; 
    border: 1px solid #4a5048; 
}

/* Urban */
.rectangle.grey {
    background-color: #333333; 
    border: 1px solid #444;    
}

/* Hint Text */
.hint-text {
    font-size: 0.8rem;
    color: #888;          
    margin-top: 8px;      
    margin-left: 5px;     
    line-height: 1.3;
}

/* Stats Pane and Tooltip */

/* Container */
.stats-panel {
    margin-top: 15px;
    background: #333;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #4db8ff;
}

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

.stats-header h4 {
    margin: 0;
    color: #fff;
    font-size: 1.1rem;
}

/* Stat Blocks */
.stat-block {
    margin-bottom: 12px;
    border-bottom: 1px solid #444; 
    padding-bottom: 8px;
}

.stat-block:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

/* Label */
.stat-label {
    display: block; 
    color: #aaa;
    font-size: 0.8rem;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Value */
.stat-value {
    display: block; 
    color: #fff;
    font-size: 1.1rem; 
    font-weight: 600;
}

/* Tooltip Styling */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    color: #4db8ff;
    font-size: 1.1rem;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #111;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1000;
     
    /* Position tooltip to the left of the icon */
    right: 110%; 
    top: -10px;
    
    /* Text */
    font-size: 0.8rem;
    font-weight: normal;
    line-height: 1.4;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    border: 1px solid #444;
    opacity: 0;
    transition: opacity 0.3s;
}

/* Arrow pointing to icon */
.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 15px;
    left: 100%; 
    margin-top: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent transparent #444;
}

/* Show on Click (Active Class) */
.tooltip.active .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Make the icon look clickable */
.tooltip {
    cursor: pointer;
    user-select: none; 
}