:root {
  --primary-bg: #000;
  --primary-text: #fff;
  /* MODIFIED: Softer background */
  --menu-bg: rgba(20, 20, 20, 0.92);
  --menu-hover: rgba(255, 255, 255, 0.2);
  --menu-active: rgba(255, 255, 255, 0.3);
  --accent-color: #4CAF50;
  --warning-color: #f44336;
  --edge-marker-bg: #2196F3;
  
  /* NEW: For Firefox dropdown colors */
  --select-bg: rgba(255, 255, 255, 0.1);

  /* NEW: Colors & Shadows */
  --secondary-color: #6c757d;
  --menu-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  /* MODIFIED: Modern font stack */
  font-family: var(--font-family-base);
  background: var(--primary-bg);
  color: var(--primary-text);
  overflow: hidden;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Intro Animation */
.intro-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--primary-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999; /* Below header (1000) to allow header clicks */
  transition: opacity 1s ease;
  pointer-events: none; /* Don't block clicks by default */
}

.intro-container.hidden {
  opacity: 0;
  pointer-events: none;
}

.intro-logo {
  width: var(--intro-logo-size);
  height: var(--intro-logo-size);
  position: relative;
  pointer-events: auto; /* Enable clicks on logo area */
}

.intro-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.intro-bottom-half {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  pointer-events: none;
  /* Allows clicks to pass through */
}

img.intro-icon-overlay {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: var(--intro-icon-size);
  height: var(--intro-icon-size);
  opacity: 0;
  transition: opacity 0.5s ease;
  object-fit: contain;
  display: block;
}

.intro-icon-overlay.visible {
  opacity: 1;
}

.skip-intro-btn {
  position: absolute;
  bottom: 40px;
  right: 40px;
  background: var(--menu-bg);
  color: var(--primary-text);
  border: 1px solid var(--primary-text);
  border-radius: 4px;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.2s ease;
  z-index: 1100;
  pointer-events: auto; /* Enable clicks on button */
}

.skip-intro-btn:hover {
  background: var(--menu-hover);
  transform: scale(1.05);
}

.skip-intro-btn.visible {
  opacity: 1;
}

/* --- NEW: Custom Modal Styles --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-alert-modal);
  opacity: 1;
  transition: opacity 0.3s ease;
  padding: 10px; /* Padding for small screens */
}
.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.modal-content {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e3e8ef);
  border-radius: var(--radius-lg, 12px);
  padding: 20px;
  max-width: min(420px, 92vw);
  text-align: center;
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(15, 23, 42, 0.18));
  font-family: var(--font-family-base);
  color: var(--color-ink, #0f172a);
}

.modal-content button {
  background: linear-gradient(180deg, #2f6fb3, #295e9b);
  color: #fff;
  border: 1px solid #295e9b;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.16);
}

.modal-content button:hover {
  filter: brightness(1.05);
}
/* --- END Custom Modal --- */


/* Navigation Controls */
/* Home button - top right */
#homeBtn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 500;
  opacity: 0;
  transition: opacity 0.5s ease;
}

#homeBtn.visible {
  opacity: 1;
}

/* Reset button - top left */
#resetBtn {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 500;
  opacity: 0;
  transition: opacity 0.5s ease;
  width: 125px;
  /* Larger than default 50px */
  height: 125px;
  /* Larger than default 50px */
  background: rgba(0, 0, 0, 0) !important;
  /* More opaque than home button */
}

#resetBtn.visible {
  opacity: 1;
}

.nav-btn {
  width: 50px;
  height: 50px;
  background: rgba(0, 0, 0, 0.5);
  /* Semi-transparent background */
  border: none;
  /* Remove border */
  border-radius: 50%;
  /* Circular shape */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  /* Lighter on hover */
  transform: scale(1.1);
}

.nav-btn img {
  width: 60%;
  height: 60%;
  object-fit: contain;
}

/* User Menu Styles */
.user-menu-btn,
.login-btn {
  position: relative;
  font-size: 24px;
}

.user-icon,
.login-icon {
  font-size: 24px;
}

.user-dropdown {
  position: absolute;
  top: 60px;
  right: 0;
  background: var(--menu-bg);
  border-radius: 8px;
  box-shadow: var(--menu-shadow);
  min-width: 200px;
  overflow: hidden;
  opacity: 1;
  transform: translateY(0);
  transition: all 0.3s ease;
  z-index: 1000;
}

