:root {
  --text-main: #1c3e64;
  --accent: #b69a63;
  --bg: #ffffff;
  --bg-secondary: #f8f9fa;
  --shadow: rgba(0, 0, 0, 0.12);
  --border-radius: 8px;
  --transition: 0.2s ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Roboto', system-ui, -apple-system, sans-serif;
  color: var(--text-main);
  background: var(--bg);
  line-height: 1.6;
}

header {
  padding: 3rem 1rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin: 0 0 1rem;
  color: var(--text-main);
}

header p {
  max-width: 700px;
  margin: 0 auto;
  font-size: 1.1rem;
  opacity: 0.9;
  color: #555;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 60vh;
}

/* Loader */
.loader {
  text-align: center;
  padding: 2rem;
  font-style: italic;
  color: var(--accent);
}

/* Carte / tuiles */
#map-section {
  margin-bottom: 2rem;
  position: relative; /* Ensure absolute children (overlay) are positioned relative to this */
}

#map {
  height: 600px;
  width: 100%;
  border-radius: var(--border-radius);
  border: 1px solid #ddd;
  z-index: 1; /* Ensure it stays below modal */
  /* Remove position: relative from here if it causes issues, but Leaflet adds it anyway. 
     The key is that #map-section is the context for the overlay. */
}

