#upIconTray {
  displayX: none !important;
}
#showSideFromHeader {
  display: none !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}
/* messes with Drupal
.container {
    max-width: 1200px;
    margin: 0 auto;
}
*/
.widgetHeader {
    margin-bottom: 24px;
}

.widgetHeader h1 {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 8px;
}
.widgetHeader .info {
    color: #666;
    font-size: 0.9rem;
}
#widgetDetailsControls {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    overflow: visible;
}
.dark #widgetDetailsControls {
    background: #333;
}
.search-container {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    overflow: visible;
    position: relative;
}

.map-selector {
    min-width: 200px;
}

.map-select {
    width: 100%;
}

.search-wrapper {
    flex: 1;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.search-box {
    position: relative;
    flex: 1;
}

.search-input {
    width: 100% !important; /* override drupal */
    min-height: 34px;
    padding-left: 35px !important; /* For search icon on left */
    font-size: 16px;
    padding-right: 12px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.dark .search-input {
    background-color: #888;
    color: #fff;
}
.dark .search-input::placeholder {
  color: #ccc;
}

.search-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 18px;
    transform: translateY(-50%);
    color: #999;
    width: 20px;
    height: 20px;
}

.search-fields-control {
    position: relative;
    min-width: 150px;
    overflow: visible;
    z-index: 1001;
}

.search-fields-btn {
    min-height: 34px;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-fields-btn:hover {
    border-color: #007bff;
    background: #f8f9fa;
}

.search-fields-btn.active {
    border-color: #007bff;
    background: #f0f8ff;
}

/* Responsive filters button - show icon only when parent container < 800px */
.search-container {
    container-type: inline-size;
}

@container (max-width: 799px) {
    .search-fields-control {
        min-width: auto;
        width: 48px;
    }
    
    .search-fields-btn {
        /* padding: 12px; */
        height: 34px;
        width: 34px;
        min-width: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .search-fields-btn .button-text {
        display: none;
    }
    
    .search-fields-btn .filter-icon {
        display: block;
        margin: 0; /* Reset any margin when narrow */
    }
}

@container (min-width: 800px) {
    .search-fields-btn {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 16px;
    }
    
    .search-fields-btn .button-text {
        display: block;
    }
    
    .search-fields-btn .filter-icon {
        display: block;
        flex-shrink: 0;
    }
}

.search-popup {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 280px;
    max-width: 400px;
}

.search-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e5e5e5;
}

.search-popup-title {
    font-weight: 600;
    color: #1a1a1a;
}

.search-popup-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-popup-close:hover {
    color: #333;
}

.search-popup-actions {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e5e5;
}

.popup-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.popup-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.search-fields-popup {
    position: absolute;
    top: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    max-width: 400px;
    width: max-content;
}

.dark .search-fields-popup {
    background: #333;
    border-color: #555;
}

.search-fields-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    font-weight: 500;
}

.dark .search-fields-header {
    border-bottom-color: #555;
}

.select-all-btn {
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.select-all-btn:hover {
    background: #0056b3;
    color: #fff;
}

.search-fields-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px 0;
}

.search-field-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-field-item:hover {
    background: #f8f9fa;
    color: #333;
}

.search-field-checkbox {
    margin: 0;
}

.search-field-label {
    flex: 1;
    cursor: pointer;
    font-size: 0.9rem;
}

.search-results {
    font-size: 0.9rem;
    color: #666;
}

.expand-list-btn {
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.9rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.expand-list-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.expand-list-btn:active {
    background: #e2e8f0;
}
.dark .expand-list-btn {
    color: #ddd;
}

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    position: relative;
}

.add-visit-btn {
    margin-left: 16px;
    padding: 10px 20px;
    background: #007bff;
    color: white !important;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.add-visit-btn:hover {
    background: #0056b3;
}

.pagination-info {
    font-size: 0.9rem;
    color: #666;
    margin: 0 16px;
}

.pagination-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #007bff;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

#widgetDetailsBottom {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    background: white;
    padding: 15px;
    border-top: 1px solid #e5e5e5;
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
    z-index: 10;
}

.dark #widgetDetailsBottom {
    background: #333;
    border-top-color: #555;
}