.user-dropdown.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.user-dropdown-header {
  padding: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.user-email {
  font-size: 14px;
  color: var(--primary-text);
  word-break: break-word;
}

.user-dropdown-item {
  display: block;
  padding: 12px 15px;
  color: var(--primary-text);
  text-decoration: none;
  transition: background 0.2s ease;
  cursor: pointer;
}

.user-dropdown-item:hover {
  background: var(--menu-hover);
}

/* Main Menu */
.menu-container {
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 500;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.menu-container.visible {
  opacity: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.menu-btn {
  width: 60px;
  height: 60px;
  background: var(--menu-bg);
  border: 1px solid var(--primary-text);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
}

.menu-btn:hover {
  background: var(--menu-hover);
  transform: scale(1.05);
}

.menu-btn.active {
  background: var(--menu-active);
}

.menu-btn img {
  max-width: 70%;
  max-height: 70%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.menu-label {
  position: absolute;
  left: calc(100% + 10px);
  background: var(--menu-bg);
  padding: 5px 10px;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  color: var(--primary-text);
  z-index: 505;
}


/* --- MODIFIED: Tooltip Behavior --- */

/* 1. Default state: labels are hidden */
.menu-label {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* 2. On-Launch state: Show all labels */
.menu-container.show-all-tooltips .menu-label {
  opacity: 1;
}

/* 3. Single-Hover state: Show only the hovered label */
.menu-container.show-single-tooltip .menu-item.show-tooltip .menu-label {
   opacity: 1;
}
/* --- END Tooltip Behavior --- */


/* Submenu */
.submenu {
  display: flex;
  gap: 8px;
  margin-left: 10px;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.3s ease;
}

.submenu.visible {
  max-width: 400px;
  opacity: 1;
  overflow: visible;
}

.submenu-btn {
  width: 40px;
  height: 40px;
  background: var(--menu-bg);
  border: 1px solid var(--primary-text);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
}

.submenu-btn:hover {
  background: var(--menu-hover);
  transform: scale(1.05);
}

.submenu-btn.active {
  background: var(--menu-active);
  border-color: var(--accent-color);
}

.submenu-btn img {
  max-width: 70%;
  max-height: 70%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.submenu-tooltip {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--menu-bg);
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 12px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s;
  color: var(--primary-text);
  z-index: 520;
}

.submenu-btn:hover .submenu-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Custom Leaflet overrides */
.leaflet-popup-content-wrapper {
  background: var(--menu-bg);
  color: var(--primary-text);
  border-radius: 8px; /* Match our panel style */
}

/* NEW: Style popup content */
.leaflet-popup-content {
  font-size: 14px;
  line-height: 1.5;
}
.leaflet-popup-content b {
  color: var(--accent-color);
  font-size: 1.1em;
}
.leaflet-popup-content hr {
  border-top: 1px solid rgba(255,255,255,0.2);
  margin: 8px 0;
}
/* --- END --- */

.leaflet-popup-tip {
  background: var(--menu-bg);
}

.custom-div-icon {
  background: var(--poi-container-bg);
  border: none;
  border-radius: 50%;
  width: var(--size-poi-container) !important;
  height: var(--size-poi-container) !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.poi-icon {
  width: var(--size-poi-icon) !important;
  height: var(--size-poi-icon) !important;
  max-width: var(--size-poi-icon) !important;
  max-height: var(--size-poi-icon) !important;
  object-fit: contain !important;
  display: block !important;
}

.full-size-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.leaflet-tile-container {
  background: transparent !important;
}


.leaflet-tile {
  background: transparent !important;
}


/* --- POI Menu (Right Aligned) --- */
/* --- THIS IS THE FIX for Side Panels --- */
#poiMenuContainer,
#bookingFilterContainer {
  position: fixed;
  top: 20px; /* Reduced top margin */
  right: 15px;
  width: 380px; /* Use fixed width for consistency */
  max-width: 90vw; /* Ensure it's not wider than screen */
  max-height: calc(100vh - 40px); /* Fit screen height with padding */

  /* MODIFIED: Polished aesthetics */
  background: var(--menu-bg);
  color: white;
  border: 1px solid var(--accent-color);
  border-radius: 12px; /* Softer radius */
  padding: 10px;
  z-index: 600;
  box-sizing: border-box;
  overflow-y: auto;
  box-shadow: var(--menu-shadow); /* Added shadow */
  
  display: none; /* Hidden by default */
  --select-bg: rgba(255, 255, 255, 0.1);
}
/* --- END FIX --- */

#poiMenuContainer.visible,
#bookingFilterContainer.visible {
  display: block;
  /* Show when visible */
}

#poiMenuContainer table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
}

#poiMenuContainer table th,
#poiMenuContainer table td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  padding: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  text-align: left;
}

#poiMenuContainer table th {
  white-space: nowrap;
}

#poiMenuContainer table tr:hover {
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

.poi-menu-header {
  position: sticky;
  top: -10px; /* Stick to top of scrolling panel */
  background: rgba(0, 0, 0, 0.95);
  z-index: 2;
  padding: 5px 0 10px 0; /* Adjust padding */
  margin: -10px -10px 8px -10px; /* Absorb parent padding */
  padding-left: 10px;
  padding-right: 10px;
}

.poi-menu-title {
  font-size: 20px !important;
  font-weight: 700 !important;
  text-align: center;
  width: 100%;
  margin: 0 0 8px 0;
}

.poi-menu-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

/* Use a generic class for buttons, inputs, and selects */
.poi-menu-btn,
.poi-menu-input {
  background: var(--menu-hover);
  color: var(--primary-text);
  border: 1px solid var(--primary-text);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 14px;
  cursor: pointer;
  /* MODIFIED: Added transition */
  transition: transform 0.2s ease, background-color 0.2s ease, filter 0.2s ease;
  flex-grow: 1;
  box-sizing: border-box;
}

.poi-menu-btn:not(:disabled):hover {
  /* MODIFIED: Added hover effect */
  transform: scale(1.03);
  filter: brightness(1.1);
}

.poi-menu-input {
  background: var(--select-bg);
  border-color: rgba(255, 255, 255, 0.3);
}

/* NEW: Input focus style */
.poi-menu-input:focus {
  transform: scale(1.02);
  border-color: var(--accent-color);
  outline: none; /* Remove default blue glow */
}

/* NEW: Button group layout */
.poi-menu-btngroup {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.poi-menu-btngroup .poi-menu-btn {
  flex-basis: 150px; /* Allow buttons to stack on narrow panel */
}

/* Ensure inputs/selects in the filter window look right */
#campsiteFilters .poi-menu-input,
#campsiteFilters select {
  width: 100%;
  margin-bottom: 10px;
  color: var(--primary-text);
}


/* NEW: Fix for Firefox white-on-white dropdown */
#campsiteFilters select option {
  background: var(--menu-bg);
  color: var(--primary-text);
}
/* --- END FIX --- */


