/* --- Base & Body --- */
body {
    margin: 0;
    font-family: 'Roboto', Arial, sans-serif;
    /* display: flex; /* Keep for desktop */
    height: 100vh;
    overflow: hidden; /* Prevent body scrollbars usually */
    background-color: #f8f9fa;
    color: #333;
    position: relative; /* Needed for positioning context of children */
    transition: padding-left 0.3s ease-in-out; /* Smooth map transition */
}

body.logged-in {
    display: flex; /* Only use flex when logged in */
}

/* --- Layout: Sidebar + Map (Desktop Default) --- */
#sidebar {
    width: 350px;
    padding: 25px;
    background: #ffffff;
    border-right: 1px solid #dee2e6;
    box-sizing: border-box;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 1001; /* Above map, below button */
    position: fixed; /* Changed to fixed for easier mobile handling */
    left: 0;
    top: 0;
    height: 100%;
    transition: transform 0.3s ease-in-out; /* For smooth sliding */
    transform: translateX(0); /* Default state */
}

#map {
    /* flex: 1; /* Let padding handle the offset */
    height: 100%;
    background-color: #e9ecef;
    /* position: relative; /* Removed, let body handle context */
    z-index: 1; /* Below sidebar */
    margin-left: 350px; /* Default offset matching sidebar width */
    width: calc(100% - 350px); /* Fill remaining space */
    transition: margin-left 0.3s ease-in-out, width 0.3s ease-in-out; /* Smooth transition */
}

/* --- Hamburger Menu Button --- */
#hamburger-menu-button {
    display: none; /* Hidden by default (on desktop) */
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1002; /* Highest */
    font-size: 1.8rem; /* Adjust size */
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    line-height: 1; /* Prevent extra spacing */
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
#hamburger-menu-button:hover {
    background-color: #eee;
}

/* --- Menu Overlay --- */
#menu-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent black */
    z-index: 1000; /* Below sidebar, above map */
    cursor: pointer; /* Indicate it's clickable */
}

/* --- Sidebar Content (Existing Styles) --- */
/* ... your existing #sidebar h2, h3, hr, .form-group, input, textarea styles ... */
#sidebar h2, #sidebar h3 {
    color: #0056b3;
    margin-top: 0;
    margin-bottom: 15px;
}
#sidebar h3 {
    margin-top: 20px;
    font-size: 1.1em;
}
#sidebar hr {
    border: 0;
    height: 1px;
    background-color: #dee2e6;
    margin: 20px 0;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: #495057;
}
.form-group input[type="text"],
.form-group input[type="date"], /* Added date */
.form-group input[type="file"], /* Added file */
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
}
.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus,
.form-group textarea:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}


/* --- Tag Filters (Existing Styles) --- */
.tag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}
.tag-filter-button {
    padding: 6px 12px;
    border: 1px solid #007bff;
    background-color: #fff;
    color: #007bff;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.tag-filter-button:hover {
    background-color: #e7f3ff;
}
.tag-filter-button.active {
    background-color: #007bff;
    color: #fff;
    font-weight: 500;
}

/* --- Buttons (Existing Styles) --- */
/* ... your existing button, .button-logout, .button-secondary styles ... */
button, .button-upload /* Style the upload link like a button */ {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    background-color: #007bff; /* Default blue */
    color: white;
    text-align: center; /* For link acting as button */
    text-decoration: none; /* For link acting as button */
    display: inline-block; /* For link acting as button */
}
button:hover, .button-upload:hover {
    background-color: #0056b3;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.button-logout {
    background-color: #dc3545;
    width: 100%;
}
.button-logout:hover {
    background-color: #c82333;
}
.button-secondary {
    background-color: #6c757d;
    color: white;
}
.button-secondary:hover {
    background-color: #5a6268;
}
/* Explicit style for Upload link in sidebar */
#sidebar .button-upload {
     display: block;
     background: #28a745;
     margin-top: 15px;
     margin-bottom: 15px;
}
#sidebar .button-upload:hover {
    background: #218838;
}

/* --- Status Message (Inside Sidebar) --- */
.status-message {
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 5px;
    min-height: 1.2em; /* Prevent layout jump */
}

/* --- Authentication Page Styles --- */
/* ... (Keep your existing .auth-container styles) ... */
.auth-container {
    max-width: 450px;
    margin: 40px auto;
    padding: 30px;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
/* ... rest of auth styles ... */
/* --- Survey Button Styling --- */
#survey-link { /* Target the anchor tag wrapping the button */
    text-decoration: none; /* Remove underline from link */
    display: block;        /* Ensures the link takes up the full width for the button */
    /* REMOVE fixed positioning properties:
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    */
}

#survey-button {
  padding: 10px 20px;
    background-color: #ffc107; /* A distinct color, e.g., warning yellow/orange */
    color: #212529; /* Dark text for good contrast on yellow */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background-color 0.2s ease, transform 0.1s ease;
    width: 100%; /* Ensures the button itself takes full width of its container (the <a> tag) */
                 /* This makes the inline style="width: 100%;" in index.php redundant but harmless */
}

#survey-button:hover {
    background-color: #e0a800; /* Darker shade on hover */
    transform: translateY(-1px); /* Slight lift effect */
}

