body, html {
    margin: 0;
    padding: 0;
    font-family: sans-serif;
    height: 100%;
    overflow: hidden; /* Prevent body scroll when map is full screen */
}

#app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 1. Map Styling (Crucial for Leaflet) */
#map {
    flex-grow: 1; /* Map takes up remaining vertical space */
    width: 100%;
    padding-top: 40px;
}
/* Ensure the standard Leaflet zoom control is correctly positioned in the top-left */
.leaflet-control-zoom {
    transition: transform 0.3s ease-out; /* Add smooth transition */
    /* Adjust these to match the height of your header bar (60px) */
    margin-top: 70px !important; 
    margin-left: 10px !important; 
}

/* New CSS class to push the zoom control when the filter panel is open */
.zoom-control-pushed .leaflet-control-zoom {
    /* Push the control to the right by the width of the filter panel (280px) */
    transform: translateX(290px); 
}

/* --- Global Panel Styles --- */
.app-panel {
    position: absolute;
    z-index: 1000; 
    width: 280px;
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 1px solid #ccc;
    transition: transform 0.3s ease-out;
}

.app-panel.hidden {
    display: none;
}

/* --- Filter Panel (Left) --- */
.filter-panel {
    position: absolute;
    top: 40px; /* Adjust based on your header/filter bar height */
    left: 10px;
    z-index: 1000; /* Ensure it's above the map and most elements */
    width: 250px;
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 1px solid #ccc;
    transition: opacity 0.3s, transform 0.3s;
}

.filter-panel:not(.hidden) {
    transform: translateX(0); /* Slide in */
}

/* Pastil/Pill Style for Filters */
.filter-pastil {
    width: 100%;
    padding: 6px 15px; /* More horizontal padding */
    margin-bottom: 8px; 
    border-radius: 20px; /* Pill shape */
    border: 1px solid #ccc;
    background-color: #f8f8f8;
    appearance: none; /* Remove default browser styling for select */
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    font-size: 14px;
    /* Optional: add a custom arrow if appearance: none removes it */
    background-image: url('data:image/svg+xml;utf8,<svg ...>'); /* Complex SVG needed for cross-browser arrow */
}

/* --- Filter Panel Contents --- */
#filter-controls select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
}
#stats-section {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: 0.9em;
}

/* --- New Filter Icon and Title Positioning --- */

/* Parent container for alignment (adjust class name if needed) */
.controls-container { 
    position: fixed; /* Needed for absolute positioning of children */
    top: 0px; 
    left: 0px; 
    right: 0px;height: 40px; /* NEW: Define a stable height */
    padding: 0 15px; /* Add horizontal padding */
    background-color: white; /* NEW: Give it a solid background */
    border-bottom: 1px solid #ddd;

    display: flex; /* Use flexbox for horizontal alignment */
    justify-content: space-between; /* Pushes toggles to edges */
    align-items: center;
    z-index: 1002; /* Highest priority */
    pointer-events: none; /* Crucial: Allows map interaction through the container */
}

/* Base style for all control icons (Hamburger and Filter) */
.control-icon {
    display: inline-block;
    font-size: 20px; 
    line-height: 1; 
    color: #333; 
    cursor: pointer;
}

/* The Filter Toggle container (Left side) */
#filter-toggle-container {
    pointer-events: auto; /* Allow clicks on the icon itself */
    padding: 10px;
    background: white;
    border-radius: 2px;
    /* box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); */
}

/* The Centered Title */
#app-title {
    pointer-events: none; /* Cannot be clicked */
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    margin: 0;
    flex-grow: 1; /* Allows title to take available space */
}

/* The Settings Toggle container (Right side) - Adjust existing CSS */
#settings-toggle-container {
    pointer-events: auto; /* Allow clicks */
    padding: 10px;
    background: white;
    border-radius: 4px;
    /* box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); */
}

/* 2. Controls and Filters */
#controls {
    /* Updated for mobile: */
    display: flex;
    flex-wrap: wrap; /* Allows controls to wrap onto multiple lines */
    gap: 10px; /* Reduced gap for smaller screens */
    padding: 10px 10px;
    background-color: #f8f8f8;
    border-bottom: 1px solid #ddd;
    align-items: center;
}
/* 1. Ensure the filter groups are styled for the pastil width */
.filter-group {
    min-width: 100px; /* Set a minimum width for the pastil */
    flex-grow: 0; /* Prevent the pastil from stretching */
    position: relative; /* CRITICAL: Needed for the custom dropdown arrow */
    height: 32px; /* Ensure select has the same height as the buttons */
}

/* 2. Styling the Select Box to look like a Pastil */
.filter-group select {
    /* Reset default browser appearance for styling control */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    
    width: 100%;
    /* Added right padding for the custom arrow */
    padding: 5px 15px 5px 5px; 
    cursor: pointer;
    
    /* Pastil appearance properties */
    background-color: #e9ecef; /* Light gray background */
    color: #333;
    border: 1px solid #ced4da;
    border-radius: 20px; /* Highly rounded corners */
    font-size: 12px;
    line-height: 1.5;
}