/* --- NEW: Calendar Styles --- */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0;
}
#calendarMonthYear {
  font-size: 1.1em;
  font-weight: bold;
}
.calendar-nav-btn {
  background: var(--menu-hover);
  color: var(--primary-text);
  border: 1px solid var(--primary-text);
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  /* NEW: Added transition */
  transition: transform 0.2s ease, background-color 0.2s ease, filter 0.2s ease;
}
.calendar-nav-btn:not(:disabled):hover {
  /* NEW: Added hover effect */
  transform: scale(1.03);
  filter: brightness(1.1);
}
.calendar-nav-btn:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.3);
  cursor: not-allowed;
}
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: bold;
  font-size: 0.9em;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 5px;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.calendar-day, .calendar-day-empty {
  padding: 8px 0;
  text-align: center;
  border-radius: 4px;
  font-size: 0.9em;
}
.calendar-day-empty {
  visibility: hidden;
}
.calendar-day-past {
  color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
}
.calendar-day-reserved {
  color: rgba(255, 255, 255, 0.7);
  background: var(--warning-color);
  text-decoration: line-through;
}
.calendar-day-available {
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  /* MODIFIED: Added transition */
  transition: background 0.2s ease, transform 0.2s ease;
}
.calendar-day-available:hover {
  /* MODIFIED: Enhanced hover effect */
  background: var(--accent-color);
  transform: scale(1.1);
}
.calendar-day-selected-start, .calendar-day-selected-end {
  background: var(--accent-color);
  color: var(--primary-text);
  font-weight: bold;
}
.calendar-day-selected-range {
  background: rgba(76, 175, 80, 0.4);
}
.calendar-legend {
  display: flex;
  justify-content: space-around;
  font-size: 0.8em;
  margin-top: 10px;
}
.legend-box {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}
.legend-available { background: rgba(255, 255, 255, 0.1); }
.legend-reserved { background: var(--warning-color); }
.legend-past { background: rgba(255, 255, 255, 0.05); }