.page-numbers {
    display: flex;
    gap: 4px;
}

.loading {
    text-align: center;
    padding: 48px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.error {
    text-align: center;
    padding: 24px;
}

.error-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 16px;
    border-radius: 8px;
    display: inline-block;
}

.error-title {
    font-weight: bold;
    margin-bottom: 4px;
}


.block-system-breadcrumb-block {
    display: none !important; /* hides "Home" link in Drupal when embedding */
}
.component--main_content h1 {
    display: none !important; /* hides title above CR logo */
}

.listings-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
}

.listings-scroll-container {
    position: relative;
    background: #fff;
    overflow-y: auto;
    max-height: calc(100vh - 100px);
    flex: 1 1 auto;
    min-height: 0;
    /* min-height: 300px; Caused too much space above .no-results-content */
    margin-top: -20px; /* Places under control fade out */
    padding-top: 15px;
}
.dark .listings-scroll-container {
    background: #333;
}

.listing-card {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e5e5;
    padding: 24px;
    transition: box-shadow 0.2s, transform 0.2s;
}

.listing-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.dark .listing-card {
    background: #1e293b;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.dark .listing-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
}

.listing-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}

.listing-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.listing-title {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

.dark .listing-content,
.dark .listing-title,
.dark .listing-name {
    color: #e2e8f0;
}

.listing-category {
    display: inline-block;
    padding: 4px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1d4ed8;
    background: #dbeafe;
    border-radius: 16px;
    width: fit-content;
}

.listing-description {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
}

.listing-secondary {
    color: #666;
    font-size: 0.9rem;
    margin-top: 4px;
    line-height: 1.4;
}

.listing-tertiary {
    color: #666;
    font-size: 0.9rem;
    margin-top: 2px;
    line-height: 1.4;
}

.address-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.address-main {
    color: #4a4a4a;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.address-details {
    color: #666;
    font-size: 0.9rem;
}

.contact-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contact-item {
    color: #4a4a4a;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.contact-item a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.contact-item a:hover {
    color: #007bff;
}

.population-item {
    color: #4a4a4a;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.additional-details {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e5e5;
}

.details-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    background: none;
    border: none;
    padding: 0;
    padding-top: 6px;
    width: 100%;
    justify-content: flex-start;
}

.details-toggle:hover {
    color: #007bff;
}
.dark .details-toggle:hover {
    color: #ddd;
}
.toggle-arrow {
    transition: transform 0.2s;
    font-size: 0.7rem;
}

.details-content {
    margin-top: 8px;
    display: none;
    font-size: 11px;
    line-height: 1.6;
}

.details-content.expanded {
    display: block;
}

.details-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-row,
.detail-item {
    display: flex;
    font-size: 11px;
    gap: 8px;
    line-height: 1.6;
    margin-bottom: 4px;
}

.detail-item.stacked {
    flex-direction: column;
    gap: 2px;
}

.detail-key,
.detail-label {
    font-weight: 500;
    min-width: 100px;
    flex-shrink: 0;
}

.detail-label {
    font-weight: bold;
}

.detail-value {
    word-break: break-word;
    flex: 1;
}

.no-results {
    text-align: center;
    padding: 48px;
}

.no-results-text {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.clear-search {
    color: #007bff;
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.clear-search:hover {
    color: #0056b3;
}

.empty-state {
    text-align: center;
    padding: 48px;
}

.empty-text {
    color: #666;
    font-size: 1.1rem;
}

.break-all {
    word-break: break-all;
}

/* Widget Top Layout */
#widgetTop {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#widgetTop .search-results {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

#widgetTop .pagination-container {
    margin: 0;
}

/* Page Layout Styles */
#widgetContent {
    display: flex;
    flex-direction: row;
    min-heightX: calc(100vh - 200px); /* Account for header space */
    min-height: 400px;
    gap: 16px;
    margin-bottom: 20px;
    overflow: visible;
}

#pageGallery {
    background: white;
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
    position: relative;
    line-height: 0px;
}