/* 3. Custom Arrow (ensures consistent look across all browsers) */
.filter-group::after {
    font-size: 10px;
    color: #555;
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    pointer-events: none; /* Allows clicks to go through to the select element */
}

/* 4. Optional: Style on Focus/Hover */
.filter-group select:hover,
.filter-group select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.1rem rgba(0, 123, 255, 0.25);
    outline: none;
}

/* Ensure buttons are next to each other */
#lang-toggle, 
#view-toggle {
    /* Retain padding and cursor settings */
    padding: 5px 10px;
    cursor: pointer;
    
    /* NEW: Pastil shape */
    border-radius: 20px; 
    white-space: nowrap; 
    
    /* Differentiating Button Appearance */
    background-color: #007bff; /* Primary blue background for action buttons */
    color: white; /* White text for contrast */
    border: 1px solid #007bff;
    
    /* Ensure they align well with the filter pastils */
    height: 32px; /* Set a fixed height to align with select elements */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Optional: Add Hover/Active State for a better user experience */
#lang-toggle:hover, 
#view-toggle:hover {
    background-color: #0056b3; /* Darker blue on hover */
    border-color: #0056b3;
}

#lang-toggle:active,
#view-toggle:active {
    background-color: #004085;
    border-color: #004085;
}

/* --- Settings Panel Styles --- */

/* --- New Container for Stable Positioning --- */

#settings-toggle-container {
    /* Anchors the container to the top-right corner of the viewport or a defined parent. 
       If your main control bar has 'position: relative', use that instead of 'fixed'.
       Assuming a fixed position for maximum stability against wrapping: */
    position: absolute;
    top: 0; /* Align to the top of the control bar */
    right: 0; /* Align to the right edge of the control bar */
    padding: 10px; /* Add padding for visual space */
    z-index: 1001; /* Must be higher than the settings panel (1000) */
    cursor: pointer; /* Indicate it's clickable */
}

/* --- Styling for the Hamburger Icon (the span) --- */

#settings-toggle {
    display: inline-block;
    font-size: 28px; 
    line-height: 0; 
    /* Add a visual cue when the user hovers over it */
    color: #333; 
    transition: color 0.2s;
}

#settings-toggle:hover {
    color: #007bff; /* Light blue on hover for better UX */
}

.settings-panel {
    position: absolute;
    top: 40px; /* Adjust based on your header/filter bar height */
    right: 10px;
    z-index: 1000; /* Ensure it's above the map and most elements */
    width: 250px;
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 1px solid #ccc;
    transition: opacity 0.3s, transform 0.3s;
}

.settings-panel.hidden {
    display: none;
    opacity: 0;
    transform: translateY(-10px);
}

.settings-panel h3 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.setting-group {
    margin-bottom: 15px;
}

.setting-group label {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
    color: #333;
}

/* Style for the map layer radio buttons */
#map-layer-selector label {
    display: block;
    font-weight: normal;
    padding: 4px 0;
}

/* 3. Custom Marker Styling (Fixed to display photo) */
.photo-marker {
    background-size: cover;
    background-position: center;
    border-radius: 50%; /* Makes it a circle */
    width: 20px; /* Thumbnail size: 20px */
    height: 20px; /* Thumbnail size: 20px */
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    display: flex; 
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.photo-marker div {
    /* Inner div handles the background-image and must fill the container */
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    border-radius: 50%;
}

/* Style for the container (the L.divIcon element) */
.favorite-marker {
    /* Add a red border using box-shadow for a clean, non-intrusive rim */
    box-shadow: 0 0 0 1px #ff4d4d; /* Light red color, 2px thickness */
    border-radius: 50%; /* Ensure the shadow is perfectly circular */
}

/* Style for the inner circle (the photo itself) - ensure it has max z-index */
/* While zIndexOffset in JS usually handles this, this is a clean way to ensure the *element* is above others */
.favorite-marker div {
    position: relative;
    z-index: 100; 
}

/* 4. Photo Modal Styling */
#photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

#photo-modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 80vw;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    text-align: center;
}

#modal-photo {
    max-width: 100%;
    max-height: 60vh;
    display: block;
    margin: 0 auto 15px;
    border: 1px solid #eee;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    color: #444;
}

/* 5. Tag Pastil Styling */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.tag-pastil {
    background-color: #e9ecef;
    color: #495057;
    padding: 4px 10px;
    border-radius: 15px; /* Creates the rounded, "pastil" look */
    font-size: 0.9em;
    font-weight: 500;
    white-space: nowrap;
}

/* NEW: Location description style */
.location-description-text {
    font-size: 0.9em;
    color: #444;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-style: italic;
    min-height: 1em; /* Ensures element doesn't collapse if empty */
}

.coordinates-text {
    font-family: monospace;
    font-size: 0.85em;
    color: #666;
    margin-top: 10px;
}