/* Area view toggle */
.area-view-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin: 1.5rem 0 2rem 0;
}

.area-view-toggle {
  display: flex;
  background: linear-gradient(to bottom, #faf5e8 0%, #f3ead8 100%);
  border: 2px solid #8b7355;
  border-radius: 6px;
  overflow: hidden;
}

.area-view-toggle-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  color: #4a3827;
  font-family: "IM Fell English", Georgia, serif;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-right: 1px solid #8b7355;
}

.area-view-toggle-btn:last-child {
  border-right: none;
}

.area-view-toggle-btn:hover {
  background: rgba(139, 115, 85, 0.1);
}

.area-view-toggle-btn.active {
  background: rgba(139, 0, 0, 0.15);
  color: #8b0000;
  font-weight: bold;
}

.map-container {
  margin-top: 2rem;
  position: relative;
  width: 100%;
  overflow: auto;
  border: 3px solid #8b7355;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  background: #2a1f15;
  max-height: 80vh;
}

.map-image {
  display: block;
  width: 100%;
  height: auto;
}

.map-pins-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-pin {
  position: absolute;
  width: 32px;
  height: 32px;
  transform: translate(-50%, -50%);
  cursor: pointer;
  pointer-events: all;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.map-pin:hover,
.map-pin.highlight {
  transform: translate(-50%, -50%) scale(1.2);
  filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.8));
}

.map-pin img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Sidebar place list */
.place-list-item {
  margin-bottom: 0.3rem;
}

.place-list-link {
  display: block;
  padding: 0.6rem 0.8rem;
  color: #d4c4a8;
  text-decoration: none;
  background: rgba(139, 115, 85, 0.08);
  border: 1px solid rgba(139, 115, 85, 0.25);
  border-radius: 4px;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.place-list-link:hover {
  background: rgba(139, 115, 85, 0.15);
  border-color: #8b7355;
  transform: translateX(4px);
}

.place-list-link.active {
  background: rgba(30, 58, 95, 0.2);
  border-color: #2e50e0;
  color: #f9f4e8;
}

/* Modal */
.place-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.place-modal.visible {
  display: flex;
}

.place-modal-content {
  background: linear-gradient(to bottom, #f9f4e8 0%, #f5ede0 50%, #f0e6d8 100%);
  border: 3px solid #8b7355;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.place-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  background: rgba(139, 0, 0, 0.8);
  border: 2px solid #8b0000;
  border-radius: 50%;
  color: #f9f4e8;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.place-modal-close:hover {
  background: rgba(139, 0, 0, 1);
  transform: scale(1.1);
}

.place-link-icon {
  position: absolute;
  top: 1rem;
  right: 3.5rem;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid #8b7355;
  border-radius: 4px;
  padding: 0.25rem;
  background: linear-gradient(to bottom, #faf5e8 0%, #f3ead8 100%);
  object-fit: contain;
  z-index: 10;
}

.place-link-icon:hover {
  transform: scale(1.1);
  border-color: #d4af37;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.6);
}

.place-modal-body {
  padding: 2.5rem 2rem 2rem 2rem;
}

.place-modal-image {
  width: 100%;
  height: auto;
  object-fit: contain;
  border: 2px solid #8b7355;
  border-radius: 4px;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #e8dcc8 0%, #d4c4a8 100%);
}

.place-modal-name {
  font-family: "IM Fell English SC", "IM Fell English", Georgia, serif;
  font-size: 1.8rem;
  color: #3a1e0e;
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #8b7355;
  letter-spacing: 0.05em;
}

.place-modal-affiliation {
  font-size: 1rem;
  color: #5d4a33;
  margin-bottom: 1rem;
  font-style: italic;
}

.place-modal-affiliation-label {
  font-weight: bold;
  color: #3a1e0e;
}

.place-modal-description {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #d4c4a8;
  font-size: 1rem;
  line-height: 1.7;
  color: #4a3827;
  white-space: pre-line;
  text-align: justify;
  hyphens: auto;
}

.place-modal-description-label {
  font-weight: bold;
  color: #3a1e0e;
  margin-bottom: 0.5rem;
}

/* Pin tooltip */
.pin-tooltip {
  position: fixed;
  background: linear-gradient(to bottom, #f9f4e8 0%, #f0e6d8 100%);
  border: 2px solid #8b7355;
  border-radius: 4px;
  padding: 0.8rem 1rem;
  pointer-events: none;
  z-index: 1500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: none;
  max-width: 250px;
}

.pin-tooltip.visible {
  display: block;
}

/* Link tooltip - higher z-index than modal */
.link-tooltip {
  position: fixed;
  background: linear-gradient(to bottom, #f9f4e8 0%, #f0e6d8 100%);
  border: 2px solid #8b7355;
  border-radius: 4px;
  padding: 0.6rem 0.9rem;
  pointer-events: none;
  z-index: 2500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: none;
  font-size: 0.9rem;
  color: #3a1e0e;
  font-weight: bold;
  white-space: nowrap;
}

.link-tooltip.visible {
  display: block;
}

.pin-tooltip-name {
  font-size: 1rem;
  color: #3a1e0e;
  font-weight: bold;
  margin-bottom: 0.3rem;
}

.pin-tooltip-affiliation {
  font-size: 0.85rem;
  color: #5d4a33;
  font-style: italic;
}

/* No map message */
.no-map-message {
  text-align: center;
  padding: 4rem 2rem;
  font-style: italic;
  color: #8b7355;
  font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 768px) {
  .place-modal {
    padding: 1rem;
  }

  .place-modal-body {
    padding: 2rem 1.5rem 1.5rem 1.5rem;
  }

  .place-modal-name {
    font-size: 1.5rem;
  }

  .area-view-header {
    flex-direction: column;
    gap: 1rem;
  }
}