/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  color: #111;
  background: #fff;
}

/* ---------- Map ---------- */
#map {
  height: 100vh; /* Full viewport height */
  width: 100%;
}

/* ---------- Floating filter container (right side) ---------- */
.filter-container {
  position: fixed;
  right: 16px;
  top: 16px;
  z-index: 1100; /* Above Leaflet controls */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

/* Toggle button - Modern ocean theme */
.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 24px;
  border: 2px solid transparent;
  background: linear-gradient(135deg, #0077be 0%, #0099cc 100%);
  color: white;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 4px 14px rgba(0, 119, 190, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.filter-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0099cc 0%, #00ace6 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.filter-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 119, 190, 0.4);
}

.filter-toggle:hover::before {
  opacity: 1;
}

.filter-toggle:active { 
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 119, 190, 0.3);
}

.filter-toggle > * {
  position: relative;
  z-index: 1;
}

.filter-icon {
  font-size: 1.1rem;
  line-height: 1;
}

/* ---------- Panel - Modern glass morphism ---------- */
.filter-panel {
  display: none;
  min-width: 300px;
  max-height: calc(100vh - 80px);
  overflow: auto;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 119, 190, 0.1);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 
    0 10px 40px rgba(0, 119, 190, 0.1),
    0 2px 10px rgba(0, 0, 0, 0.05);
}

.filter-panel.active,
.filter-panel.show {
  display: block;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.filter-panel h3 {
  margin: 0 0 16px 0;
  font-size: 1.1rem;
  letter-spacing: 0.3px;
  color: #0077be;
  font-weight: 700;
}

/* ---------- Accordion - Modern rounded style ---------- */
.accordion {
  display: grid;
  gap: 12px;
}

.accordion-section {
  border: 1px solid rgba(0, 119, 190, 0.15);
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
  overflow: hidden;
  transition: all 0.3s ease;
}

.accordion-section:hover {
  border-color: rgba(0, 119, 190, 0.3);
  box-shadow: 0 4px 12px rgba(0, 119, 190, 0.08);
}

.accordion-header {
  width: 100%;
  background: transparent;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.accordion-header:hover {
  background: rgba(0, 119, 190, 0.04);
}

.header-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: #0077be;
}

.category-toggle {
  transform: translateY(1px);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.accordion-section.open .category-toggle {
  transform: translateY(1px) scale(1.1);
}

.accordion-title {
  user-select: none;
  font-size: 0.95rem;
}

.accordion-caret {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: #0099cc;
  font-size: 1rem; /* Add this line - adjust value as needed */
  line-height: 1;    /* Add this to keep it vertically centered */
}

.accordion-section.open .accordion-caret {
  transform: rotate(90deg);
}

.section-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-section.open .section-body {
  max-height: 600px;
  opacity: 1;
  padding: 0 16px 16px 16px;
}

/* ---------- Filter group inputs - Modern style ---------- */
.filter-group {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.filter-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0077be;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.filter-group select,
.filter-group input[type="number"],
.filter-group input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid rgba(0, 119, 190, 0.15);
  background: white;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.filter-group select:hover,
.filter-group input[type="number"]:hover,
.filter-group input[type="text"]:hover {
  border-color: rgba(0, 119, 190, 0.3);
}

.filter-group select:focus,
.filter-group input[type="number"]:focus,
.filter-group input[type="text"]:focus {
  outline: none;
  border-color: #0099cc;
  box-shadow: 0 0 0 3px rgba(0, 153, 204, 0.1);
}

/* ---------- Panel footer actions - Modern button ---------- */
.clear-filters {
  width: 100%;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid rgba(0, 119, 190, 0.2);
  background: white;
  color: #0077be;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.clear-filters::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(0, 119, 190, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease;
}

.clear-filters:hover {
  border-color: #0099cc;
  color: #0099cc;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 119, 190, 0.15);
}

.clear-filters:hover::before {
  width: 300px;
  height: 300px;
}

.clear-filters:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 119, 190, 0.15);
}

/* ---------- Leaflet marker div icon base ---------- */
.custom-div-icon {
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
  transform: translateY(-6px);
  text-shadow: 0 2px 4px rgba(0, 119, 190, 0.2);
}

/* ---------- Scrollbar polish - Ocean theme ---------- */
.filter-panel::-webkit-scrollbar {
  width: 10px;
}
.filter-panel::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #0099cc 0%, #0077be 100%);
  border-radius: 10px;
}
.filter-panel::-webkit-scrollbar-track {
  background: rgba(0, 119, 190, 0.05);
  border-radius: 10px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .filter-panel {
    min-width: 280px;
  }
}

@media (max-width: 600px) {
  .filter-container {
    right: 10px;
    top: 10px;
  }
  .filter-panel {
    min-width: min(92vw, 340px);
    max-height: calc(100vh - 100px);
  }
  .filter-toggle {
    padding: 10px 16px;
    font-size: 0.9rem;
  }
}

/* ---------- Popup styling - FIXED 310px width ---------- */
/* Force all popups to be exactly 310px wide */
.leaflet-popup-content-wrapper {
  width: 310px !important;
  min-width: 310px !important;
  max-width: 310px !important;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 119, 190, 0.15);
}

.leaflet-popup-content {
  width: 310px !important;
  min-width: 310px !important;
  max-width: 310px !important;
  margin: 0 !important;
  padding: 16px !important;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-break: break-word;
}

.leaflet-popup-content img {
  max-width: 100%;
  height: auto;
}

.leaflet-popup-content a {
  word-break: break-all;
  overflow-wrap: break-word;
  max-width: 100%;
  display: inline-block;
}

.leaflet-popup-tip {
  box-shadow: 0 3px 10px rgba(0, 119, 190, 0.1);
}

/* Remove the old popup-wide class styles since we're forcing all popups to be 310px */

/* Category icons in accordion headers */
.category-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Adjust alignment if needed */
.header-left {
  display: inline-flex;
  align-items: center;
  gap: 10px; /* This is already in your CSS */
  font-weight: 600;
  color: #0077be;
}

/* Collapse all button - matches your clear button style */
.collapse-all {
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid rgba(0, 119, 190, 0.15);
  background: rgba(0, 119, 190, 0.04);
  color: #0077be;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.collapse-all:hover {
  background: rgba(0, 119, 190, 0.08);
  border-color: rgba(0, 119, 190, 0.3);
}

.collapse-all:active {
  background: rgba(0, 119, 190, 0.12);
}

/* Home Button Styles */
.home-button {
  position: fixed;
  bottom: 50px;
  right: 20px;
  z-index: 1000; /* Ensure it's above the map and other elements */
  display: inline-block;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.home-button img {
  display: block;
  width: 60px; /* Adjust size as needed */
  height: auto;
  border-radius: 8px; /* Optional: adds rounded corners */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); /* Optional: adds shadow */
}

.home-button:hover {
  transform: scale(1.2); /* Grows by 20% on hover */
}