/* -------------------------
   Global Styles
   ------------------------- */

body {
    font-family: 'Libre Franklin', sans-serif;
}

/* Header section: fixed at the top */
.header {
    width: 100%;
    /* Take full width of the viewport */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    /* Adjust height as needed */
    background-color: white;
    /* Set background color for visibility */
    z-index: 1000;
    /* Ensure it stays above other content */
    border-bottom: 1px solid #ddd;
    /* Optional: Add border for separation */
}

/* Body section will grow to fill available space */
.body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding-top: 90px;
}

/* -------------------------
   General Container Styles
   ------------------------- */

.container-style {
    padding: 1rem;
    background-color: white
        /*#EAECEE*/
    ;
}

/* -------------------------
   Title and Year Text Styles
   ------------------------- */

/* Header container that holds title and buttons */
.header-container {
    display: flex;
    justify-content: space-between;
    /* Align title to the left, buttons to the right */
    align-items: center;
    width: 100%;
    /* Take full width of the header */
}

.header-title {
    /*background-color: lightblue; !* Debug color for the title *!*/
    flex-grow: 1;
}

.title-section {
    font-family: "Kaisei Decol", serif;
    font-size: 60px;
    margin-left: 50px;
    color: black;
    font-weight: 400;
}

.year-text {
    color: #C2282D;
}

/* -------------------------
   Hamburger Nav Styling
   ------------------------- */

/* Hamburger styles */
.hamburger-menu {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    cursor: pointer;
    margin-right: 50px;
}

.bar {
    height: 3px;
    background-color: #C2282D;
    /* Primary red color */
    border-radius: 2px;
}

