/* General reset and base layout */
body {
    margin: 0;
    font-family: 'Arial', sans-serif;
    display: flex; 
    flex-direction: column;
    min-height: 100vh; 
    overflow-y: auto; 
}

/* --- Header Styles for Title and Filters --- */
#mainHeader {
    height: 60px; 
    background-color: #333; 
    color: white;
    display: flex;
    justify-content: space-between; 
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 10;
    flex-shrink: 0; 
}

#mainHeader h1 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 600;
}

/* Filter Container Styles */
#filterContainer {
    display: flex;
    gap: 25px; 
}

#filterContainer label {
    font-size: 0.9em;
    cursor: pointer;
    display: flex;
    align-items: center;
    background-color: #555;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

#filterContainer label:hover {
    background-color: #777;
}

#filterContainer input[type="checkbox"] {
    margin-right: 8px;
}

/* --- Main Content Container (Map and Sidebar) --- */
#main-content-container {
    width: 100%;
    height: 50vh; 
    min-height: 400px; 
    display: flex;
    flex-grow: 1; 
    position: relative; 
}

/* --- Map Styles --- */
#map {
    flex: 1; 
    height: 100%; 
    z-index: 1; 
}

/* --- Sidebar Styles --- */
#sidebar {
    position: absolute; 
    top: 0;
    right: 0;
    width: 0; 
    height: 100%;
    background-color: #f0f0f0;
    border-left: 1px solid #ccc;
    overflow-y: auto;
    transition: width 0.3s ease-in-out, padding 0.3s ease-in-out; 
    flex-shrink: 0; 
    z-index: 100;
}

/* Style when sidebar is visible/open */
#sidebar:not(.sidebar-hidden) {
    width: 350px; 
    padding: 10px;
}

.sidebar-hidden {
    width: 0 !important;
    padding: 0 !important;
    border: none !important;
}

#closeSidebar {
    position: absolute; 
    top: 10px;
    right: 10px;
    cursor: pointer;
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    z-index: 101; 
    margin-bottom: 10px;
}

/* Sidebar Content Styling */
#sidebarContent {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
    padding-top: 30px; 
}

.sidebar-hidden #sidebarContent {
    opacity: 0; 
}

/* Image Gallery (Thumbnails) Styles */
#imageGallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    padding: 10px 0;
}

#imageGallery img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer; /* Makes thumbnails clearly clickable */
}

/* --- Data Table Styles (Below the map) --- */
#data-table-container {
    padding: 20px;
    background-color: #fff;
    border-top: 1px solid #ddd;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
    flex-shrink: 0; 
}

#projectTable {
    width: 100%;
    border-collapse: collapse;
}

#projectTable th, #projectTable td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    font-size: 0.9em;
}

#projectTable th {
    background-color: #f2f2f2;
    color: #333;
    font-weight: bold;
}

/* --- Modal (Image Gallery Pop-up) Styles --- */

.modal {
    display: none; 
    position: fixed; 
    z-index: 200; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9); 
}

.modal-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 900px;
    max-height: 90vh;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
}

#modalImage {
    width: 100%;
    height: auto;
    max-height: 90vh;
    display: block;
    object-fit: contain;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 201; 
}

.modal-close:hover,
.modal-close:focus {
    color: #bbb;
}

/* Navigation Arrows */
.modal-nav {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -22px;
    color: white;
    font-weight: bold;
    font-size: 25px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    background: none;
    border: none;
}

.prev-btn {
    left: 0;
    border-radius: 3px 0 0 3px;
}

.next-btn {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.modal-nav:hover {
    background-color: rgba(0, 0, 0, 0.8);
}