/* ===== 1. RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body { 
    height: 100%; 
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    background-color: white;
}

/* ===== 2. LAYOUT & STRUCTURE ===== */
/* Main content areas */
.content, .content-1, #map-container {
    flex: 1 1 auto;
    min-height: 0;
}

/* Footer */
.footer {
    background-color: #4CAF50;
    color: white;
    text-align: center;
    padding: 10px;
    position: static;
    width: 100%;
    margin-top: auto;
}

/* Fullscreen map layout */
.content.map-fullscreen {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.content.map-fullscreen .main-content,
.content.map-fullscreen .content-grid,
.content.map-fullscreen .Area_Specific {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

/* Map container */
#map-container {
    width: 100%;
    position: relative;
}

#map {
    position: relative;
    width: 100%;
    height: 100%;
}

.content.map-fullscreen #map-container {
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    position: relative;
}

.content.map-fullscreen #map {
    width: 100%;
    height: 100%;
    position: relative;
}

/* ===== 3. HEADER & NAVIGATION ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    color: black;
    padding: 10px 20px;
    min-height: 70px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.logo img {
    margin-right: 15px;
    flex-shrink: 0;
}

.system-title {
    font-size: 20px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info {
    flex-shrink: 0;
}

.user-info a {
    color: black;
    text-decoration: none;
    margin-left: 15px;
}

/* Navbar */
.navbar {
    background-color: #4CAF50;
    display: flex;
    justify-content: flex-end;
}

.navbar ul {
    list-style-type: none;
    display: flex;
    justify-content: left;
}

.navbar ul li {
    position: relative;
    display: flex;
    align-items: center;
}

.navbar ul li a {
    display: block;
    padding: 14px 20px;
    color: white;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.navbar ul li a:hover {
    background-color: #FFAC1C;
}

/* Dropdown menus */
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #4CAF50;
    min-width: 160px;
    z-index: 1;
}

.dropdown-content a {
    padding: 12px 16px;
    display: block;
    text-decoration: none;
    color: white;
    transition: background-color 0.3s ease;
}

.dropdown-content a:hover {
    background-color: #FFAC1C;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Language switcher */
.navbar ul li select#langSwitcher {
    margin: 6px 12px;
    padding: 10px 36px 10px 12px;
    line-height: 1;
    font: bold 14px/1 Arial, sans-serif;
    color: #fff;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="white"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    transition: all 0.3s ease;
}

.navbar ul li select#langSwitcher:hover,
.navbar ul li select#langSwitcher:focus {
    background-color: #4CAF50;
    border-color: #4CAF50;
    outline: none;
    color: #ffffff;
}

.navbar ul li select#langSwitcher option {
    color: #ffffff;
}

/* ===== 4. CONTENT SECTIONS ===== */
.content-1, .content {
    padding: 20px;
    height: auto;
    overflow-y: auto;
}

/* Category sections */
.category {
    background: #fff;
    margin: 20px auto;
    padding: 15px;
    border-radius: 8px;
    width: 90%;
    box-shadow: 0 0 8px rgba(0,0,0,0.1);
}

.category h3 {
    margin-bottom: 10px;
    color: #000000;
    text-align: left;
}

/* Button grid */
.button-grid {
    display: flex;
    padding: 10px;
    gap: 10px;
}

.button-grid button {
    padding: 15px 5px;
    background-color: #FFAC1C;
    color: #000000;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    width: 200px;
    transition: background-color 0.3s ease;
}

.button-grid button:hover {
    background-color: #4CAF50;
}

/* Collapsible sections */
.big-toggle {
    color: #000000;
    width: 100%;
    max-width: 720px;
    margin: 10px auto;
    padding: 12px 16px;
    font-size: 18px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #faae2b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.big-toggle:hover { 
    background: #f3d388; 
}

.big-toggle[aria-expanded="true"] {
    background: #ffae00;
    border-color: #ffffff;
}

.chev {
    transition: transform 0.2s ease;
    font-weight: bold;
}

.big-toggle[aria-expanded="true"] .chev { 
    transform: rotate(90deg); 
}

.panel {
    display: none;
    max-width: 720px;
    margin: 0 auto 12px;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fff;
}

/* ===== 5. FORM ELEMENTS ===== */
.form-header {
    background-color: #4CAF50;
    color: white;
    text-align: center;
    padding: 20px;
}