/* Base styles for dropdown */
.nav-dropdown {
    position: absolute;
    right: 50px;
    top: 80px;
    background-color: white;
    border: 1px solid #ddd;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 999;
    padding: 10px;
    border-radius: 4px;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* When visible */
.nav-dropdown.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-link {
    display: block;
    padding: 8px 12px;
    color: black;
    text-decoration: none;
    font-weight: 500;
    opacity: 1;
    text-align: left;
    transition: opacity 0.2s ease;
}

.nav-link:hover {
    opacity: 0.8;
}

.nav-link.active {
    color: #C2282D;
}

/* -------------------------
   City match section styling
   ------------------------- */

.city-match-content-wrapper-mainpage {
    /*background-color: #ffefc1;*/
    width: 100%;
    margin-bottom: 10px;
}

.city-match-sidebar-mainpage {
    /*background-color: #c1e7ff;*/
    width: 35%;
    float: left;
}

.city-match-main-content-mainpage {
    /*background-color: #e1ffc1;*/
    width: 65%;
    float: right;
}

.city-match-output-container-mainpage {
    display: none;
    /* Hidden by default */
    margin: 0;
    padding: 0;
    width: 100%;
    /* Ensures it stays aligned with the input field */
}

.city-match-output-container-mainpage p {
    margin: 0;
    padding: 0;
}

/* Make the container visible only when it has content */
.city-match-output-container-mainpage.visible {
    display: block;
    /* Show when there's content */
    margin: 0;
    padding: 0;
}

.info-toggle-button {
    background-color: #f0f0f0;
    /* Light grey background */
    color: #555;
    /* Muted text color */
    border: 1px solid #ccc;
    /* Light border */
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 14px;
    cursor: pointer;
    position: relative;
}

/* Hover text (tooltip) for search button */
.info-toggle-button:hover:after {
    content: "Search places in Hong Kong to see if we have some materials about it :)";
    position: absolute;
    top: 50%;
    left: 105%;
    /* Move the tooltip to the right of the button */
    transform: translateY(-50%);
    /* Vertically center the tooltip */
    background-color: #f0f0f0;
    padding: 5px;
    border-radius: 5px;
    border: 1px solid #ccc;
    color: #333;
    font-size: 12px;
    white-space: nowrap;
    z-index: 9999;
    text-align: left;
    /* Align text inside the tooltip */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* Add a subtle shadow for depth */
}

.info-toggle-button:hover {
    background-color: #ddd;
    /* Darken on hover for subtle effect */
}

/* Add margin around the button */
.info-tab-container {
    text-align: left;
}

.city-input-field {
    color: #555;
    /* Text color */
    border: 1px solid #ddd;
    /* Light border matching the buttons */
    border-radius: 5px;
    /* Rounded corners matching buttons */
    padding: 5px 10px;
    /* Ensure similar padding to buttons */
    font-size: 14px;
    /* Matching the font size */
    height: 30px;
    /* Ensure consistent height with buttons */
    box-sizing: border-box;
    /* Ensure the padding and border are included in the input size */
}

/* Adjust spacing inside the search section */
.city-input-container-mainpage {}

.submit-city-button-mainpage,
.clear-city-button-mainpage {
    background-color: #f0f0f0;
    /* Light grey background */
    color: #555;
    /* Muted text color */
    border: 1px solid #ccc;
    /* Light border */
    border-radius: 5px;
    padding: 3px 10px;
    font-size: 14px;
    margin-left: 10px;
    cursor: pointer;
}

.submit-city-button-mainpage:hover,
.clear-city-button-mainpage:hover {
    background-color: #ddd;
    /* Darken on hover */
}

/* -------------------------
   Footer Container Styles
   ------------------------- */

/* Main footer div with debug color */
.footer-main {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    width: 100%;
    z-index: 1000;
    /*background-color: lightcoral; !* Debug color for visibility *!*/
    background-color: white;
    display: flex;
    align-items: center;
    border-top: 1px solid #ddd;
    /* Optional: Add border for separation */
}

/* Info container with its own debug color */
.info-container {
    /*background-color: lightblue; !* Debug color for the content container *!*/
    width: 100%;
    padding: 0 50px;
    /* Add space on the sides */
    display: flex;
    /* Flexbox for horizontal alignment */
    align-items: center;
    /* Vertically center the children */
    justify-content: flex-start;
    /* Align content to the left */
}

/* Styling for GitHub image */
.info-image {
    margin-right: 0.5rem;
    /* Space between image and text */
    width: 32px;
}

/* Wrapper for all text */
.text-container {
    display: flex;
    flex-direction: column;
    /* Stack the two lines vertically */
    line-height: 1.1;
    /* Adjust line spacing (smaller value reduces the gap) */
}

/* First line with GitHub link */
.info-line {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 0;
}

/* Link styling */
.info-link {
    text-decoration: none;
    /* Removes underline */
    color: #007bff;
    font-size: 12px;
}

.info-link:hover {
    text-decoration: underline;
    /* Underline on hover */
}

/* Info text styling */
.info-text {
    font-size: 12px;
    color: black;
}

.info-footer,
.disclaimer-text,
.disclaimer-link {
    margin: 0;
    /* Ensures no unwanted spacing */
    padding: 0;
}

/* Footer text styling */
.info-footer {
    font-size: 9px;
    color: #555;
    /* Grey color for footer text */
    opacity: 0.7;
    /* Slight transparency */
}

/* Disclaimer text styling */
.disclaimer-text {
    font-size: 10px;
    color: #555;
    /* Subtle grey color */
}

/* Styling for disclaimer link */
.disclaimer-link {
    font-size: 10px;
    /* Match disclaimer font size */
    color: #007bff;
    /* Subtle blue for links */
}

/* -------------------------
   404 Styles
   ------------------------- */

.not-found-content-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    /* Full height of the viewport */
    text-align: center;
    /* Center text inside the container */
}

.custom-text {
    font-size: 24px;
    /* Adjust font size as needed */
}

/* -------------------------
   Dropdown Styles
   ------------------------- */
.dropdown-style {
    margin-bottom: 5px;
}

/* -------------------------
   Main Content Container for Map and Sidebar
   ------------------------- */

/* Main layout wrapping everything */
.main-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* Ensure the full height of the viewport is used */
}

/* Main Content should take up the remaining height between header and footer */
.main-content {
    flex-grow: 1;
    /* Fill remaining available space */
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    /* Only header height now */
    margin-left: 50px;
    margin-right: 50px;
    /*overflow: hidden;  !* Prevent overflow *!*/
}

.map-sidebar-container {
    display: flex;
    flex-grow: 1;
    /* Take up available space */
    height: 100%;
    /* Full height of the remaining space */
    overflow-y: hidden;
    /* Prevent overflow */
}

/* Map Section: Now on the left */
.map-section {
    float: left;
    width: 70%;
    /* Map takes 70% of the width */
    height: calc(100% - 40px);
    /* Leave 40px vertical space (20px top + 20px bottom) */
    display: flex;
    flex-direction: column;
    padding-right: 20px;
    /* Optional padding for spacing */
    /* padding-top: 20px; */
    /* Add top padding for white space */
    padding-bottom: 30px;
    /* Add bottom padding for white space */
    box-sizing: border-box;
}