.gallery-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 8px;
}

#widgetDetailsParent {
    min-heightX: 400px;
    heightX:100%;
    margin-bottom: 15px;
    overflow: visible;
}
#widgetDetails {
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}
#pageMap {
    border-radius: 8px;
}

#pageMap #widgetmap {
    margin-bottom: 0;
    height: 100%;
}

/* Mobile Layout: ≤768px - Stack vertically with right-column as bottom 1/3 */
@media (max-width: 768px) {
    #widgetContent {
        flex-direction: column;
        height: auto;
        min-height: 0;
    }

    .right-column {
        display: flex;
        flex-direction: column;
        gap: 16px;
        height: auto;
    }

    /* Hide all fullscreen toggle buttons on narrow screens */
    .fullscreen-toggle-btn {
        display: none !important;
    }

    #pageGallery {
        order: 1;
        height: 30vh;
        overflow-y: auto;
    }

    #widgetDetailsParent {
        order: 1; /* Shows first on mobile */
    }

    #pageMap {
        order: 2;
    }
}

/* Desktop Layout: >768px - Side by side with Details left, Gallery+Map right */
@media (min-width: 769px) {
    #widgetContent {
        flex-direction: row;
        heightX: calc(100vh - 200px); /* Full height minus header */
        gap: 20px;
    }

    #widgetDetailsParent {
        flex: 0 0 55%;
        order: 1;
    }

    .right-column {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 16px;
        order: 2;
    }

    #pageGalleryParent {
        height: 50%;
        overflow-y: auto;
    }

    #pageMap {
        heightX: 100%; /* Or 50% */
        display: flex;
        flex-direction: column;
    }

    #pageMap #widgetmap {
        flex: 1;
    }
}

/* Map wrapper in hero mode */
#widgetHero #widgetmapWrapper {
    width: 100% !important;
    height: 100vh !important;
}

#widgetHero #widgetmap {
    width: 100% !important;
    height: 100% !important;
}
/*
#detailHero #detailmapWrapper {
    width: 100% !important;
    height: 100vh !important;
}
*/
#detailHero #detailmap {
    width: 100% !important;
    height: 100% !important;
}
.leaflet-container {
    background: #f5f5f5 !important; /* Provide visible background for map tiles */
    /* outline-offset: 0px !important; Not sure if we'll need this */
}
.leaflet-container a.leaflet-popup-close-button {
    font: 18px / 24px Tahoma, Verdana, sans-serif !important; /* For map popup close-X */
}
.leaflet-left .leaflet-control {
    margin-left: 0px;
}
.leaflet-touch .leaflet-bar {
    border: none;
}
/* Override legacy explore styles that hide/flatten Leaflet controls. */
#widgetmap .leaflet-top,
#widgetmap .leaflet-bottom {
    z-index: 1000 !important;
}
#widgetmap .leaflet-bottom.leaflet-left {
    display: flex !important;
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
}
#widgetmap .leaflet-bottom.leaflet-right {
    display: block !important;
}
/* Hide Leaflet attribution/credits on widget map to match display/team behavior. */
#widgetmap .leaflet-control-attribution {
    display: none !important;
}

/* From location.css */
.locationDetails {
  margin-top: 16px;
  margin-bottom: 32px;
  padding: 24px;
  background: #f8fafc;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  font-size: 14px;
}

.location-header {
  position: relative;
  margin-bottom: 16px;
}

#detailHero {
  display: none;
  width: 100%;
  min-height: 320px;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  box-sizing: border-box;
}

#detailHero .detailmap-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
}

#detailHero .detailmap-wrap {
  height: 100%;
}

#detailHero #detailmap {
  height: 100%;
}

#detailHero .detail-map-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
}

#detailHero .location-details {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  width: 100%;
}

.location-header h2 {
  margin: 0 0 6px;
  font-size: 1.4em;
  color: #0f172a;
  width: 100%;
}

#detailArrows {
  position: absolute;
  right: 40px;
  top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.location-close-btn {
  border: none;
  background: transparent;
  color: #b7b7b7;
  padding: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 0;
  top: 0;
}