.form-container {
    width: 600px;
    margin: 10px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    background-color: #f9f9f9;
    text-align: left;
}

.form-container h2 {
    margin-bottom: 20px;
    color: #4CAF50;
}

.form-container input[type="text"],
.form-container input[type="password"],
.form-container input[type="number"],
.form-container select,
.form-container date {
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.form-container label {
    font-weight: bold;
}

/* Button styles - Consolidated */
.button-container { 
    text-align: center;
    margin-top: 15px;
}

.button-container button,
#toggleFormBtn,
.form-container button,
.form-drawer .form-container button {
    padding: 10px 20px;
    background-color: #FFAC1C;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 15px;
    align-items: center;
    margin-top: 10px;
    transition: background-color 0.3s ease;
}

.button-container button:hover,
#toggleFormBtn:hover,
.form-container button:hover {
    background-color: #4CAF50;
}

.button-container i {
    font-size: 16px;
}

.form-container .form-actions {
    text-align: center;
}

/* File upload */
#uploadTif {
    display: none;
}

.file-label {
    display: inline-block;
    padding: 10px 20px;
    margin-bottom: 10px;
    background-color: #FFAC1C;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    transition: background-color 0.3s ease;
}

.file-label:hover {
    background-color: #4CAF50;
}

#file-chosen {
    margin-left: 10px;
    font-style: italic;
    color: #555;
}

/* ===== 6. TABLE STYLES ===== */
table {
    width: 95%;
    border-collapse: collapse;
    margin: 20px auto;
    font-family: Arial, sans-serif;
    font-size: 14px;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

th, td {
    border: 1px solid #333;
    text-align: center;
    padding: 8px;
}

th {
    background-color: #FFAC1C; 
    color: black;
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

tr:hover {
    background-color: #ddd;
}

h2 {
    text-align: center;
    margin-top: 20px;
    color: #333;
}

/* Excel filter styles */
tfoot th { 
    background: #fafafa; 
    position: sticky; 
    bottom: -1px; 
    z-index: 1; 
}

.toolbar {
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    gap: 12px; 
    margin: 10px 0;
}

.rows-only-ctl { 
    display: inline-flex; 
    align-items: center; 
    gap: 6px; 
}

.excel-filter {
    position: absolute; 
    z-index: 9999; 
    width: 280px; 
    max-height: 420px; 
    overflow: hidden;
    background: #fff; 
    border: 1px solid #ccc; 
    border-radius: 6px; 
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    padding: 8px;
}

.excel-filter .row { 
    margin: 6px 0; 
}

.excel-filter .search-box { 
    width: 100%; 
    padding: 6px 8px; 
    border: 1px solid #ccc; 
    border-radius: 4px; 
}

.excel-filter .options { 
    overflow: auto; 
    max-height: 220px; 
    border: 1px solid #e5e5e5; 
    border-radius: 4px; 
    padding: 6px; 
}

.excel-filter .opt { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    padding: 2px 0; 
    font-size: 13px; 
}

.excel-filter .actions { 
    display: flex; 
    justify-content: flex-end; 
    gap: 8px; 
    margin-top: 8px; 
}

.excel-filter .head-actions { 
    display: flex; 
    gap: 8px; 
    justify-content: flex-start; 
}

.excel-filter .btn { 
    padding: 5px 10px; 
    border: 1px solid #ccc; 
    background: #f7f7f7; 
    border-radius: 4px; 
    cursor: pointer; 
}

.excel-filter .btn.primary { 
    background: #2d7ef7; 
    color: #fff; 
    border-color: #2d7ef7; 
}

/* ===== 7. MAP CONTROLS ===== */
/* Map title */
#map-title {
    position: absolute;
    top: 160px;
    left: 70px;
    background: rgba(255,255,255,0.9);
    padding: 8px 15px;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    z-index: 1000;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content.map-fullscreen #map-title {
    margin: 8px 0 0 8px;
    z-index: 1000;
}

/* Map control buttons */
#kmlToggleBtn, #filterToggleBtn {
    position: absolute;
    top: 160px;
    z-index: 1000;
    background: #FFAC1C;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: background 0.3s ease;
}

#kmlToggleBtn:hover, #filterToggleBtn:hover {
    background: #e69c1a !important;
}