/* Ensure the map display takes most but not all height */
.map-display {
    flex-grow: 1;
    /* Ensures the map stretches to fill available space */
    min-height: 400px;
    /* Set minimum height to ensure map is still functional */
}

#map-display .scatterlayer path {
    cursor: pointer !important;
    /* Enforces the pointer (arrow) instead of the default cursor */
}

/* Sidebar Section: Now on the right */
.sidebar-container {
    float: right;
    width: 30%;
    /* Sidebar takes 30% of the width */
    height: 100%;
    /* Full height */
    display: flex;
    flex-direction: column;
    padding-left: 20px;
    /* Optional padding for spacing */
    box-sizing: border-box;
    overflow-y: auto;
}

/* Ensure all containers stretch to fit within the layout */
.map-display,
.sidebar-container {
    height: 100%;
    /* Both map and sidebar take full height */
    padding: 0;
    margin: 0;
}

.star-ratings-container-main {
    display: flex;
    width: 70%;
    margin-top: 10px;
    margin-bottom: 60px;
    justify-content: space-between;
    /* Ensures equal spacing */
}

.star-ratings-container-main>div {
    flex: 1;
    /* Makes all 5 items equal width */
    text-align: left;
    /* Aligns content to the left inside each block */
    padding-right: 10px;
    /* Optional: small gap between columns */
}

.michelin-star,
.bib-image,
.green-star {
    height: 20px;
    width: auto;
    vertical-align: middle;
}

.star-description-title {
    font-weight: bold;
    font-size: 12px;
    /* Adjust as needed */
    margin-top: 2px;
    margin-bottom: 0;
    /* Remove bottom margin */
}

.star-description-text {
    font-size: 10px;
    /* Smaller text for description */
    color: #555;
    /* Darker grey for the description text */
    margin-top: 0;
    /* Space after the title */
    margin-bottom: 10px;
    /* Remove bottom margin */
}

.sidebar-container>* {
    padding: 0;
    margin: 0;
    /* Remove margins to make sure content does not "spill" out */
}

.description-container,
.instructions-container,
.dropdown-container,
.ratings-container,
.place-details-container {
    padding: 0;
    /* Remove padding */
    background-color: white;
    /*#f8f9fa*/
    ;
}

/* -------------------------
   Description and Instructions Styles
   ------------------------- */

.description-container {
    margin-bottom: 10px;
}

.site-description {
    font-size: 25px;
    font-weight: 700;
}

.instructions-container {
    margin-bottom: 10px;
}

.instructions {
    font-size: 16px;
    font-weight: 300;
}

.dropdown-title {
    font-size: 16px;
    font-weight: 700;
}

.dropdown-style {
    margin-bottom: 15px;
    /* Add some space between dropdowns */
}

.dropdown-container {
    margin-bottom: 0;
}


/* -------------------------
   Star selection Styles
   ------------------------- */

.star-select-title {
    font-size: 16px;
    font-weight: 700;
}

.star-button {
    /*width: 40px;*/
    padding: 5px;
}

.single-button {
    margin-right: 5px;
}

.star-filter-section>div {
    display: flex;
    justify-content: start;
    align-items: center;
    gap: 10px;
    /* Adjust this value to manage the gap between buttons */
    margin-bottom: 10px;
}

.star-filter-buttons>* {
    flex: 1;
    text-align: center;
}

/* Hover effect for star buttons */
.star-button:hover {
    opacity: 0.8 !important;
    cursor: pointer;
}

/* Active state for star buttons */
.star-button.active {
    opacity: 1;
    box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.2);
}

/* Inactive state, specifically less opacity when not active */
.star-button.inactive {
    opacity: 0.5;
    /* Lower opacity for inactive */
}

.star-button,
.selected-toggle-button {
    height: 36px;
    line-height: 1;
    text-align: center;
    border-radius: 8px;
    font-family: inherit;
    flex: 1;
}

.selected-toggle-wrapper {
    display: flex;
    margin-top: 10px;
    gap: 10px;
}

.selected-toggle-inner {
    flex: 1;
    /* Same width as a star button */
    display: flex;
    justify-content: flex-start;
    /* Align the button to the left */
    margin-right: 5px;
}

.selected-toggle-spacer {
    flex: 1;
    /* Spacer takes up 75% of the row */
    margin-right: 5px;
}