#bookingSummaryContainer {
  display: flex;
  flex-direction: column;
  gap: 10px; /* Space out summary and buttons */
}
#bookingSummaryContainer p {
  line-height: 1.4;
}

/* --- END Calendar Styles --- */


/* --- Custom Cluster Icon Styles --- */

.my-custom-cluster {
  position: relative;
  background: var(--poi-container-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 2px solid rgba(255, 255, 255, 0.4);
  transition: all 0.3s ease;
}

.my-custom-cluster img {
  width: 60%;
  height: 60%;
  object-fit: contain;
}

.my-custom-cluster .cluster-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--accent-color);
  color: white;
  font-size: 12px;
  font-weight: bold;
  border-radius: 50%;
  padding: 4px;
  min-width: 20px;
  height: 20px;
  box-sizing: border-box;
  text-align: center;
  line-height: 12px;
  border: 1px solid white;
  z-index: 10;
}

.my-custom-cluster.bubble {
  background: var(--poi-container-bg);
  color: #fff;
}

.my-custom-cluster.bubble .cluster-count {
  position: static;
  background: transparent;
  border: none;
  padding: 0;
  min-width: unset;
  height: auto;
  line-height: 1;
  font-size: 16px;
}

.my-custom-cluster::before,
.my-custom-cluster::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  z-index: -1;
  opacity: 0;
  transition: all 0.3s ease;
  box-sizing: content-box;
  padding: 3px;
}

.my-custom-cluster::after {
  border-color: rgba(255, 255, 255, 0.2);
  padding: 6px;
}

.my-custom-cluster.rings-2::before {
  width: 100%;
  height: 100%;
  opacity: 1;
}

.my-custom-cluster.rings-3::before,
.my-custom-cluster.rings-4::before,
.my-custom-cluster.rings-5::before {
  width: 100%;
  height: 100%;
  opacity: 1;
}

.my-custom-cluster.rings-3::after,
.my-custom-cluster.rings-4::after,
.my-custom-cluster.rings-5::after {
  width: 100%;
  height: 100%;
  opacity: 1;
}

.my-custom-cluster.rings-4 {
  transform: scale(1.1);
}

.my-custom-cluster.rings-5 {
  transform: scale(1.2);
}

/* --- End Custom Cluster --- */

/* --- Logo Overlap Styles --- */

.permanent-logo-icon {
  position: relative;
}

.logo-overlap-count {
  position: absolute;
  top: 0px;
  right: 0px;
  background: var(--accent-color);
  color: white;
  font-size: 14px;
  font-weight: bold;
  border-radius: 50%;
  padding: 4px;
  min-width: 24px;
  height: 24px;
  box-sizing: border-box;
  text-align: center;
  line-height: 16px;
  border: 1px solid white;
  z-index: 10;
  display: none;
}

.permanent-logo-icon::before,
.permanent-logo-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.8);
  z-index: -1;
  opacity: 0;
  transition: all 0.3s ease;
  box-sizing: content-box;
  padding: 4px;
}

.permanent-logo-icon::after {
  border-color: rgba(255, 255, 255, 0.5);
  padding: 8px;
}

.permanent-logo-icon.logo-is-overlapping::before,
.permanent-logo-icon.logo-is-overlapping::after {
  width: 100%;
  height: 100%;
  opacity: 1;
}

/* --- End Logo Overlap --- */


/* --- NEW: Media Query for Mobile/Narrow Screens --- */
@media (max-width: 768px) {
  #poiMenuContainer,
  #bookingFilterContainer {
    /* Override desktop styles */
    width: auto; /* Fill available space */
    min-width: 0;
    max-width: none;
    left: 10px;
    right: 10px;
    top: 70px; /* Position below top-left logo */
    max-height: calc(100vh - 80px); /* Fill height with padding */
  }
  
  .menu-container {
    top: auto;
    bottom: 20px; /* Move main menu to bottom-left */
    transform: none;
  }
  
  #homeBtn {
    top: 10px;
    right: 10px;
  }
  
  #resetBtn {
    top: 10px;
    left: 10px;
    width: 100px; /* Scale down logo */
    height: 100px;
  }
}
/* --- END Media Query --- */