#kmlToggleBtn {
    right: 70px;
}

#filterToggleBtn {
    right: 200px;
}

/* Return buttons */
#returnToAreaBtn,
#returnToStartBtn {
    display: none;
    position: fixed;
    right: 20px;
    bottom: 80px;
    z-index: 10000;
    background: #81ba6e;
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    transition: all 0.3s ease;
}

#returnToAreaBtn:hover,
#returnToStartBtn:hover {
    background: #70a85f;
}

#returnToStartBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* KML Controls */
.kml-controls {
    display: none;
    position: absolute;
    top: 180px;
    right: 50px;
    z-index: 1000;
    background: white;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    width: 350px;
    max-height: 500px;
    overflow-y: auto;
}

#kmlDropZone {
    border: 2px dashed #3498db;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin-bottom: 15px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
}

#kmlDropZone:hover {
    background: #e8f4fd;
    border-color: #2980b9;
}

.dropzone-icon {
    font-size: 48px;
    color: #3498db;
    margin-bottom: 10px;
}

.dropzone-title {
    margin: 0 0 10px 0;
    font-weight: bold;
    color: #2c3e50;
}

.dropzone-subtitle {
    margin: 0;
    font-size: 12px;
    color: #7f8c8d;
}

/* Upload progress */
#uploadProgress {
    display: none;
    margin-bottom: 15px;
}

.progress-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: #ecf0f1;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: #27ae60;
    transition: width 0.3s ease;
}

/* File list */
#selectedFilesList {
    max-height: 120px;
    overflow-y: auto;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    background: #fafafa;
    display: none;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    margin-bottom: 4px;
    background: white;
    border-radius: 3px;
    border: 1px solid #e0e0e0;
    font-size: 12px;
}

.remove-file-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.remove-file-btn:hover {
    background: #c0392b;
}

/* Upload button */
.upload-button-container {
    text-align: center;
}

.upload-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    font-weight: bold;
    transition: background 0.3s ease;
}

.upload-btn:hover {
    background: #219a52;
}

.upload-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

/* KML buttons */
.buttons-container {
    margin-top: 20px;
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.existing-files-title {
    margin: 0 0 10px 0;
    font-size: 12px;
    color: #7f8c8d;
    text-align: center;
}

.kml-toggle-btn {
    padding: 8px 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 5px;
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    transition: background 0.3s ease;
}

.kml-toggle-btn:hover {
    background: #2980b9;
}

.kml-toggle-btn.active {
    background: #27ae60;
}

/* Filter Controls */
/* #filterControlsBox {
    display: none;
    position: absolute;
    top: 180px;
    right: 180px;
    z-index: 1000;
    background: white;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    width: 320px;
    max-height: 500px;
    overflow-y: auto;
}

.filter-sections {
    max-height: 60vh;
    overflow-y: auto;
}

.filter-section.collapsible {
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 10px;
}

.filter-section-header {
    background: #f8f9fa;
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid transparent;
    transition: background 0.3s ease;
}

.filter-section-header:hover {
    background: #e9ecef;
}

.filter-section-header h4 {
    margin: 0;
    font-size: 14px;
    color: #2c3e50;
}

.collapse-icon {
    transition: transform 0.3s ease;
    font-size: 12px;
}

.filter-section-content {
    padding: 15px;
    display: none;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.filter-section.active .filter-section-content {
    display: block;
}

.filter-section.active .collapse-icon {
    transform: rotate(180deg);
}

.filter-subsection {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.filter-subsection:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.filter-subsection h5 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #34495e;
    font-weight: 600;
}


.filter-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.filter-label-text {
    font-size: 12px;
    color: #555;
    font-weight: 500;
    margin-bottom: 2px;
}

.filter-input {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    width: 100%;
    box-sizing: border-box;
}

.filter-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.marker-color-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 8px;
    border: 1px solid #ddd;
}

.filter-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 5px;
    margin-top: 8px;
}

.filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.btn-primary {
    background: #27ae60;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
    transition: background 0.3s ease;
}

.btn-primary:hover {
    background: #219a52;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
    transition: background 0.3s ease;
}

.btn-secondary:hover {
    background: #7f8c8d;
} */

/* ===== 7. MAP CONTROLS – Filter Controls ===== */

/* Filter Controls main box */
#filterControlsBox {
    display: none;
    position: absolute;
    top: 180px;
    right: 180px;
    z-index: 1000;
    background: white;
    padding: 15px 18px 18px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    width: 360px;

    /* 🔹 Only ONE scrollbar (for the whole box) */
    max-height: calc(100vh - 210px); /* header + navbar space */
    overflow-y: auto;
}