.selected-toggle-button {
    background-color: #808080;
    /* Matches the grey marker */
    color: #FFFFFF;
    font-size: 14px;
    text-align: center;
    border: 1px solid black;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.selected-toggle-button:hover {
    opacity: 0.8 !important;
    cursor: pointer;
}

.selected-toggle-button.active {
    opacity: 1;
    box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.2);
}

/* Inactive state, specifically less opacity when not active */
.selected-toggle-button.inactive {
    opacity: 0.5;
    /* Lower opacity for inactive */
}

/* -------------------------
   Place Details Styles
   ------------------------- */

.place-details {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #ccc;
    /* Default border color */
}

.placeholder-text {
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #666666;
    /* Default border color */
    background-color: #f8f8f8;
    /* Very light grey background */
    text-align: center;
}

.place-details-container {
    margin-top: 20px;
}

/* Header section containing the name and stars */
.details-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.place-name {
    font-size: 18px;
    /* Larger text for the name */
    font-weight: 700;
    /* Make the name stand out */
    margin-right: 10px;
    /* Space between name and stars */
}

.place-stars {
    display: flex;
    /* Align star images in a row */
    flex-wrap: nowrap;
    /* Prevent stars from wrapping to the next line */
}

/* Styling for the date, description, and condition */
.details-date,
.details-description,
.details-condition {
    font-size: 12px;
    /* Slightly larger text for key details */
}

.place-date,
.place-description,
.place-condition {
    font-size: 12px;
    /* Text styling for place date, description, and condition */
}

.place-info {
    margin-bottom: 10px;
}

/* Address and location styling */
.address-info {
    font-size: 12px;
    /* Clear and legible font size */
    margin-bottom: 10px;
    /* Space above address and location */
}

.place-address,
.place-location {
    font-size: 12px;
    /* Text styling for place address and location */
}

.details-link {
    margin-top: 10px;
    /* Space above the link section */
}

/* Link styling for the article link */
.place-link {
    font-size: 12px;
    display: block;
    /* Ensures the link is on a new line */
    color: #0056b3;
    /* Traditional link color */
    text-decoration: none;
    /* Removes underline */
    font-weight: 500;
    /* Bold for emphasis */
}

.place-link:hover {
    text-decoration: underline;
    /* Underline on hover for clarity */
}

.container-style {
    padding: 0;
    /* If you want to remove padding globally */
}


/* -------------------------
   Responsive Styles
   ------------------------- */

@media screen and (max-width: 1400px) {

    /* Adjust title font size in the header */
    .header {
        height: 70px;
    }

    .title-section {
        font-size: 50px;
    }

    .nav-dropdown {
        top: 70px;
        /* Same header height in this breakpoint */
    }

    .body {
        padding-top: 80px;
    }

    .analysis-container {
        margin-top: 60px;
        /* Adjust for header */
    }

    .description-container {
        margin-bottom: 10px;
    }

    /* Adjust site description font size */
    .site-description {
        font-size: 20px;
    }

    .place-name {
        font-size: 16px;
    }
}