/* Map Info Overlay (Card Style) */
.map-overlay {
  position: absolute;
  width: 320px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  z-index: 1000;
  padding: 0;
  border: none;
  overflow: hidden;
  
  /* Start centered on the point (top/left set by JS), scale 0.1 for pop effect */
  transform: translate(-50%, -50%) scale(0.1);
  transform-origin: center center;
  opacity: 0;
  
  /* Spring-like transition */
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.map-overlay.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

/* Remove the triangle arrow for this card style */
.map-overlay::after {
  display: none;
}

.overlay-header {
  padding: 1.5rem; /* Increased padding */
  border-bottom: 1px solid #f0f0f0;
  position: relative;
}

.close-overlay {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: #f8f9fa;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.2rem;
  line-height: 1;
  z-index: 10;
}

.close-overlay:hover {
  background: #eee;
  color: #333;
  transform: rotate(90deg);
}

.overlay-content h2 {
  font-size: 1.5rem;
  color: var(--color-main);
  margin: 0 0 0.25rem 0;
  padding-right: 2rem; /* Avoid overlap with close button */
}

.overlay-content {
  padding: 10px;
}

.overlay-subtitle {
  font-size: 0.85rem;
  color: #888;
}

.overlay-body {
  padding: 1.5rem; /* Consistent padding */
}

.overlay-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-box {
  background: #f8f9fa;
  padding: 0.75rem;
  border-radius: 12px;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.stat-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

/* Updated Video Button Style */
.btn-video {
  width: 100%;
  height: auto; /* Allow flexible height */
  min-height: 80px;
  border-radius: 12px;
  background: var(--text-main); /* Blue site color */
  color: white;
  border: none;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: row; /* Row layout */
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 1rem;
  box-shadow: 0 4px 15px rgba(28, 62, 100, 0.3);
  transition: transform 0.2s;
  padding: 0.75rem;
  gap: 1rem;
}

.btn-video:hover {
  transform: scale(1.02);
  background: #2c5a8c;
}

/* Video Thumbnail/Icon Area */
.btn-video .video-thumb {
  width: 80px;
  height: 50px;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.btn-video .video-thumb::after {
  content: "▶";
  color: white;
  font-size: 1.2rem;
}

.btn-video .video-label {
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  line-height: 1.3;
}

/* Updated 'More Info' Button Style */
.btn-more-overlay {
  width: 100%;
  padding: 0.85rem;
  background: var(--accent); /* Gold by default */
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  opacity: 1; /* Make visible by default */
}

.btn-more-overlay:hover {
  background: var(--text-main); /* Blue on hover */
  transform: translateY(-2px);
}


#tiles-container {
  margin-top: 1rem;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.tile {
  background: white;
  border: 1px solid #eee;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.tile:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 30px rgba(0,0,0,0.1);
  border-color: var(--accent);
}

.tile::after {
  content: "Découvrir";
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--accent);
  color: white;
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.tile:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.tile h2 {
  font-size: 1.25rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.tile .meta {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.tile .price-tag {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  background: #f8f9fa;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  width: 100%;
}

.tile .price-tag span {
  font-size: 0.8rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tile .price-tag strong {
  color: var(--accent);
  font-size: 1.1rem;
}

/* Tile Expanded State & Animations */
.tile.expanded {
  grid-column: span 2; /* Take more space if grid allows */
  border: 2px solid var(--accent);
  transform: scale(1.02);
  z-index: 10;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  cursor: default;
}

.tile-details {
  display: none;
  width: 100%;
  margin-top: 1.5rem;
  border-top: 1px solid #eee;
  padding-top: 1rem;
  animation: slideDown 0.5s ease forwards;
}

.tile.expanded .tile-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.detail-item {
  background: #fcfcfc;
  padding: 0.75rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  opacity: 0;
  animation: fadeInItem 0.5s ease forwards;
}

.detail-item:nth-child(1) { animation-delay: 0.1s; }
.detail-item:nth-child(2) { animation-delay: 0.2s; }
.detail-item:nth-child(3) { animation-delay: 0.3s; }

@keyframes fadeInItem {
  to { opacity: 1; }
}

.detail-label {
  display: block;
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 0.25rem;
}

.detail-value {
  font-weight: 500;
  color: #333;
}

.tile-actions {
  grid-column: 1 / -1;
  margin-top: 1rem;
  text-align: right;
}

.btn-more {
  background: var(--text-main);
  color: white;
  border: none;
  padding: 0.5rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.btn-more:hover {
  background: #2c5a8c;
}

/* Modal détail */
#detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5); /* Darker backdrop */
  display: none;
  align-items: flex-end; /* Mobile bottom sheet style or side panel logic */
  justify-content: flex-end; /* Align right for slide in */
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#detail-overlay.active {
  display: flex;
  opacity: 1;
}

#detail {
  background: #fff;
  width: 100%;
  max-width: 600px; /* Side panel width */
  height: 100%; /* Full height */
  max-height: none;
  overflow-y: auto;
  border-radius: 0; /* No radius for side panel */
  padding: 2rem;
  position: relative;
  box-shadow: -10px 0 50px rgba(0,0,0,0.2);
  transform: translateX(100%); /* Slide from right */
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

#detail-overlay.active #detail {
  transform: translateX(0);
}

@media (max-width: 768px) {
  #detail {
    max-width: 100%;
    width: 100%;
  }
}

/* Video Overlay */
.video-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden; /* Hide from accessibility and clicks */
  pointer-events: none; /* Ensure clicks pass through */
  transition: opacity 0.3s ease, visibility 0.3s;
  backdrop-filter: blur(5px);
}

.video-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.video-modal {
  width: 90%;
  max-width: 1000px;
  aspect-ratio: 16/9;
  background: black;
  position: relative;
  box-shadow: 0 0 50px rgba(0,0,0,0.5);
  border-radius: 16px;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.video-overlay.active .video-modal {
  transform: scale(1);
}

.close-video {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: white;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.close-video:hover {
  background: rgba(255,255,255,0.3);
}

.video-container {
  width: 100%;
  height: 100%;
}

.video-container iframe {
  width: 100%;
  height: 100%;
}

#detail-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: none;
  background: transparent;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-main);
  transition: color 0.2s;
  z-index: 10;
}

#detail-close:hover {
  color: var(--accent);
}

/* Detail Content Styling */
.detail-header {
  border-bottom: 2px solid var(--bg-secondary);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

.detail-header h2 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
  color: var(--text-main);
}

.detail-header .subtitle {
  font-size: 1.1rem;
  color: #666;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.detail-section {
  margin-bottom: 2rem;
}

.detail-section h3 {
  color: var(--accent);
  font-size: 1.3rem;
  margin-bottom: 1rem;
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: 8px;
}

.stat-item strong {
  display: block;
  font-size: 1.2rem;
  color: var(--text-main);
}

.stat-item span {
  font-size: 0.85rem;
  color: #666;
}

ul.list-clean {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul.list-clean li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}

ul.list-clean li:last-child {
  border-bottom: none;
}

.tag {
  display: inline-block;
  background: var(--bg-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 0.85rem;
  margin: 0 0.5rem 0.5rem 0;
  color: var(--text-main);
}

a.btn-link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
}

a.btn-link:hover {
  border-bottom-color: var(--accent);
}

/* Helper below map */
.map-help {
  max-width: 1200px;
  margin: 0.5rem auto 1rem;
  padding: 0 1rem;
  color: #666;
}

.map-help a.tourism-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  font-weight: 500;
}
.map-help a.tourism-link:hover {
  border-bottom-color: var(--accent);
}

footer {
  margin-top: 4rem;
  padding: 2rem 1rem;
  font-size: 0.9rem;
  color: #888;
  text-align: center;
  border-top: 1px solid #eee;
}

@media (max-width: 768px) {
  #detail {
    padding: 1.5rem;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
}