.location-close-btn .material-icons {
  font-size: 28px;
  line-height: 1;
}

.location-close-btn:hover {
  color: #0f172a;
}

.tour-back-arrow {
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px 0 0 0;
  overflow: hidden;
  width: 18px;
}

.tour-back-arrow .material-icons {
  color: #cbd5e1;
  font-size: 32px;
  line-height: 1;
  margin-right: -10px;
}

.tour-back-arrow:hover .material-icons {
  color: #64748b;
}

.tour-forward-arrow {
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px 0 0 0;
  overflow: hidden;
  width: 18px;
}

.tour-forward-arrow .material-icons {
  color: #cbd5e1;
  font-size: 32px;
  line-height: 1;
  margin-left: -10px;
}

.tour-forward-arrow:hover .material-icons {
  color: #64748b;
}

.location-header p {
  margin: 0;
  color: #475569;
}

.location-content {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.locationDetails.detailmap-expanded .location-content {
  flex-direction: column;
}

.locationDetails.detailmap-expanded .location-map {
  width: 100%;
  display: none;
}

.locationDetails.detailmap-expanded .location-details {
  width: 100%;
}

.location-details {
  flex: 1;
  min-width: 0;
}

.location-map {
  width: 323px;
  flex-shrink: 0;
}

#detailmap {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 387px;
  min-height: 323px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  background: #e2e8f0;
}

.detailmap-wrap {
  overflow: hidden;
}

.detailmap-placeholder {
  width: 100%;
}

.detailmap-wrapper {
  width: 100%;
  position: relative;
}

#detailmap .leaflet-bottom.leaflet-left {
  gap: 6px;
  padding-left: 10px;
}


.mapPopButton {
  padding: 4px;
  min-height: 22px;
  font-size: 12px;
  border-radius: 4px;
  background: #555 !important;
}
#widgetmap .mapPopButton {
  min-height: 26px;
}
#widgetmap .map-style-selector .map-style-select.mapPopButton {
  height: 26px !important;
  min-height: 26px !important;
  padding: 2px 8px 2px 6px !important;
  font-size: 12px !important;
  line-height: 1.1 !important;
  border-radius: 4px !important;
}
#detailmap .map-style-selector {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  order: 1;
}

#detailmap .detail-map-zoom-display {
  order: 2;
}

#detailmap .map-style-selector .map-style-select {
  display: none;
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 2;
  min-width: 140px;
}

#detailmap .map-style-selector.is-open .map-style-select {
  display: inline-flex;
}

#detailmap .map-style-selector .map-style-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#detailmap .map-style-selector .map-style-icon .material-icons {
  font-size: 16px;
  line-height: 1;
}

#detailmap .map-style-selector .map-style-select {
  min-height: 22px;
  font-size: 12px;
  padding: 2px 8px 2px 6px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: none;
  color: transparent;
  text-shadow: 0 0 0 transparent;
}

#detailmap .map-style-selector.is-open .map-style-select {
  display: inline-flex;
  color: inherit;
  text-shadow: none;
}

#detailmap .detail-map-zoom-display .zoom-display-current {
  width: 34px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}

#detailmap .detail-map-zoom-display .zoom-display-levels {
  width: 50px;
  max-height: 160px;
  font-size: 10px;
  opacity: 0;
  visibility: hidden;
}

#detailmap .detail-map-zoom-display:hover .zoom-display-levels {
  opacity: 0;
  visibility: hidden;
}

#detailmap .detail-map-zoom-display.is-open .zoom-display-levels {
  opacity: 1;
  visibility: visible;
}

#detailmap .detail-map-zoom-display .zoom-level-item {
  width: 50px;
  padding: 4px 6px;
  font-size: 10px;
}

#detailmap .leaflet-control-zoom a {
  width: 24px;
  height: 24px;
  line-height: 24px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  margin-top: 6px;
}

.detail-map-expand-toggle {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

#detailmap .marker-pin,
#detailmap .marker-dot-tiny {
  background: #f7923c;
}

.detail-map-caption {
  margin-top: 8px;
  font-size: 0.75em;
  color: #64748b;
}