/* Media Query for screens smaller than 1250px (Tablet Layout) */
@media screen and (max-width: 1250px) {

    /* Global layout changes */
    .main-content {
        margin-left: 30px;
        margin-right: 30px;
    }

    .header {
        margin-right: 30px;
    }

    .title-section {
        margin-left: 30px;
    }

    /* Hamburger styles */
    .hamburger-menu {
        margin-right: 30px;
    }

    .nav-dropdown {
        right: 0;
        margin-right: 30px;
        /* Aligns with hamburger's new position */
        top: 70px;
        /* Same header height in this breakpoint */
    }

    .info-container {
        /*background-color: lightblue; !* Debug color for the content container *!*/
        padding-left: 30px;
        padding-right: 30px;
    }

    /* Main layout changes */
    .main-layout {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        /* Ensure the full height of the viewport is used */
    }

    .main-content {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        height: calc(100vh - 80px);
        /* Adjusted for header only */
        /*overflow: auto;  !* Enable scrolling if necessary *!*/
    }

    /* Sidebar now comes above the map */
    .map-sidebar-container {
        display: flex;
        flex-direction: column;
        /* Stack sidebar above the map */
    }

    /* Move the sidebar content above the map */
    .sidebar-container {
        /*background-color: lightgreen; !* Debug color *!*/
        width: 100%;
        /* Take full width */
        order: 1;
        /* Move sidebar to appear first */
        height: auto;
        flex-shrink: 0;
        box-sizing: border-box;
    }

    /* Map section moves below the sidebar */
    .map-section {
        /*background-color: lightblue;*/
        flex-grow: 1;
        width: 100%;
        /* Map takes full width on tablet layout */
        padding-right: 0;
        /* Remove padding */
        padding-top: 20px;
        /* Add top padding for white space */
        padding-bottom: 20px;
        /* Add bottom padding for white space */
        order: 2;
        /* Move map below the sidebar */
        z-index: 0;
        position: relative;
        height: calc(100% - 40px);
        /* Leave 40px vertical space */
    }

    /* Ensure map display takes most but not all height */
    .map-display {
        flex-grow: 1;
        width: 100%;
        height: 100%;
        min-height: 300px;
        /* Smaller minimum height for mobile */
    }

    /* Full-width description and instructions at the top of main content */
    .description-container {
        /*background-color: cadetblue;  !* Optional background color *!*/
        width: 100%;
        /* Take full width */
        padding: 0;
        margin-bottom: 5px;
    }

    .instructions-container {
        /*background-color: cadetblue;  !* Optional background color *!*/
        margin-bottom: 10px;
    }

    .site-description,
    .instructions {
        padding: 0;
        margin: 0;
        /* Ensure no bottom margin on the description text */
    }

    /* Adjust the city match section to take full width below the description and instructions */
    .city-match-content-wrapper-mainpage {
        display: none;
    }

    .city-match-sidebar-mainpage {
        width: 40%;
        /* Take full width on tablet */
        float: left;
        /* Disable float */
    }

    .city-match-main-content-mainpage {
        width: 60%;
        /* Take full width on tablet */
        float: right;
        /* Disable float */
    }

    /* Container for dropdowns to display them side by side */
    .dropdowns-container-main {
        display: flex;
        /* Enable flexbox for side-by-side layout */
        gap: 20px;
        /* Adjust gap between each dropdown block */
        flex-wrap: wrap;
        /* Ensure dropdowns wrap on smaller screens */
        overflow: visible;
        position: relative;
        /* Ensure containers are positioned relative to allow absolute positioning inside */
        z-index: 1;
    }

    /* Each dropdown block (label + dropdown) */
    .dropdown-block {
        flex-grow: 1;
        /* Allow blocks to grow equally */
        min-width: 200px;
        /* Ensure dropdown blocks have a minimum width */
        max-width: 33%;
        z-index: 1000;
    }


    /* Adjustments for dropdown styling */
    .dropdown-style {
        width: 100%;
        /* Ensure the dropdown takes full width of its container */
        position: relative;
        z-index: 1000;
    }

    /* When the dropdown is expanded, make sure it floats above the rest */
    .dropdown-style .dropdown-menu {
        position: absolute;
        /* Float the expanded dropdown menu */
        top: 100%;
        /* Ensure it appears just below the dropdown button */
        left: 0;
        z-index: 2000;
        /* Ensure it's above everything else */
        width: 100%;
        /* Expand to the full width of the dropdown */
    }

    /* Flexbox container for filters and place details */
    .filters-and-details-container {
        flex-grow: 0;
        display: flex;
        flex-direction: row;
        /* Place items in a row (side by side) */
        gap: 20px;
        /* Adjust gap between the filters and place details */
        margin-bottom: 0;
    }

    /* Star ratings section takes up 50% of the width */
    .star-filter-section {
        flex-grow: 1;
        /* Allow the section to grow and take available space */
        max-width: 50%;
        /* Set a maximum width for this section */
        box-sizing: border-box;
        margin-bottom: 0;
    }

    /* Place details section takes up the other 50% of the width */
    .place-details-container {
        /*background-color: lightcoral;*/
        flex-grow: 1;
        /* This ensures it takes up available space */
        max-width: 50%;
        /* Restrict the maximum width to 50% */
        min-width: 50%;
        /* Ensure it does not shrink below 50% */
        height: auto;
        margin-top: 0;
        margin-bottom: 10px;
    }

    /* Star Ratings Section takes full width below the map */
    .star-ratings-container-main {
        width: 100%;
        /* Full width on tablet */
        display: flex;
        justify-content: space-around;
        /* Evenly distribute star rating sections */
        margin-top: 10px;
    }

    /* Analysis layout changes */
    .analysis-container {
        margin-top: 60px;
        /* Adjust for header */
    }

    .content-container {
        padding-left: 30px;
    }

    .region-content-wrapper {
        padding-right: 30px;
    }

    .region-description {
        font-size: 16px;
    }

    .visible-section {
        padding-right: 30px;
    }

    .ranking-content-wrapper {
        width: calc(100% - 30px);
        padding-right: 30px;
    }

    .ranking-description {
        font-size: 16px;
    }

    .demographics-container {
        padding-right: 30px;
    }

    .demographics-text-paragraph {
        font-size: 16px;
    }

    .wine-container {
        padding-right: 30px;
    }

    .wine-text-paragraph {
        font-size: 16px;
    }
}