/* Inner container – no fixed height, no own scrollbar */
.filter-sections {
    max-height: none;
    overflow: visible;
}

/* Each collapsible group */
.filter-section.collapsible {
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 10px;
}

/* Section header */
.filter-section-header {
    background: #f8f9fa;
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid transparent;
    transition: background 0.3s ease;
}

.filter-section-header:hover {
    background: #e9ecef;
}

.filter-section-header h4 {
    margin: 0;
    font-size: 14px;
    color: #2c3e50;
}

.collapse-icon {
    transition: transform 0.3s ease;
    font-size: 12px;
}

/* Section content: no inner scroll */
.filter-section-content {
    padding: 12px 12px 10px;
    display: none;
    max-height: none;
    overflow: visible;
}

/* When open */
.filter-section.active .filter-section-content {
    display: block;
}

.filter-section.active .collapse-icon {
    transform: rotate(180deg);
}

/* Sub-blocks inside each section */
.filter-subsection {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.filter-subsection:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* Subsection title */
.filter-subsection h5 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #34495e;
    font-weight: 600;
}

/* Filter input groups */
.filter-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 4px;
}

.filter-label-text {
    font-size: 12px;
    color: #555;
    font-weight: 500;
}

.filter-input {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    width: 100%;
    box-sizing: border-box;
}

/* Checkbox row for marker types */
.filter-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.marker-color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 4px;
    border: 1px solid #ddd;
}

/* Fruit-count grid – no separate scrollbar */
.filter-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 6px;
}

/* Buttons at bottom of panel */
.filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-primary {
    background: #27ae60;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
    transition: background 0.3s ease;
}

.btn-primary:hover {
    background: #219a52;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
    transition: background 0.3s ease;
}

.btn-secondary:hover {
    background: #7f8c8d;
}


/* Scrollbar for filter sections */
.filter-section-content::-webkit-scrollbar {
    width: 6px;
}

.filter-section-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.filter-section-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.filter-section-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ===== 8. COMPONENTS ===== */
/* Close buttons */
.close-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #333;
}

/* Error messages */
.map-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.9);
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    z-index: 1000;
    text-align: center;
    max-width: 80%;
}

/* Image modal */
/* #imageModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.9);
    justify-content: center;
    align-items: center;
    z-index: 10000;
    overflow: hidden;
} */
 #imageModal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

#modalImage {
    max-width: 90%;
    max-height: 90%;
    transition: transform 0.2s ease;
    touch-action: none;
}

/* .modal-close { 
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    z-index: 10001;
} */
 .modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white; 
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

#imageContainer {
    max-width: 90%;
    max-height: 80%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

#modalImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s;
}

/* Navigation Arrows */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 24px;
    padding: 15px 20px;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.3s;
    z-index: 10001;
}

.nav-arrow:hover {
    background: rgba(0, 0, 0, 0.8);
}

.left-arrow {
    left: 20px;
}

.right-arrow {
    right: 20px;
}

/* Image Counter */
#imageCounter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 18px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    z-index: 10001;
}

/* Hide arrows when not needed */
.nav-arrow.hidden {
    display: none;
}

/*----------------------------------------------------------- Leaflet popup */
.leaflet-popup-content {
    font-family: Arial, sans-serif;
    font-size: 14px;
}

.leaflet-popup-content a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.leaflet-popup-content a:hover {
    color: #2E7D32;
    text-decoration: underline;
}

.leaflet-popup-content a[style*="color:red"] {
    color: #e74c3c !important;
}

.leaflet-popup-content a[style*="color:red"]:hover {
    color: #c0392b !important;
}

/* Sidebar */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #333;
    padding: 8px;
    margin-right: 10px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    position: relative;
    z-index: 1001;
}

.sidebar-toggle:hover {
    background-color: rgba(0,0,0,0.1);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
}

.sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100%;
    background: white;
    z-index: 9999;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    -webkit-overflow-scrolling: touch;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    background: #4CAF50;
    padding: 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #45a049;
    position: sticky;
    top: 0;
    z-index: 1;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 18px;
}