.detail-map-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #64748b;
  font-size: 0.85em;
}

.location-title {
  font-size: 1.2em;
  color: #0f172a;
  margin-bottom: 6px;
  font-weight: 600;
}

.location-contact {
  margin-bottom: 10px;
}

.location-email {
  color: #475569;
  font-size: 0.92em;
}

.location-address {
  color: #1f2937;
  font-size: 0.95em;
  font-weight: 500;
}

.location-citystate {
  color: #475569;
  font-size: 0.9em;
  margin-bottom: 10px;
}

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

.location-summary {
  margin-top: 10px;
}

.location-meta {
  margin-top: 12px;
  display: grid;
  gap: 1px;
  display: none;
}

.location-meta.expanded {
  display: grid;
}

.location-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  font-size: 0.85em;
  color: #334155;
}

.location-row.no-label {
  grid-template-columns: 1fr;
}

.location-label {
  font-weight: 600;
  color: #475569;
}

.location-value {
  color: #1f2937;
}

.location-empty {
  padding: 12px 0;
  color: #64748b;
}

.location-empty-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.location-empty-subtitle {
  font-size: 0.9em;
}

.location-btn {
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.75px;
  cursor: pointer;
}

.location-more-toggle {
  background: #e2e8f0;
  color: #334155;
}

.location-more-toggle:hover {
  background: #cbd5f5;
}

.location-more-toggle.active {
  background: #3b82f6;
  color: white;
  font-weight: 500;
}

.meta-less-btn {
  background: #94a3b8 !important;
  color: white !important;
}

.details-more-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.details-more-actions a {
  padding: 6px 12px;
  background: #e2e8f0;
  color: #334155;
  border-radius: 4px;
  text-decoration: none;
  font-size: 12.75px;
  display: inline-block;
  transition: background 0.2s;
}

.details-more-actions a:hover {
  background: #cbd5f5;
}

.locationDetails .details-more-actions {
  margin-bottom: 10px;
}

.listing-actions {
  margin-top: 10px;
}

.view-details-btn {
  background: #6AA442;
  color: #fff;
  font-weight: 600;
}

.view-details-btn:hover {
  background: #5a8f38;
}

.dark .locationDetails {
  background: #1e293b;
  border: none;
}

.dark .location-header h2,
.dark .location-title {
  color: #e2e8f0;
}

.dark .location-header p,
.dark .location-email,
.dark .location-citystate,
.dark .detail-map-caption,
.dark .location-empty,
.dark .detail-map-empty {
  color: #94a3b8;
}

.dark .location-close-btn {
  color: #7b8794;
}

.dark .location-close-btn:hover {
  color: #e2e8f0;
}

.dark .location-address,
.dark .location-value {
  color: #e2e8f0;
}

.dark .location-row {
  color: #cbd5f5;
}

.dark .location-label {
  color: #94a3b8;
}

.dark #detailmap {
  border-color: #1e293b;
  background: #0b1220;
}

.dark .location-more-toggle {
  background: #1e293b;
  color: #e2e8f0;
}

.dark .location-more-toggle:hover {
  background: #2a3750;
}

.dark .location-more-toggle.active {
  background: #3b82f6;
  color: white;
  font-weight: 500;
}

.dark .meta-less-btn {
  background: #64748b !important;
  color: white !important;
}

.dark .details-more-actions a {
  background: #1e293b;
  color: #e2e8f0;
}

.dark .details-more-actions a:hover {
  background: #2a3750;
}

.description-images-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
  /* container-type: inline-size; */
}

.image-stack {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  overflow: hidden;
}

.image-stack[data-count="1"] {
  grid-template-columns: 1fr;
}

.image-stack[data-count="1"] .description-image {
  max-width: 320px;
}

