.layout-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px;
    height: 87dvh;
    min-height: 87dvh;
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
}

.map-controls {
    position: absolute;
    top: 2%;
    left: 2%;
    z-index: 998;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.map-search-box {
    width: 340px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    padding: 0;
    overflow: hidden;
}

.map-search-box input.form-control {
    border: none;
    outline: none;
    font-size: 16px;
    padding: 12px 24px;
    background-color: white;
    box-shadow: none;
    text-overflow: ellipsis; /* Optionally add ellipsis if the text is too long */
}

.map-search-box .input-group-text {
    background-color: white !important;
    border: none !important;
    padding-right: 14px;
    padding-left: 8px;
}

#searchIcon:hover i {
    color: #0d6efd; /* Bootstrap primary blue */
}

.loading-spinner-map {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    /* Ensures it appears above other elements */
}

.loading-spinner-list-view {
    justify-content: center; 
    margin-top: 2rem;
}

#map.loading {
    opacity: 0.5;
    transition: opacity 0.3s ease-in-out;
    /* Smooth transition */
}

/* Map container styles */
#map-container {
    flex: 1;
    height: 100%;
    position: relative;
    /* Needed to position the spinner correctly */
}

#map {
    max-height: inherit;
    height: 100%;
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 8px;
    transition: height 0.3s ease;
}

/* Info window styles */
.blurred {
    filter: blur(2px);
    opacity: 0.9;
}

/* Info window styles */
.info-window {
    position: absolute;
    left: 6px;
    bottom: 6px;
    background: white;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    max-width: 360px;
    max-height: calc(100% - 6px);
    min-height: 350px;
    width: calc(100% - 6px);
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.info-window.info-window--login-overlay {
    min-height: 500px;
}

.info-window.info-window--premium-overlay {
    min-height: 450px;
}

.info-window--visible {
    opacity: 1;
    transform: translateY(0);
}

.info-window__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.info-window__header-text {
    flex: 0 0 65%;
    padding-right: 8px;
}

.info-window__source-body {
    margin: 0;
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    word-wrap: break-word;
}

.info-window__committee {
    color: #666;
    font-size: 0.9em;
    display: block;
    word-wrap: break-word;
}

.info-window__image {
    flex: 0 0 30%;
    max-height: 50px;
    object-fit: contain;
    text-align: center;
}

.info-window__content {
    padding: 8px;
}

.info-window__title {
    margin: 0 0 8px 0;
    font-weight: bold;
    font-size: 1.1em;
}

.info-window__subtitle {
    margin: 0 0 8px 0;
}

.info-window__description {
    margin: 0 0 8px 0;
    line-height: 1.4;
    font-size: 0.9em;
    overflow: hidden;
    position: relative;
}

.info-window__description--collapsed {
    max-height: 1.4em;
    /* One line of text */
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info-window__description-toggle {
    background: none;
    border: none;
    color: var(--bs-primary);
    padding: 0;
    margin: 0 0 8px 0;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 400;
}

.info-window__description-toggle:hover {
    text-decoration: underline;
}

/* Common styles for header shareable link */
.info-window__shareable-link {
    color: #0066cc;
    text-decoration: none;
    font-weight: bold;
}

.info-window__shareable-link:hover {
    text-decoration: underline;
}

/* Specific styles for the shareable link in header */
.info-window__shareable-link {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.85em;
}

/* Footer layout */
.info-window__footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-window__period {
    color: #333;
    font-size: 0.9em;
    width: 100%;
    text-align: left;
}

/* Group the action buttons in the footer */
.info-window__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Keep hover behavior consistent for footer actions */
.info-window__actions a:hover,
.info-window__actions button:hover {
    text-decoration: underline;
}

/* Share button and dropdown styles */
.info-window__share-container {
    position: relative;
}

.info-window__share-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9em;
}

.info-window__share-button:hover {
    text-decoration: underline;
}

.info-window__share-dropdown {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 8px;
    margin-bottom: 8px;
    min-width: 150px;
    display: none;
    z-index: 2000; /* Ensure it appears above other elements */
}

.info-window__share-container.active .info-window__share-dropdown {
    display: block;
}

.info-window__share-option {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #333;
    text-decoration: none;
    padding: 4px 0;
    white-space: nowrap;
}

.info-window__share-option:hover {
    color: #0066cc;
    text-decoration: none;
}

/* Update the overlay for better presentation of auth options */
.info-window__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    z-index: 3000;
}

/* Container for auth message and buttons */
.info-window__auth-container {
    text-align: center;
    padding: 20px;
    max-width: 90%;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
}

.info-window__yearly-plan-wrap {
    position: relative;
}

.info-window__yearly-plan-wrap .btn {
    position: relative;
}

.info-window__yearly-discount-badge {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    z-index: 2;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background-color: var(--bs-danger);
    color: #fff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    line-height: 1;
    pointer-events: none;
}