.sidebar-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.sidebar-close:hover {
    background-color: rgba(255,255,255,0.2);
}

.sidebar-user-info {
    padding: 15px 20px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.sidebar-user-info span {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.sidebar-user-links a {
    color: #4CAF50;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
}

.sidebar-user-links a:hover {
    text-decoration: underline;
}

.sidebar-nav {
    padding: 10px 0;
}

.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-nav li {
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-nav li:last-child {
    border-bottom: none;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 15px;
    min-height: 50px;
}

.sidebar-nav li a:hover {
    background: #f8f9fa;
    color: #4CAF50;
    padding-left: 25px;
}

.sidebar-nav li a:active {
    background: #e9ecef;
}

.sidebar-language-selector {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    margin-top: 10px;
}

.sidebar-language-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.sidebar-lang-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

/* Loading state */
.sidebar-loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.sidebar-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Body scroll lock */
body.sidebar-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}


/* ===== ENHANCED RESPONSIVE DESIGN ===== */
@media screen and (max-width: 1200px) {
    /* Large tablets and small laptops */
    .form-container {
        width: 80%;
    }
    
    .category {
        width: 95%;
    }
    
    .button-grid {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .button-grid button {
        width: 180px;
    }
    
    .system-title {
        font-size: 18px;
    }
}

@media screen and (max-width: 992px) {
    /* Tablets */
    .header {
        position: relative;
        padding: 10px 15px;
    }
    
    .system-title {
        font-size: 16px;
    }
    
    .logo img {
        height: 40px;
        margin-right: 10px;
    }
}

@media screen and (max-width: 768px) {

    /* Mobile devices
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .navbar {
        display: none !important;
    }
    
    .header {
        padding: 8px 15px 8px 60px;
        min-height: 60px;
        position: relative;
    }
    
    .user-info {
        display: none;
    }
    
    .logo {
        justify-content: flex-start;
        width: 100%;
    }
    
    .system-title {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100vw - 100px);
    } */
         /* Header for mobile – space for toggle, logo & title */
    /* Header for mobile – space for toggle, logo & title */
    .header {
        padding: 8px 12px;
        min-height: 60px;
        display: flex;
        align-items: center;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    /* Show the toggle on mobile */
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .logo {
        display: flex;
        align-items: center;
        flex: 1;
        min-width: 0;
    }

    .logo img {
        height: 40px;
        margin-right: 10px;
        flex-shrink: 0;
    }

    .system-title {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .user-info {
        display: none; /* keep header clean on small screens */
    }

    /* 👉 ADD THIS: hide the green navbar on mobile */
    .navbar {
        display: none !important;
    }
    
    /* Content adjustments */
    .content-1, .content {
        padding: 15px;
    }
    
    .form-container {
        width: 95%;
        margin: 15px auto;
        padding: 15px;
    }
    
    .category {
        width: 98%;
        margin: 10px auto;
        padding: 12px;
    }
    
    .button-grid {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .button-grid button {
        width: 100%;
        max-width: 280px;
        margin-bottom: 0;
        padding: 12px 8px;
    }
    
    /* Table responsive styles */
    .table-container {
        overflow-x: auto;
        margin: 10px 0;
    }
    
    table {
        min-width: 600px;
        font-size: 12px;
    }
    
    /* Map controls responsive */
    .kml-controls,
    #filterControlsBox {
        width: 90vw;
        right: 5vw;
        left: 5vw;
        top: 120px;
        max-height: 70vh;
    }
    
    #kmlToggleBtn,
    #filterToggleBtn {
        top: 100px;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    #kmlToggleBtn {
        right: 10px;
    }
    
    #filterToggleBtn {
        right: 120px;
    }
    
    #map-title {
        /* top: 100px;
        left: 10px;
        right: 140px;
        font-size: 12px;
        padding: 6px 10px;
        max-width: none;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis; */
                top: 100px;
        left: 10px;
        right: auto;           /* remove right limit */
        font-size: 12px;
        padding: 6px 10px;

        max-width: 60vw;       /* 60% of viewport width */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    #returnToStartBtn,
    #returnToAreaBtn {
        right: 10px;
        bottom: 70px;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    /* Form elements responsive */
    .form-container input[type="text"],
    .form-container input[type="password"],
    .form-container input[type="number"],
    .form-container select {
        padding: 10px;
        font-size: 16px;
    }
    
    .filter-grid-2col {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}


@media screen and (max-width: 576px) {
    /* Small mobile devices */
    .sidebar {
        width: 280px;
        left: -280px;
    }

    .header {
        padding: 8px 10px; /* simple, even padding */
    }

    .sidebar-toggle {
        font-size: 20px;
        padding: 6px;
        margin-right: 8px;
    }
    
    .system-title {
        font-size: 14px;
        max-width: calc(100vw - 80px);
    }
    
    .logo img {
        height: 35px;
        margin-right: 8px;
    }
    
    .content-1, .content {
        padding: 10px;
    }
    
    .big-toggle {
        padding: 10px 12px;
        font-size: 16px;
        margin: 8px auto;
    }
    
    .panel {
        padding: 10px;
        margin: 0 auto 10px;
    }
    
    .form-container {
        padding: 12px;
        margin: 10px auto;
    }
    
    .form-container h2 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .button-container button,
    #toggleFormBtn,
    .form-container button {
        padding: 12px 16px;
        font-size: 14px;
        width: 100%;
    }
    
    /* Map controls for very small screens */
    #kmlToggleBtn,
    #filterToggleBtn {
        top: 90px;
        padding: 6px 10px;
        font-size: 11px;
    }
    
    #kmlToggleBtn {
        right: 5px;
    }
    
    #filterToggleBtn {
        right: 100px;
    }
    
    #map-title {
        top: 90px;
        left: 5px;
        right: 120px;
        font-size: 11px;
        padding: 5px 8px;
    }
    
    .kml-controls,
    #filterControlsBox {
        width: 95vw;
        right: 2.5vw;
        left: 2.5vw;
        top: 110px;
        padding: 12px;
    }
    
    #returnToStartBtn,
    #returnToAreaBtn {
        right: 5px;
        bottom: 60px;
        padding: 6px 10px;
        font-size: 11px;
    }
}


