/* ============================================================================
   SHARED POI POPUP STYLES
   ============================================================================ */

:root {
  --popup-bg: #ffffff;
  --popup-text: #0f172a;
  --popup-primary: #295e9b;
  --popup-secondary: #3f6ea7;
  --popup-border: #e3e8ef;
}

/* ============================================================================
   SHARED POI DETAIL POPUP (Bottom third of screen)
   ============================================================================ */

.shared-poi-popup {
  position: fixed;
  top: calc(var(--header-height, 68px) + 20px);
  left: 20px;
  width: calc(100vw - 40px);
  max-height: calc(100vh - (var(--header-height, 68px) + 40px));
  background: var(--popup-bg);
  border: none;
  border-radius: 16px;
  z-index: var(--z-popup);
  padding: 0;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25), 0 8px 16px rgba(15, 23, 42, 0.15);
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-sizing: border-box;
  overflow: hidden;
}



.shared-poi-popup.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-20px);
}

.popup-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 50%;
  color: #1f2937;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.popup-close-btn:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.poi-popup-content {
  display: flex;
  height: 100%;
  max-height: 80vh;
  width: 100%;
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 16px;
}

.poi-popup-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-height: inherit;
  align-items: stretch;
  overflow: hidden;
}

.poi-popup-left {
  flex: 0 0 250px;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #000;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
}

.poi-popup-right {
  flex: 1;
  width: 100%;
  overflow: hidden;
  padding: 20px;
  color: var(--popup-text);
  box-sizing: border-box;
  background: var(--popup-bg);
  display: flex;
  flex-direction: column;
  position: relative; /* Anchor fixed actions */
}

.poi-popup-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.08);
  height: 100%;
}



.poi-popup-images,
.poi-popup-no-image {
  width: 100%;
  height: 100%;
  cursor: pointer;
  display: flex;
  flex: 1;
  align-items: stretch;
  justify-content: stretch;
  min-height: 0;
}

.poi-popup-images picture {
  width: 100%;
  height: 100%;
  display: block;
  flex: 1;
}

.poi-popup-images img {
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  border-radius: 16px 16px 0 0;
  display: block;
  object-position: center;
}

/* Error handling for broken images */
.poi-popup-images img::before {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  background: #f3f4f6;
}

.poi-popup-images img::after {
  content: 'Could not load image';
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #6b7280;
  font-size: 14px;
  font-style: italic;
}


.poi-popup-no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef2f7;
  border-right: 1px solid var(--popup-border);
  color: var(--popup-muted, #6b7280);
  font-style: italic;
  border-radius: 16px 16px 0 0;
}

.poi-popup-image-nav {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(0,0,0,0.5);
  padding: 5px 10px;
  border-radius: 20px;
  z-index: 5; /* Ensure nav buttons are above image */
}


.image-nav-btn {
  width: 35px;
  height: 35px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--popup-border);
  border-radius: 50%;
  color: var(--popup-text);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-nav-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

#imageCounter {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
}

.poi-popup-right h3 {
  margin: 0 0 10px 0;
  font-size: 20px;
  color: var(--popup-text);
  font-family: var(--font-family-base);
}

/* Attribute list styling so items stay inside the popup and wrap nicely */
.poi-attributes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 16px;
  margin-bottom: 8px;
}

.poi-attributes .attribute-item {
  display: flex;
  gap: 8px;
  align-items: center;
}

.poi-attributes .attr-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: #eaf1fb;
  color: #1d4a7a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(41, 94, 155, 0.18);
}

.poi-attributes .attr-icon svg {
  display: block;
  color: #1d4a7a;
}

.poi-attributes .attr-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.poi-attributes .attr-label {
  color: #4a5568;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.poi-attributes .attr-value {
  color: var(--popup-text);
  font-weight: 700;
  font-size: 15px;
}

.poi-info {
  color: #1f2937;
  line-height: 1.6;
  margin-bottom: 15px;
  font-size: 15px;
  flex: 1;
}

.poi-popup-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: absolute;
  top: 20px;
  right: 20px;
  align-items: flex-end;
  padding: 0;
  margin: 0;
  pointer-events: auto;
}

/* SHARED BUTTON STYLE */
.shared-btn {
  padding: 8px 14px;
  color: var(--popup-text);
  border: 1px solid var(--popup-border);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}
.shared-btn.primary {
  background-color: var(--popup-primary);
  border-color: var(--popup-primary);
}
.shared-btn.secondary {
  background-color: var(--popup-secondary);
  border-color: var(--popup-secondary);
}
.shared-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}


/* ============================================================================
   SHARED FULL DETAILS WINDOW
   ============================================================================ */

.shared-full-details {
  position: fixed;
  top: calc(68px + 20px); /* 68px header + 20px margin */
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: var(--popup-bg);
  border: 2px solid var(--popup-primary);
  border-radius: 12px;
  z-index: var(--z-popup);
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s ease;
}

.shared-full-details.hidden {
  opacity: 0;
  pointer-events: none;
}

.full-details-header {
  flex-shrink: 0;
  padding: 20px;
  border-bottom: 1px solid var(--popup-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.full-details-header h2 {
  margin: 0;
  color: var(--popup-text);
  font-size: 28px;
}

.full-details-content {
  flex: 1;
  display: flex;
  min-height: 0; /* Important for flex children with overflow */
}

.full-details-layout {
  display: flex;
  width: 100%;
  height: 100%;
}

.full-details-left {
  flex: 0 0 40%;
  height: 100%;
  overflow-y: auto; /* Scroll if many images */
  border-right: 1px solid var(--popup-border);
  padding: 15px; /* Padding for the gallery */
  display: flex;
  flex-direction: column;
  gap: 15px; /* Spacing between image items */
  align-items: center; /* Center images if they don't fill width */
}

.full-details-right {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 20px;
  overflow-y: auto; /* Scroll if content overflows */
  color: var(--popup-text); /* Ensure text is visible */
}

.full-details-images {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%; /* Ensure the container takes full width */
}

.full-details-image-item {
  width: 100%;
  border: 1px solid var(--popup-border);
  border-radius: 8px;
  overflow: hidden; /* Ensure image doesn't break border-radius */
  cursor: zoom-in; /* Indicate clickable for lightbox */
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.full-details-image-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.full-details-image-item picture,
.full-details-image-item img {
  width: 100%;
  height: auto; /* Allow image to scale proportionally */
  display: block; /* Remove extra space below image */
}

.image-caption {
  padding: 8px 12px;
  background-color: rgba(0,0,0,0.3);
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  text-align: center;
}

/* ============================================================================
   LIGHTBOX OVERLAY
   ============================================================================ */

.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  z-index: var(--z-lightbox);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.lightbox-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.lightbox-close-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 50%;
  font-size: 28px;
  font-weight: 300;
  color: var(--color-ink, #0f172a);
  cursor: pointer;
  z-index: calc(var(--z-lightbox) + 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.lightbox-close-btn:hover {
  background: #fff;
  transform: scale(1.1);
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
  cursor: grab;
}

.lightbox-content.dragging {
  cursor: grabbing;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  display: block;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s ease;
  transform-origin: center;
}

/* ============================================================================
   RESPONSIVE: MOBILE LAYOUT
   ============================================================================ */
