/*
 * Seecamping Map – scoped stylesheet
 *
 * All element-level selectors (body / header / footer) are re-rooted under
 * #seecamping-map so they cannot bleed into or be overridden by the WordPress
 * theme.  ID and class selectors are left as-is because their specificity is
 * already high enough to win over most theme rules.
 *
 * The * reset is scoped to the component as well so it does not disturb
 * WordPress admin-bar or other page widgets.
 */

/* ── Scoped box-model reset ──────────────────────────────────────────────── */
#seecamping-map *,
#seecamping-map *::before,
#seecamping-map *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Root container (replaces <body> of the standalone version) ──────────── */
#seecamping-map {
  background: #1b2a3a;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #dce8dc;
  width: 100%;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
#seecamping-map header { padding: 1.4rem 2rem 0.8rem; text-align: center; }

#seecamping-map header h1 {
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #e8f4e8;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

#seecamping-map header p {
  margin-top: 0.3rem;
  font-size: 0.82rem;
  color: #8aaa8a;
  letter-spacing: 0.04em;
}

/* ── Main two-column layout ──────────────────────────────────────────────── */
#layout {
  display: flex;
  gap: 0.9rem;
  width: min(98vw, 1480px);
  align-items: flex-start;
  margin-bottom: 2rem;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
#sidebar {
  flex-shrink: 0;
  width: 220px;
  background: #0f1e2d;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  overflow: hidden;
}

#sidebar-search {
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid #1e3448;
  flex-shrink: 0;
}

#sidebar-search input {
  width: 100%;
  background: #1b2e42;
  border: 1px solid #2a4460;
  border-radius: 5px;
  color: #cde0cd;
  font-size: 0.8rem;
  padding: 5px 8px;
  outline: none;
}

#sidebar-search input::placeholder { color: #4a6a5a; }
#sidebar-search input:focus         { border-color: #4a8a6a; }

#sidebar-list {
  overflow-y: auto;
  flex: 1;
  padding-bottom: 0.5rem;
}

#sidebar-list::-webkit-scrollbar       { width: 5px; }
#sidebar-list::-webkit-scrollbar-track { background: transparent; }
#sidebar-list::-webkit-scrollbar-thumb { background: #2a4460; border-radius: 3px; }

.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.7rem 0.35rem 0.8rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #4a7a6a;
  border-top: 1px solid #1e3448;
  margin-top: 0.3rem;
  cursor: default;
}

.sidebar-section:first-child .sidebar-section-title {
  border-top: none;
  margin-top: 0;
}

/* Collapsible section headers */
.sidebar-section-title.collapsible {
  cursor: pointer;
  user-select: none;
}
.sidebar-section-title.collapsible:hover { color: #6aaa8a; }

.sidebar-chevron {
  font-size: 0.75rem;
  line-height: 1;
  transition: transform 0.2s ease;
  display: inline-block;
  color: #3a6a5a;
}
.sidebar-section.collapsed .sidebar-chevron { transform: rotate(-90deg); }

/* Animated show/hide for collapsible groups */
.sidebar-items {
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  opacity: 1;
}
.sidebar-section.collapsed .sidebar-items {
  max-height: 0;
  opacity: 0;
}

.sidebar-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  color: #9ab8a0;
  font-size: 0.8rem;
  padding: 5px 0.8rem 5px 1rem;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-item:hover  { background: #1b3040; color: #cde8cd; }
.sidebar-item.active {
  background: #0e2535;
  color: #ffe04d;
  border-left-color: #ff8800;
  font-weight: 600;
}
.sidebar-item.hidden { display: none; }

/* ── Map column (map + info panel stacked) ───────────────────────────────── */
#map-column {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Map wrapper ─────────────────────────────────────────────────────────── */
#map-wrapper {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.55);
  background: #c8d0c0;
  touch-action: pan-y;
}
#map-wrapper svg { width: 100%; height: auto; display: block; }

#loading { padding: 3rem; text-align: center; color: #8aaa8a; font-size: 0.9rem; }

/* ── Info panel (floating card on desktop, bottom sheet on mobile) ────────── */
#info-panel {
  position: absolute;
  z-index: 9500;
  width: 300px;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  background: #0d1c2b;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.65);
  border: 1px solid #2a4460;
  animation: info-panel-in 0.18s ease;
}
#info-panel[hidden] { display: none; }

@keyframes info-panel-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

#info-header {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: #091520;
  border-bottom: 1px solid #1e3448;
}

#info-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: #9dd89d;
  letter-spacing: 0.02em;
}