@media screen and (max-width: 480px) {
    .sidebar {
        width: 280px;
        left: -280px;
    }
    
    .sidebar-header {
        padding: 15px;
    }
    
    .sidebar-nav li a {
        padding: 12px 15px;
        font-size: 14px;
    }

    /* Small mobile devices */
    .system-title {
        font-size: 18px;
    }
    
    .content-1, .content {
        padding: 10px;
    }
    
    .big-toggle {
        padding: 10px 12px;
        font-size: 16px;
        margin: 8px auto;
    }
    
    .panel {
        padding: 8px;
        margin: 0 auto 8px;
    }
    
    .form-container {
        padding: 12px;
    }
    
    .form-container h2 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .button-container button,
    #toggleFormBtn,
    .form-container button {
        padding: 12px 16px;
        font-size: 14px;
        width: 100%;
    }
    
    /* Map controls for very small screens */
    #kmlToggleBtn,
    #filterToggleBtn {
        top: 100px;
        padding: 6px 10px;
        font-size: 12px;
    }
    
    #kmlToggleBtn {
        right: 5px;
    }
    
    #filterToggleBtn {
        right: 100px;
    }
    
    #map-title {
        top: 100px;
        left: 5px;
        font-size: 12px;
        padding: 4px 8px;
        max-width: 150px;
    }
    
    .kml-controls,
    #filterControlsBox {
        width: 95vw;
        right: 2.5vw;
        top: 130px;
        padding: 10px;
    }
    
    #returnToStartBtn,
    #returnToAreaBtn {
        right: 5px;
        bottom: 60px;
        padding: 5px 8px;
        font-size: 11px;
    }
    
    /* Table improvements for very small screens */
    td {
        padding-left: 45%;
    }
    
    td::before {
        width: 40%;
        font-size: 12px;
    }
    
    /* KML buttons container */
    .buttons-container {
        max-height: 150px;
    }
    
    .kml-toggle-btn {
        padding: 6px 8px;
        font-size: 11px;
    }
}