.image-stack[data-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.image-stack.slide-left {
  animation: location-slide-left 220ms ease;
}

.image-stack.slide-right {
  animation: location-slide-right 220ms ease;
}

@keyframes location-slide-left {
  from {
    transform: translateX(18px);
    opacity: 0.7;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes location-slide-right {
  from {
    transform: translateX(-18px);
    opacity: 0.7;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@media (max-width: 700px) {
  .description-images-nav:not(.three-col-prefer) .image-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .description-images-nav.three-col-prefer .image-stack {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  .description-images-nav.three-col-prefer .image-stack {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .image-stack {
    grid-template-columns: 1fr;
  }

  .image-item {
    display: none;
  }

  .image-item:first-child {
    display: flex;
  }

  .description-image {
    aspect-ratio: 3 / 2;
    object-fit: cover;
  }
}

@container (max-width: 700px) {
  .description-images-nav:not(.three-col-prefer) .image-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .description-images-nav.three-col-prefer .image-stack {
    grid-template-columns: 1fr;
  }
}

@container (max-width: 800px) {
  .description-images-nav.three-col-prefer .image-stack {
    grid-template-columns: 1fr;
  }
}

@container (max-width: 420px) {
  .image-stack {
    grid-template-columns: 1fr;
  }

  .image-item {
    display: none;
  }

  .image-item:first-child {
    display: flex;
  }

  .description-image {
    aspect-ratio: 3 / 2;
    object-fit: cover;
  }
}

.image-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.description-image {
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
}

/* Cropped image view - taller ratio for even display */
.locationDetails.images-cropped .description-image {
  aspect-ratio: 4 / 3 !important;
  object-fit: cover !important;
  height: auto !important;
}

.image-crop-toggle {
  flex-shrink: 0;
  white-space: nowrap;
}
}

.image-source {
  font-size: 0.75em;
  color: #64748b;
  font-family: monospace;
  word-break: break-all;
  line-height: 1.3;
}

.image-nav-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}

.image-nav-btn {
  background: transparent;
  color: #64748b;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
}

.image-nav-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #475569;
}

.image-nav-btn:active {
  background: #e2e8f0;
}

.image-counter {
  font-size: 0.75em;
  color: #64748b;
  min-width: 40px;
  text-align: center;
}

.view-gallery-btn {
  background: transparent;
  color: #64748b;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
  margin-left: 4px;
}

.view-gallery-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #475569;
}

.image-gallery {
  margin-top: 20px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  container-type: inline-size;
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.gallery-header h5 {
  margin: 0;
  font-size: 1.1em;
  color: #1e293b;
}

.circular-close-btn {
  background: transparent;
  color: #cbd5e1;
  border: none;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
}

.circular-close-btn .material-icons {
  font-size: 30px;
}

.circular-close-btn:hover {
  color: #94a3b8;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

@container (min-width: 800px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@container (min-width: 800px) and (max-width: 1100px) {
  .image-gallery.three-col-prefer .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@container (min-width: 1000px) {
  .gallery-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@container (min-width: 1200px) {
  .gallery-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@container (max-width: 500px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@container (min-width: 0px) {
  .image-gallery.three-col-prefer .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@container (max-width: 700px) {
  .image-gallery.three-col-prefer .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@container (max-width: 420px) {
  .image-gallery.three-col-prefer .gallery-grid {
    grid-template-columns: repeat(1, 1fr);
  }

  .image-gallery.three-col-prefer .gallery-image {
    height: auto;
    aspect-ratio: 3 / 2;
  }
}

@container (min-width: 1100px) {
  .image-gallery.three-col-prefer .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@container (max-width: 420px) {
  .gallery-grid,
  .image-gallery.three-col-prefer .gallery-grid {
    grid-template-columns: repeat(1, 1fr);
  }

  .gallery-item {
    display: none;
  }

  .gallery-item:first-child {
    display: flex;
  }

  .gallery-image {
    height: auto;
    aspect-ratio: 3 / 2;
  }
}

@supports not (container-type: inline-size) {
  @media (min-width: 800px) {
    .gallery-grid {
      grid-template-columns: repeat(4, 1fr);
    }
  }

  @media (min-width: 800px) and (max-width: 1100px) {
    .image-gallery.three-col-prefer .gallery-grid {
      grid-template-columns: repeat(3, 1fr);
    }
  }

  @media (min-width: 1000px) {
    .gallery-grid {
      grid-template-columns: repeat(5, 1fr);
    }
  }

  @media (min-width: 1200px) {
    .gallery-grid {
      grid-template-columns: repeat(6, 1fr);
    }
  }

  @media (max-width: 500px) {
    .gallery-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  @media (max-width: 420px) {
    .gallery-grid {
      grid-template-columns: repeat(1, 1fr);
    }

    .gallery-item {
      display: none;
    }

    .gallery-item:first-child {
      display: flex;
    }

    .gallery-image {
      height: auto;
      aspect-ratio: 3 / 2;
    }
  }

  .image-gallery.three-col-prefer .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  @media (max-width: 700px) {
    .image-gallery.three-col-prefer .gallery-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  @media (max-width: 420px) {
    .image-gallery.three-col-prefer .gallery-grid {
      grid-template-columns: repeat(1, 1fr);
    }

    .image-gallery.three-col-prefer .gallery-image {
      height: auto;
      aspect-ratio: 3 / 2;
    }
  }

  @media (min-width: 1100px) {
    .image-gallery.three-col-prefer .gallery-grid {
      grid-template-columns: repeat(4, 1fr);
    }
  }
}

.gallery-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #fff;
  border-radius: 6px;
  padding: 8px;
  border: 1px solid #e2e8f0;
}

.gallery-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
}

.gallery-image-source {
  font-size: 0.7em;
  color: #64748b;
  font-family: monospace;
  word-break: break-all;
  line-height: 1.2;
}

.image-gallery.is-narrow .gallery-grid {
  grid-template-columns: repeat(1, 1fr);
}

.image-gallery.is-narrow .gallery-item {
  display: none;
}

.image-gallery.is-narrow .gallery-item:first-child {
  display: flex;
}

.image-gallery.is-narrow .gallery-image {
  height: auto;
  aspect-ratio: 3 / 2;
}

.product-image-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.product-image-modal.active {
  display: flex;
}

.product-image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(2px);
}

.product-image-modal-content {
  position: relative;
  z-index: 1;
  max-width: min(920px, 92vw);
  max-height: 94vh;
  min-width: 320px;
  min-height: 320px;
  background: #fff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding-bottom: 54px;
  overflow: hidden;
}

.product-image-modal.nav-hidden .product-image-modal-content {
  padding-bottom: 18px;
}

.product-image-modal-img {
  max-width: 100%;
  max-height: calc(88vh - 180px);
  object-fit: contain;
  border-radius: 12px;
}

.product-image-modal-caption {
  margin-top: 6px;
  margin-bottom: 8px;
  font-size: 14px;
  color: #1f2937;
  text-align: center;
  max-width: 100%;
}

.product-image-modal-caption-text {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-image-modal-caption-toggle {
  margin-top: 4px;
  border: none;
  background: none;
  color: #2563eb;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.product-image-modal-caption.expanded .product-image-modal-caption-text {
  white-space: normal;
}

.product-image-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.product-image-modal-close .material-icons {
  font-size: 20px;
}

.product-image-modal-close:hover {
  background: rgba(15, 23, 42, 0.9);
}

.product-image-modal-nav {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
}

.product-image-modal-prev,
.product-image-modal-next {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.product-image-modal-prev:hover,
.product-image-modal-next:hover {
  background: rgba(255, 255, 255, 0.2);
}

.product-image-modal-counter {
  font-size: 0.85em;
  letter-spacing: 0.3px;
  min-width: 48px;
  text-align: center;
}

.product-image-modal.nav-below .product-image-modal-nav {
  position: static;
  transform: none;
  margin-top: 6px;
}

@media (max-width: 600px) {
  .locationDetails {
    padding: 16px;
  }

  .description-images-nav {
    max-width: 100%;
  }

  .location-content {
    flex-direction: column;
  }

  .location-map {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .product-image-modal-content {
    min-width: auto;
    min-height: auto;
    max-width: 94vw;
  }

  .product-image-modal-img {
    max-height: calc(88vh - 200px);
  }
}

@media (max-height: 500px) {
  .product-image-modal-content {
    min-height: auto;
    padding-bottom: 18px;
  }
}