.info-window__terms-bottom-text {
    font-size: 0.72rem;
    line-height: 1.2;
}

.info-window__existing-account-text {
    font-size: 0.72rem;
    line-height: 1.2;
}

.info-window--blurred {
    filter: blur(3px);
}

.info-window__close {
    flex: 0 0 5%;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    color: #666;
    text-align: right;
    height: 24px;
    line-height: 24px;
    position: relative; /* Keep above overlay */
    z-index: 4001; /* Higher than .info-window__overlay (3000) */
}

.info-window__close:hover {
    color: #333;
}

.info-window__place-info {
    margin: 8px 0;
    padding: 8px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.info-window__place-content {
    margin: 0;
    font-size: 0.9em;
    line-height: 1.4;
}

.info-window__place-header {
    margin: 0 0 8px 0;
    font-size: 0.9em;
    font-weight: bold;
    color: #333;
}

.info-window__place-type {
    margin: 0 0 4px 0;
    font-size: 0.9em;
    color: #666;
}

.info-window__place-description {
    margin: 0;
    font-size: 0.9em;
    line-height: 1.4;
}

/* Custom map type control styles */
.custom-map-type-control {
    margin: 10px;
    background: white;
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.custom-map-type-control button {
    border: none;
    background: white;
    padding: 8px;
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-map-type-control button:hover {
    background: #f1f1f1;
}

.custom-map-type-control img {
    width: 20px;
    height: 20px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.custom-map-type-control img.active {
    opacity: 1;
}

.custom-map-type-control button:hover img {
    opacity: 0.8;
}

.info-window__badges {
    display: flex;
    gap: 8px;
    margin: 8px 0;
}

.info-window__badges-left {
    flex: 2;  /* Takes up 2/3 of the space */
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-start;
    align-items: flex-start;  /* Prevents stretching to match right side */
}

.info-window__badges-right {
    flex: 1;  /* Takes up 1/3 of the space */
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
    align-items: flex-start;  /* Prevents stretching to match left side */
}

.info-window__badges .badge {
    margin: 2px;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    height: fit-content;  /* Ensures badge only takes needed height */
}

/* custom controls buttons */
.custom-controls-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;

}

.custom-map-type-control {
    margin: 0;
}

/* Ensure consistent sizing */
.info-window__report-button,
.info-window__share-button,
.info-window__source-link {
    font-size: 0.9em;
}

/* Add styles for collapsed place info */
.info-window__place-info--collapsed {
    display: none !important;
}

/* Ensure that even when the place info is displayed, it has proper spacing */
.info-window__place-info {
    margin: 8px 0;
    padding: 8px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

/* Make sure the description collapsed state is more clearly defined */
.info-window__description--collapsed {
    max-height: 1.4em;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 992px) {
    .layout-container {
        flex-direction: column;
        margin-top: 0;
        height: 95vh;
        margin:0;
        padding:0;
    }

    #FilterMapButtonContainer {
        margin-top: 0.5rem; /* Same as Bootstrap's mt-2 */
    }

    #list-container {
        padding-left: 0.5rem;  /* ~Bootstrap ps-2 */
        padding-right: 0.5rem; /* ~Bootstrap pe-2 */
    }
    
} 

/* hide footer on mobile */
@media (max-width: 768px) {
    footer {
        display: none;
    }

    /* .map-search-box {
        position: absolute;
        top: 2%;
        left: 50%;
        transform: translateX(-50%);
    } */
}

/* Legend (map explanation) – styled similar to the info window */
.map-legend {
    position: absolute;
    right: 12px;
    bottom: 80px;
    background: #fff;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    min-width: 260px;
    max-width: 340px;
    z-index: 1000;
    display: none;
}

.map-legend__inner {
    padding: 10px;
}

.map-legend__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.map-legend__close {
    border: none;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #666;
}

.map-legend__close:hover { color: #333; }

.map-legend__row {
    display: grid;
    grid-template-columns: 24px 1fr;
    column-gap: 8px;
    row-gap: 2px;
    align-items: center;
    margin: 8px 0;
}

.map-legend__swatch {
    width: 18px;
    height: 18px;
}

.map-legend__title {
    font-size: 0.95em;
    font-weight: 600;
    line-height: 1.2;
    color: #333;
}

.map-legend__detail {
    grid-column: 2;
    font-size: 0.85em;
    color: #666;
}

@media (max-width: 992px) {

    .map-controls {
        right: 2%; 
    }

    /* Show the button */
    #toggleToList {
        display: inline-block;
        white-space: nowrap; /* Keep text on one line */
        flex-shrink: 0;
    }

    /* Search box takes remaining space */
    .map-search-box {
        flex: 1;
        width: auto;
        min-width: 0;
    }

    .map-search-box .form-control {
        min-width: 0; /* Prevent input from overflowing */

    }


}