@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&family=Outfit:wght@400;700&display=swap');

:root {
  --bg-color: #1a1917; /* Warm dark stone */
  --text-color: #e8e4db; /* Soft ivory */
  --wall-color: #b0a99f; /* Light stone */
  --arch-color: #555555;
  --pillar-color: #666666;
  --accent-color: #d38627; /* Amber/Candle light */
  --glass-bg: rgba(30, 30, 30, 0.85);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
  display: flex;
  overflow: hidden;
}

header {
  position: fixed;
  top: 2rem;
  left: 2.5rem;
  z-index: 10;
  text-align: left;
  pointer-events: none;
}

h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--wall-color);
  margin-bottom: 0.2rem;
  opacity: 0.9;
}

.subtitle {
  font-weight: 300;
  color: #a09a8e;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Info Button (Top Right) */
.info-btn {
  position: fixed;
  top: 2rem;
  right: 2.5rem;
  z-index: 150;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e8e4db;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.info-btn:hover {
  transform: scale(1.1);
  background: rgba(211, 134, 39, 0.2);
  border-color: var(--accent-color);
  color: #fff;
}

/* Info Modal Content */
.info-modal-content {
  max-width: 600px;
  height: auto;
  max-height: 85vh;
  padding: 2.5rem;
  border-radius: 20px;
}

.info-modal-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  color: var(--wall-color);
  margin-bottom: 0.8rem;
}

.info-modal-body {
  margin-top: 1.2rem;
  font-size: 1rem;
  line-height: 1.65;
  color: #c8c3b8;
}

.info-modal-body p {
  margin-bottom: 1.2rem;
}

.info-modal-body .placeholder-note {
  color: #a09a8e;
  font-size: 0.9rem;
}

.plan-container {
  background: var(--bg-color);
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.05) 0.5px, transparent 0.5px),
    radial-gradient(rgba(255, 255, 255, 0.05) 0.5px, var(--bg-color) 0.5px);
  background-size: 30px 30px;
  background-position:
    0 0,
    15px 15px;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

#church-plan-html {
  position: relative;
  width: 850px;
  height: 400px;
  background: transparent;
  transition: transform 0.3s ease;
  transform-origin: center;
}

.plan-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Label Positioning */
.label {
  position: absolute;
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  color: #a09a8e;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  pointer-events: none;
}
.lab-choir {
  top: 220px;
  left: 700px;
}
.lab-nave {
  top: 220px;
  left: 320px;
}
.lab-chapel {
  top: 80px;
  left: 375px;
}