/* -------------------------
   Gallery Page Styles
   ------------------------- */

.gallery-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.gallery-content {
    flex-grow: 1;
    padding: 2rem;
    padding-top: 120px;
    /* Account for fixed header (80px) + extra space */
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.gallery-header-section {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.gallery-title {
    font-family: "Kaisei Decol", serif;
    font-size: 2.5rem;
    color: #C2282D;
    margin-bottom: 1rem;
    font-weight: 500;
}

.gallery-subtitle {
    font-size: 1.2rem;
    color: #666;
    max-width: 700px;
    margin: 0 auto;
}

.gallery-filter-section {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
    justify-content: center;
    flex-wrap: wrap;
}

.filter-item {
    min-width: 250px;
}

.filter-label {
    font-weight: 600;
    color: #C2282D;
    margin-bottom: 0.5rem;
    display: block;
}

.gallery-filter-dropdown {
    width: 100%;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.gallery-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.gallery-card:hover {
    box-shadow: 0 4px 16px rgba(100, 10, 100, 0.15);
    transform: translateY(-4px);
}

.gallery-card-header {
    margin-bottom: 1rem;
}

.gallery-card-title {
    font-family: "Kaisei Decol", serif;
    font-size: 1.5rem;
    color: #C2282D;
    margin: 0 0 1rem 0;
    font-weight: 600;
}

.gallery-card-status-container {
    display: flex;
    align-items: center;
}

.gallery-card-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
}

.gallery-card-body {
    flex-grow: 1;
    margin-bottom: 1rem;
}

.gallery-card-location,
.gallery-card-date-info {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 0.5rem;
}

.gallery-card-icon {
    margin-right: 0.25rem;
}

.gallery-card-district,
.gallery-card-dates {
    font-weight: 500;
    color: #333;
}

.gallery-card-description {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.6;
    margin-top: 1rem;
}

.gallery-card-footer {
    border-top: 1px solid #e0e0e0;
    padding-top: 1rem;
}

.gallery-card-link {
    color: #B40505;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.gallery-card-link:hover {
    color: #FFB84D;
}

.no-results-message {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.1rem;
}

/* -------------------------
   Place Detail Page Styles
   ------------------------- */

.place-detail-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.place-detail-content {
    flex-grow: 1;
    padding: 2rem;
    padding-top: 120px;
    /* Account for fixed header (80px) + extra space */
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.breadcrumb-nav {
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: #666;
}

.breadcrumb-link {
    color: #B40505;
    text-decoration: none;
}

.breadcrumb-link:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    margin: 0 0.5rem;
}

.breadcrumb-current {
    color: #333;
}

.place-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.place-title {
    font-size: 2.5rem;
    color: #B40505;
    margin: 0;
    font-weight: 700;
}

.place-status-container {
    display: flex;
    align-items: center;
}

.place-status-badge {
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
}

.place-metadata {
    background: #f8f8f8;
    border-left: 4px solid #B40505;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 4px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.metadata-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.metadata-item {
    font-size: 0.95rem;
    line-height: 1.6;
}

.metadata-label {
    color: #B40505;
    margin-right: 0.5rem;
}

.metadata-value {
    color: #333;
}

.metadata-value-zh {
    color: #666;
    font-style: italic;
}

.metadata-link {
    color: #007bff;
    text-decoration: none;
    border-bottom: 1px solid #007bff;
}

.metadata-link:hover {
    color: #0056b3;
    border-bottom-color: #0056b3;
}

.place-divider {
    border: none;
    border-top: 2px solid #e0e0e0;
    margin: 2rem 0;
}

.place-article-content {
    margin-bottom: 3rem;
}

.markdown-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    min-height: 800px;
}

.back-to-gallery {
    text-align: center;
    margin: 3rem 0;
}

.back-to-gallery-link {
    color: #B40505;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 0.75rem 2rem;
    border: 2px solid #B40505;
    border-radius: 4px;
    display: inline-block;
    transition: all 0.3s;
}

.back-to-gallery-link:hover {
    background: #B40505;
    color: white;
}

.error-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.error-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.error-title {
    font-size: 2rem;
    color: #B40505;
    margin-bottom: 1rem;
}

.error-message {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 2rem;
}

.error-link {
    color: #B40505;
    text-decoration: none;
    font-weight: 600;
    padding: 0.75rem 2rem;
    border: 2px solid #B40505;
    border-radius: 4px;
    display: inline-block;
    transition: all 0.3s;
}

.error-link:hover {
    background: #B40505;
    color: white;
}

/* -------------------------
   Responsive Design
   ------------------------- */

/* Mobile breakpoint for main explore page and other pages */
@media (max-width: 768px) {

    /* Main page header adjustments */
    .header {
        height: 60px;
    }

    .title-section {
        font-size: 32px;
        margin-left: 15px;
    }

    .hamburger-menu {
        margin-right: 15px;
    }

    .nav-dropdown {
        right: 0;
        margin-right: 15px;
        top: 60px;
    }

    .body {
        padding-top: 70px;
    }

    /* Main content adjustments */
    .main-content {
        margin-left: 15px;
        margin-right: 15px;
        height: calc(100vh - 60px);
    }

    /* Sidebar full width on mobile */
    .sidebar-container {
        width: 100%;
        padding-left: 0;
        padding-right: 0;
        margin-bottom: 15px;
    }

    /* Map section full width */
    .map-section {
        width: 100%;
        padding-right: 0;
        padding-top: 15px;
        padding-bottom: 15px;
    }

    .map-display {
        min-height: 300px;
    }

    /* Description and instructions */
    .site-description {
        font-size: 18px;
    }

    .instructions {
        font-size: 14px;
    }

    /* Dropdowns stack vertically and full width */
    .dropdowns-container-main {
        flex-direction: column;
        gap: 15px;
    }

    .dropdown-block {
        min-width: 100%;
        max-width: 100%;
    }

    /* Filters and details container */
    .filters-and-details-container {
        flex-direction: column;
        gap: 15px;
    }

    .star-filter-section {
        max-width: 100%;
        width: 100%;
    }

    .place-details-container {
        max-width: 100%;
        min-width: 100%;
        margin-top: 15px;
    }

    /* Place details card */
    .place-details {
        padding: 12px;
    }

    .place-name {
        font-size: 16px;
    }

    /* Touch target sizes - ensure minimum 44x44px */
    .info-toggle-button {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 15px;
    }

    .submit-city-button-mainpage,
    .clear-city-button-mainpage {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 15px;
    }

    .city-input-field {
        min-height: 44px;
        padding: 10px 15px;
    }

    .star-button,
    .selected-toggle-button {
        min-height: 44px;
    }

    .hamburger-menu {
        min-height: 44px;
        min-width: 44px;
        padding: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 12px 16px;
    }

    /* Footer adjustments */
    .info-container {
        padding-left: 15px;
        padding-right: 15px;
    }

    .info-text,
    .info-link {
        font-size: 11px;
    }

    .info-footer,
    .disclaimer-text {
        font-size: 8px;
    }

    /* Gallery and place detail pages */
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-filter-section {
        flex-direction: column;
        gap: 1rem;
    }

    .gallery-content,
    .place-detail-content {
        padding-top: 80px;
        /* Adjusted for smaller header */
    }

    .place-title {
        font-size: 2rem;
    }

    .place-metadata {
        grid-template-columns: 1fr;
    }

    .place-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Small phone breakpoint */
@media (max-width: 480px) {

    /* Header further reductions */
    .header {
        height: 55px;
    }

    .title-section {
        font-size: 24px;
        margin-left: 10px;
    }

    .hamburger-menu {
        margin-right: 10px;
        width: 20px;
        height: 15px;
        min-height: 44px;
        min-width: 44px;
        padding: 12px;
    }

    .bar {
        height: 2px;
    }

    .nav-dropdown {
        margin-right: 10px;
        top: 55px;
        padding: 8px;
    }

    .nav-link {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 44px;
    }

    /* Ensure touch targets remain 44x44px on small phones */
    .info-toggle-button,
    .submit-city-button-mainpage,
    .clear-city-button-mainpage {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 15px;
    }

    .city-input-field {
        min-height: 44px;
        padding: 10px 15px;
    }

    .star-button,
    .selected-toggle-button {
        min-height: 44px;
    }

    .body {
        padding-top: 65px;
    }

    /* Main content further reductions */
    .main-content {
        margin-left: 10px;
        margin-right: 10px;
        height: calc(100vh - 55px);
    }

    /* Smaller fonts */
    .site-description {
        font-size: 16px;
    }

    .instructions {
        font-size: 13px;
    }

    .dropdown-title {
        font-size: 14px;
    }

    .star-select-title {
        font-size: 14px;
    }

    /* Map minimum height */
    .map-display {
        min-height: 250px;
    }

    /* Place details */
    .place-details {
        padding: 10px;
    }

    .place-name {
        font-size: 14px;
    }

    .place-date,
    .place-description,
    .place-condition,
    .place-address,
    .place-location {
        font-size: 11px;
    }

    /* Footer */
    .info-container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .info-image {
        width: 24px;
    }

    .info-text,
    .info-link {
        font-size: 10px;
    }

    .info-footer,
    .disclaimer-text,
    .disclaimer-link {
        font-size: 7px;
    }

    /* Gallery and place detail pages */
    .gallery-title {
        font-size: 2rem;
    }

    .place-title {
        font-size: 1.5rem;
    }

    .gallery-content,
    .place-detail-content {
        padding: 1rem;
        padding-top: 75px;
        /* Adjusted for even smaller screens */
    }
}

/* -------------------------
   Chat Widget Styles
   ------------------------- */

.chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    font-family: 'Libre Franklin', sans-serif;
}

/* Chat toggle button (when closed) */
.chat-toggle-button {
    background-color: #C2282D;
    color: white;
    padding: 14px 20px;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(194, 40, 45, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    min-width: 140px;
}

.chat-toggle-button:hover {
    background-color: #a01f23;
    box-shadow: 0 6px 16px rgba(194, 40, 45, 0.4);
    transform: translateY(-2px);
}

.chat-button-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat window (when open) */
.chat-window {
    width: 400px;
    height: 600px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat header */
.chat-header {
    background-color: #C2282D;
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.chat-header-title {
    display: flex;
    align-items: center;
    font-weight: 600;
}

.chat-close-button {
    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: 50%;
    transition: background-color 0.2s ease;
}

.chat-close-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Chat messages container */
.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-messages-container::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chat-messages-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.chat-message-wrapper {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
}

.chat-message-user {
    background-color: #C2282D;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message-assistant {
    background-color: white;
    color: #333;
    align-self: flex-start;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.chat-message-error {
    background-color: #ffebee;
    color: #C2282D;
    align-self: center;
    border: 1px solid #ffcdd2;
    max-width: 95%;
}

/* Thinking indicator animation */
.chat-message-thinking {
    padding: 10px 14px;
}

.chat-thinking-dots {
    display: inline-flex;
    gap: 4px;
    align-items: flex-end;
    height: 12px;
}

.chat-thinking-dots span {
    width: 5px;
    height: 5px;
    background-color: #C2282D;
    border-radius: 50%;
    animation: thinking-bounce 1.4s infinite;
}

.chat-thinking-dots span:nth-child(1) {
    animation-delay: 0s;
}

.chat-thinking-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-thinking-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinking-bounce {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    50% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Chat input area */
.chat-input-area {
    border-top: 1px solid #e0e0e0;
    background-color: white;
    padding: 16px;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.chat-input-field {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-family: 'Libre Franklin', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input-field:focus {
    border-color: #C2282D;
}

.chat-send-button {
    background-color: #C2282D;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.chat-send-button:hover {
    background-color: #a01f23;
}

.chat-send-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.chat-actions-container {
    display: flex;
    justify-content: center;
}

.chat-clear-button {
    background: none;
    border: none;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.chat-clear-button:hover {
    color: #C2282D;
}

/* Loading indicator */
.chat-loading-indicator {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #C2282D;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.chat-loading-text {
    font-size: 12px;
    color: #666;
}

/* Responsive design for mobile */
@media (max-width: 768px) {
    .chat-widget-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .chat-window {
        width: 100%;
        height: 500px;
        max-height: calc(100vh - 100px);
    }

    .chat-toggle-button {
        min-width: 120px;
        padding: 12px 16px;
    }

    .chat-message {
        max-width: 90%;
    }
}

/* Hide chat window when closed */
.chat-window[style*="display: none"] {
    display: none !important;
}