#info-close {
  background: none;
  border: 1px solid transparent;
  color: #5a8a6a;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
#info-close:hover { background: #1a3040; color: #cde8cd; border-color: #2a4460; }

#info-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.8rem 1rem;
  color: #b0ceb0;
  font-size: 0.84rem;
  line-height: 1.55;
  scrollbar-width: thin;
  scrollbar-color: #2a4460 transparent;
}

/* Styles for HTML snippets fetched into info-body */
#info-body h3    { color: #9dd89d; font-size: 0.88rem; margin: 0.55rem 0 0.25rem; font-weight: 600; }
#info-body p     { margin: 0.2rem 0; }
#info-body ul    { margin: 0.2rem 0; padding-left: 1.2rem; }
#info-body li    { margin: 0.12rem 0; }
#info-body hr    { border: none; border-top: 1px solid #1e3448; margin: 0.6rem 0; }

#info-body .detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.18rem 0.75rem;
  margin: 0.35rem 0;
}
#info-body .dl   { color: #5a8a6a; font-size: 0.79rem; }
#info-body .dv   { color: #cde8cd; }
#info-body .badge {
  display: inline-block;
  background: #112030;
  color: #7abf8a;
  border: 1px solid #2a5060;
  border-radius: 4px;
  padding: 0.12rem 0.45rem;
  font-size: 0.77rem;
  margin: 0.1rem 0.1rem;
}

.info-state {
  color: #4a7a5a;
  font-style: italic;
  padding: 0.4rem 0;
}

/* ── Tooltip ─────────────────────────────────────────────────────────────── */
#tooltip {
  position: fixed;
  padding: 5px 12px;
  background: rgba(12,22,34,0.92);
  color: #f0f8f0;
  border: 1px solid rgba(180,210,150,0.35);
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 9999;
  backdrop-filter: blur(6px);
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
#seecamping-map footer {
  padding: 0.8rem;
  font-size: 0.73rem;
  color: #5a7a5a;
}

/* ── Floating action buttons (mobile only, hidden on desktop) ────────────── */
#fab-group {
  display: none;
  position: fixed;
  bottom: 5rem;
  right: 1.2rem;
  z-index: 1100;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  transition: bottom 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab {
  background: #0f1e2d;
  color: #7abf8a;
  border: 1px solid #2a4460;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  line-height: 1;
}
.fab:hover { background: #1b3040; }

#mobile-toggle               { width: 52px; height: 52px; font-size: 1.4rem; }
#zoom-in, #zoom-out, #zoom-reset { width: 44px; height: 44px; font-size: 1.3rem; }
#zoom-reset                  { font-size: 0.85rem; font-weight: 700; }

/* Dim overlay behind the sidebar bottom sheet */
#sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1050;
}
#sheet-overlay.visible { display: block; }

/* ── Responsive: mobile (≤ 768 px) ──────────────────────────────────────── */
@media (max-width: 768px) {
  #seecamping-map header h1 { font-size: 1.25rem; }
  #seecamping-map header p  { font-size: 0.75rem; }

  /* Stack map full-width */
  #layout {
    flex-direction: column;
    width: 100vw;
    gap: 0;
    margin-bottom: 0;
  }

  #map-column {
    width: 100%;
    gap: 0;
  }

  #map-wrapper {
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
  }

  /* Info panel becomes a fixed bottom sheet */
  #info-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 55vh;
    border-radius: 14px 14px 0 0;
    border-left: none;
    border-right: none;
    border-top: none;
    box-shadow: 0 -4px 28px rgba(0,0,0,0.6);
    z-index: 1050;
    animation: info-panel-mobile-in 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Drag-handle pill */
  #info-panel::before {
    content: '';
    display: block;
    flex-shrink: 0;
    width: 36px;
    height: 4px;
    background: #2a4460;
    border-radius: 2px;
    margin: 8px auto 0;
  }

  @keyframes info-panel-mobile-in {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  /* Sidebar becomes a slide-up bottom sheet */
  #sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 62vh;
    border-radius: 14px 14px 0 0;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1100;
    box-shadow: 0 -6px 32px rgba(0,0,0,0.6);
  }
  #sidebar.sheet-open { transform: translateY(0); }

  /* Drag-handle pill for sidebar sheet */
  #sidebar::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: #2a4460;
    border-radius: 2px;
    margin: 8px auto 2px;
    flex-shrink: 0;
  }

  #fab-group { display: flex; }

  #seecamping-map footer { display: none; }
}