#survey-button:active {
    transform: translateY(0px); /* Press down effect */
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}


/* --- === RESPONSIVE STYLES (Mobile) === --- */
@media (max-width: 767px) {
    body.logged-in {
        /* On mobile, body doesn't need flex, elements are positioned fixed/absolute */
        display: block;
        overflow-x: hidden; /* Prevent horizontal scroll when menu is out */
    }

    #sidebar {
        transform: translateX(-100%); /* Start hidden off-screen */
        width: 280px; /* Adjust width for mobile menu */
        box-shadow: 2px 0 5px rgba(0,0,0,0.2); /* Optional shadow */
        /* Other properties like position:fixed, top, height, z-index are inherited */
    }

    /* State when sidebar is visible on mobile */
    body.sidebar-visible #sidebar {
        transform: translateX(0); /* Slide in */
    }

    #map {
        margin-left: 0; /* Map takes full width */
        width: 100%;
        height: 100vh; /* Ensure map covers full viewport height */
    }

    #hamburger-menu-button {
        display: block; /* Show the button */
    }

    /* State when sidebar is visible for the overlay */
    body.sidebar-visible #menu-overlay {
        display: block; /* Show the overlay */
    }

    /* Adjust Survey Button and Status positions for mobile */


    #status {
        position: fixed; /* Change to fixed for mobile consistency */
        top: auto; /* Unset top */
        bottom: 10px;
        left: 10px; /* Position near bottom left */
        max-width: calc(100% - 90px); /* Avoid overlapping survey button */
        z-index: 990; /* Below sidebar/button/overlay */
    }

    /* Ensure Leaflet controls are above map but below overlay/sidebar */
    .leaflet-control-container {
        z-index: 900 !important;
    }
    .leaflet-top.leaflet-right { /* Default zoom control position */
         top: 10px; /* Add some top margin */
    }

     /* If Leaflet popup content gets too wide */
     .leaflet-popup-content-wrapper {
         max-width: calc(100vw - 40px); /* Limit popup width */
         box-sizing: border-box;
     }
     .leaflet-popup-content {
         max-width: 100%;
         box-sizing: border-box;
     }
     .leaflet-popup-content img {
         max-width: 100% !important; /* Ensure images fit */
         height: auto !important;
     }
}


/* --- Leaflet Popup Customizations --- */
.leaflet-popup-content { /* Main content area of the popup */
    margin: 13px 20px 13px 20px; /* Default is 13px 19px */
    line-height: 1.4;
    font-size: 0.9rem; /* Base font for popup content */
}

.leaflet-popup-content-inner { /* Optional: if you want an inner wrapper */
    /* Add any specific styles for the inner content if needed */
}

.popup-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin-bottom: 8px;
    border-radius: 4px;
    border: 1px solid #eee;
}

.leaflet-popup-content h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
    color: #333;
}

.popup-caption {
    margin-top: 0;
    margin-bottom: 8px;
    color: #555;
    font-size: 0.9em;
}
.popup-caption strong {
    color: #333;
}


.popup-tags {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 0.85em;
    color: #666;
}
.popup-tags strong {
    color: #444;
}

.popup-meta {
    font-size: 0.8em;
    color: #777;
    margin-top: 5px;
    margin-bottom: 0;
}

/* Styles for the scrollable image gallery within a popup */
.popup-image-scroller {
    max-height: 250px; /* Adjust as needed */
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px; /* Space for scrollbar */
    margin-top: 10px;
    border-top: 1px solid #f0f0f0; /* Optional separator */
    padding-top: 10px; /* Space above first item in scroller */
}

.popup-image-item {
    margin-bottom: 15px;
}
.popup-image-item:last-child {
    margin-bottom: 0;
}

.popup-item-separator {
    border: 0;
    height: 1px;
    background-color: #e0e0e0;
    margin: 15px 0;
}

/* Responsive adjustments for popups if needed */
@media (max-width: 767px) {
    .leaflet-popup-content {
        max-width: calc(100vw - 60px); /* Ensure popup isn't too wide on mobile */
    }
    .popup-image-scroller {
        max-height: 200px; /* Smaller scroll area on mobile */
    }
}


/* --- Style to hide the rogue blue hamburger button --- */
.hamburger-menu-button { /* Or use #rogue-id if it's an ID */
    display: none !important; /* Hide it on all screen sizes */
}
#hamburger-menu-button {
    display: none; /* Hidden by default (on desktop) */
    position: fixed;
    top: 12px; /* Slightly adjusted for better spacing */
    left: 12px;
    z-index: 1002; /* Highest */
    font-size: 1.6rem; /* Adjust size if needed */
    background-color: rgba(255, 255, 255, 0.95); /* Slightly more opaque */
    color: #333;
    border: 1px solid #bbb; /* Slightly darker border */
    border-radius: 4px;
    padding: 4px 9px; /* Adjust padding for the icon */
    cursor: pointer;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    pointer-events: auto; /* Ensure it's clickable */
}

  #hamburger-menu-button {
        display: block; /* Show the button on mobile */
    }
/* Add styles for the sidebar-visible class on the body */