/* User Location Marker "Tu Sei Qui" */
.user-location {
  position: absolute;
  top: 273px;
  left: 100px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.user-location .pin {
  width: 14px;
  height: 14px;
  background: #3498db;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(52, 152, 219, 0.8);
  position: relative;
  z-index: 2;
}

.user-location .pulse {
  position: absolute;
  top: 0;
  left: 10;
  width: 14px;
  height: 14px;
  background: rgba(52, 152, 219, 0.6);
  border-radius: 50%;
  animation: user-pulsate 2s infinite;
  z-index: 1;
}

.label-here {
  margin-top: 5px;
  font-family: 'Outfit', sans-serif;
  font-size: 6px;
  font-weight: 700;
  color: #fff;
  background: #3498db;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

@keyframes user-pulsate {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* POI Markers */
.poi-marker {
  position: absolute;
  width: 13px;
  height: 13px;
  margin-top: -9px;
  margin-left: -9px;
  background: var(--accent-color);
  border-radius: 50%;
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(211, 134, 39, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.8);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.poi-marker::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: var(--accent-color);
  border-radius: 50%;
  animation: pulsate 2s infinite;
  z-index: -1;
}

.poi-marker:hover {
  transform: scale(1.3);
}

.poi-marker.amber {
  background: #d38627; /* Oro Ambrato */
  border: 2px solid #ffffff;
  box-shadow: 0 0 15px rgba(211, 134, 39, 0.9);
}
.poi-marker.amber::before {
  background: #d38627;
}

.poi-marker.terracotta {
  background: #c0392b; /* Rosso Terracotta */
  border: 2px solid #ffffff;
  box-shadow: 0 0 15px rgba(192, 57, 43, 0.9);
}
.poi-marker.terracotta::before {
  background: #c0392b;
}

.poi-marker.sage {
  background: #2ecc71; /* Verde Salvia */
  border: 2px solid #ffffff;
  box-shadow: 0 0 15px rgba(46, 204, 113, 0.9);
}
.poi-marker.sage::before {
  background: #2ecc71;
}

.poi-marker.blue {
  background: #2980b9; /* Blu Oltremare */
  border: 2px solid #ffffff;
  box-shadow: 0 0 15px rgba(41, 128, 185, 0.9);
}
.poi-marker.blue::before {
  background: #2980b9;
}

.poi-marker.purple {
  background: #8e44ad; /* Viola Cardinale */
  border: 2px solid #ffffff;
  box-shadow: 0 0 15px rgba(142, 68, 173, 0.9);
}
.poi-marker.purple::before {
  background: #8e44ad;
}

.poi-marker.orange {
  background: #e67e22; /* Arancio Rame / Ocra */
  border: 2px solid #ffffff;
  box-shadow: 0 0 15px rgba(230, 126, 34, 0.9);
}
.poi-marker.orange::before {
  background: #e67e22;
}

/* Map Legend */
.map-legend {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem 1rem;
  padding: 0.85rem 1.25rem;
  background: rgba(22, 21, 19, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  max-width: 980px;
  width: calc(100% - 2rem);
  box-sizing: border-box;
}

.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.2s ease;
}

.legend-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.legend-dot {
  width: 12px;
  height: 12px;
  min-width: 12px;
  min-height: 12px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  display: inline-block;
  margin-top: 3px;
  flex-shrink: 0;
}

.legend-dot.amber {
  background: #d38627;
  box-shadow: 0 0 8px rgba(211, 134, 39, 0.8);
}
.legend-dot.terracotta {
  background: #c0392b;
  box-shadow: 0 0 8px rgba(192, 57, 43, 0.8);
}
.legend-dot.sage {
  background: #2ecc71;
  box-shadow: 0 0 8px rgba(46, 204, 113, 0.8);
}
.legend-dot.blue {
  background: #2980b9;
  box-shadow: 0 0 8px rgba(41, 128, 185, 0.8);
}
.legend-dot.purple {
  background: #8e44ad;
  box-shadow: 0 0 8px rgba(142, 68, 173, 0.8);
}
.legend-dot.orange {
  background: #e67e22;
  box-shadow: 0 0 8px rgba(230, 126, 34, 0.8);
}

.legend-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.legend-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.86rem;
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.25;
}

.legend-sub {
  font-family: 'Inter', sans-serif;
  font-size: 0.76rem;
  color: rgba(232, 228, 219, 0.82);
  font-weight: 400;
  line-height: 1.3;
}

/* Responsive Legend Breakpoints */
@media (max-width: 900px) {
  .map-legend {
    grid-template-columns: repeat(2, 1fr);
    max-width: 680px;
    gap: 0.5rem 0.75rem;
    padding: 0.75rem 1rem;
  }
}

@media (max-width: 580px) {
  .map-legend {
    grid-template-columns: 1fr;
    max-width: 100%;
    bottom: 0.75rem;
    padding: 0.65rem 0.85rem;
    max-height: 40vh;
    overflow-y: auto;
  }
  .legend-item {
    padding: 0.4rem 0.6rem;
  }
}

@keyframes pulsate {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

@keyframes pulsate {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

/* Modal Styling */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #1e1e1e;
  width: 95vw;
  max-width: 1400px;
  height: 90vh;
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.close-modal {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
  z-index: 10;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.modal-body {
  display: flex;
  height: 100%;
  width: 100%;
}

/* Gallery Section */
.gallery-section {
  flex: 1;
  background: #000;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.carousel {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
}

.image-holder {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.image-holder img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.image-holder img.loaded {
  opacity: 1;
}

/* Loader Styling */
.loader {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: var(--accent-color);
  animation: spin 1s ease-in-out infinite;
  display: none;
}

.loader.active {
  display: block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: none;
  padding: 1.5rem;
  cursor: pointer;
  z-index: 5;
  border-radius: 50%;
  transition: background 0.3s;
}

.carousel-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.carousel-btn.prev {
  left: 1rem;
}
.carousel-btn.next {
  right: 1rem;
}

.image-dots {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 5;
}

.dot {
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  cursor: pointer;
  transition:
    background 0.3s,
    transform 0.2s;
}

.dot:hover {
  background: rgba(255, 255, 255, 0.6);
}

.dot.active {
  background: #fff;
  transform: scale(1.2);
}

/* Info Section */
.info-section {
  flex: 1.2;
  padding: 3.5rem;
  overflow-y: auto;
  background: linear-gradient(to bottom, #252422, #1e1e1e);
}

.info-section h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  margin-bottom: 1.5rem;
  color: var(--wall-color);
}

.divider {
  width: 50px;
  height: 4px;
  background: var(--accent-color);
  margin-bottom: 2rem;
}

.info-section p {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #c0bab1;
  white-space: pre-line;
}

/* Responsive adjustment */
@media (max-width: 900px) {
  .modal-body {
    flex-direction: column;
  }
  .gallery-section {
    flex: 1;
  }
  .info-section {
    flex: 1;
    padding: 2rem;
  }
  .info-section h2 {
    font-size: 1.6rem;
  }
}