@media screen and (max-width: 400px) {
    /* Extra small devices */
    .sidebar {
        width: 260px;
        left: -260px;
    }
    
    .system-title {
        font-size: 13px;
    }
    
    .logo img {
        height: 30px;
        margin-right: 6px;
    }
    
    .sidebar-header {
        padding: 15px;
    }
    
    .sidebar-nav li a {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    #kmlToggleBtn,
    #filterToggleBtn {
        font-size: 10px;
        padding: 5px 8px;
    }
    
    #filterToggleBtn {
        right: 85px;
    }
    
    #map-title {
        font-size: 10px;
        right: 100px;
    }
}


@media screen and (max-width: 320px) {
    /* Extra small devices */
    #kmlToggleBtn,
    #filterToggleBtn {
        font-size: 11px;
        padding: 5px 8px;
    }
    
    #filterToggleBtn {
        right: 90px;
    }
    
    #map-title {
        font-size: 11px;
        max-width: 130px;
    }
    
    .kml-controls,
    #filterControlsBox {
        font-size: 14px;
    }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
    /* Optimizations for touch devices */
    .button-grid button,
    .kml-toggle-btn,
    .btn-primary,
    .btn-secondary,
    .upload-btn,
    .sidebar-nav li a {
        min-height: 44px;
    }
    
    .sidebar-toggle {
        min-width: 44px;
        min-height: 44px;
    }
    
    .navbar ul li a {
        padding: 16px 20px;
    }
    
    .filter-checkbox-label {
        min-height: 44px;
        align-items: center;
    }
    
    input[type="checkbox"] {
        transform: scale(1.2);
        margin-right: 8px;
    }
    
    /* Larger touch targets for mobile */
    #kmlToggleBtn,
    #filterToggleBtn,
    #returnToStartBtn,
    #returnToAreaBtn {
        min-height: 40px;
        padding: 10px 15px;
    }
}

/* ===== ORIENTATION SPECIFIC STYLES ===== */
@media screen and (max-width: 768px) and (orientation: landscape) {
    /* Landscape mode on mobile */
    #map-container {
        height: 65vh;
    }
    
    .kml-controls,
    #filterControlsBox {
        max-height: 60vh;
        top: 80px;
    }
    
    #kmlToggleBtn,
    #filterToggleBtn {
        top: 70px;
    }
    
    #map-title {
        top: 70px;
    }
    
    .header {
        min-height: 50px;
    }
    
    /* .sidebar-toggle {
        top: 50%;
        transform: translateY(-50%);
    } */
}

/* ===== HIGH DPI SCREENS ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Retina display optimizations */
    .logo img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ===== REDUCED MOTION FOR ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .big-toggle,
    .chev,
    .upload-btn,
    .kml-toggle-btn,
    .btn-primary,
    .btn-secondary {
        transition: none;
    }
}

/* ===== BODY SCROLL LOCK ===== */

body.sidebar-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ===== SMOOTH SCROLLING FOR SIDEBAR ===== */
.sidebar {
    -webkit-overflow-scrolling: touch;
}

/* ===== IMPROVED HEADER LAYOUT ===== */
.header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    color: black;
    padding: 10px 20px;
    min-height: 70px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.logo {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.logo img {
    margin-right: 15px;
    flex-shrink: 0;
}

.system-title {
    font-size: 20px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info {
    flex-shrink: 0;
}

/* ===== LOADING STATE FOR SIDEBAR ===== */
.sidebar-loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.sidebar-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
    .sidebar {
        transition: none;
    }
    
    .sidebar-nav li a {
        transition: none;
    }
}

/* Focus styles for accessibility */
.sidebar-toggle:focus,
.sidebar-close:focus,
.sidebar-nav li a:focus {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* ===== DARK MODE SUPPORT ===== */
/* @media (prefers-color-scheme: dark) {
    
    body {
        background-color: #1a1a1a;
        color: #ffffff;
    }
    
    .category,
    .form-container {
        background-color: #2d2d2d;
        color: #ffffff;
        box-shadow: 0 0 8px rgba(255,255,255,0.1);
    }
    
    .filter-input,
    .form-container input[type="text"],
    .form-container input[type="password"],
    .form-container input[type="number"],
    .form-container select {
        background-color: #3d3d3d;
        color: #ffffff;
        border-color: #555;
    }
    
    .kml-controls,
    #filterControlsBox {
        background-color: #2d2d2d;
        color: #ffffff;
    }
    
    #map-title {
        background: rgba(45, 45, 45, 0.9);
        color: #ffffff;
    }
}  */