/* style.css — Shared styles for public map and admin panel */

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  color: #222;
  background: #f5f5f5;
}

/* ── Site header (public map only) ────────────────────────────────────────── */
#site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e2d47;
  color: #fff;
  padding: 6px 18px;
  position: relative;
  z-index: 1000;
  flex-shrink: 0;
}

#header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

#header-logo {
  height: 100px;
  width: 100px;
  object-fit: contain;
  flex-shrink: 0;
}

#site-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

#subtitle {
  font-size: 0.78rem;
  opacity: 0.8;
  margin-top: 2px;
}

#visit-counter {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(255,255,255,0.15);
  padding: 6px 12px;
  border-radius: 20px;
}

#visited-count {
  font-size: 1.4rem;
  font-weight: 700;
}

#counter-label {
  font-size: 0.8rem;
  opacity: 0.85;
  margin-left: 4px;
}

/* ── Map wrapper (positioning context for search + legend) ─────────────────── */
#map-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
}

/* ── Map container ───────────────────────────────────────────────────────────── */
#map {
  width: 100%;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Legend ────────────────────────────────────────────────────────────────── */
#legend {
  position: absolute;
  bottom: 28px;
  right: 12px;
  z-index: 1000;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  padding: 10px 14px;
  font-size: 0.82rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.legend-item:last-child { margin-bottom: 0; }

.legend-swatch {
  display: inline-block;
  width: 18px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.2);
}

.visited-swatch        { background: #FFD700; }
.unvisited-swatch      { background: #aaaaaa; }
/* LEGEND COLORS — to update map colors, edit the fillColor values in js/map.js (STYLE_QUEUED, STYLE_PRE_CHALLENGE) */
.queued-swatch         { background: #FF8C00; }
.pre-challenge-swatch  { background: #9C59B6; }

/* ── Legend toggle switch ──────────────────────────────────────────────────── */
#legend-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.toggle-label {
  font-size: 0.82rem;
  color: #333;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #ccc;
  border-radius: 18px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: #1e2d47;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

.legend-divider {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 0 0 8px;
}

.legend-detail {
  display: none;
}

/* ── Popup styles ──────────────────────────────────────────────────────────── */
.ejc-popup .leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.popup-content {
  min-width: 200px;
}

.popup-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0;
  color: #1e2d47;
}

.ejc-popup .popup-county {
  font-size: 0.78rem;
  color: #666;
  margin: 0 0 6px;
}

.popup-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 8px;
  margin-bottom: 8px;
}

.visited-badge {
  background: #fff9c4;
  color: #7a6000;
}

.queued-badge {
  background: #ffe0b2;
  color: #8d4600;
}

.pre-challenge-badge {
  background: #f3e5f5;
  color: #6a1b9a;
}

/* ── Popup visit info block ────────────────────────────────────────────────── */
.popup-visit-info {
  background: #f9f9f9;
  border-left: 3px solid #FFD700;
  border-radius: 0 4px 4px 0;
  padding: 6px 10px;
  margin-bottom: 10px;
  font-size: 0.82rem;
}

.popup-visit-number {
  font-weight: 700;
  color: #1e2d47;
}

.popup-restaurant {
  color: #333;
  margin-top: 2px;
}

.popup-date {
  color: #666;
  font-style: italic;
  margin-top: 1px;
}

/* ── Popup links — grouped by category ────────────────────────────────────── */
.popup-links-container {
  margin-top: 6px;
}

.popup-link-section {
  margin-bottom: 8px;
}
.popup-link-section:last-child { margin-bottom: 0; }

.popup-section-heading {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin-bottom: 3px;
}

.popup-content-heading {
  font-size: 0.78rem;
  font-weight: 600;
  color: #555;
  margin-top: 4px;
  margin-bottom: 2px;
  padding-left: 4px;
}

.popup-links {
  list-style: none;
  margin-top: 0;
}

.popup-links li {
  margin-bottom: 3px;
  padding-left: 8px;
}

.popup-links a {
  color: #1565c0;
  text-decoration: none;
  font-size: 0.85rem;
  word-break: break-word;
}
.popup-links a:hover { text-decoration: underline; }

.popup-no-links {
  font-size: 0.82rem;
  color: #888;
  font-style: italic;
}

/* ── Social platform icon row ──────────────────────────────────────────────── */
.popup-platform-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 2px 0 8px 4px;
}

.popup-platform-icons a {
  color: #555;
  font-size: 1.3rem;
  line-height: 1;
  text-decoration: none;
  transition: color 0.15s ease;
}

.popup-platform-icons a[data-platform="instagram"]:hover { color: #E1306C; }
.popup-platform-icons a[data-platform="tiktok"]:hover    { color: #010101; }
.popup-platform-icons a[data-platform="youtube"]:hover   { color: #FF0000; }
.popup-platform-icons a[data-platform="threads"]:hover   { color: #000000; }
.popup-platform-icons a[data-platform="bluesky"]:hover   { color: #0085FF; }
.popup-platform-icons a[data-platform="facebook"]:hover  { color: #1877F2; }

/* ── Popup thumbnail ────────────────────────────────────────────────────────── */
.popup-thumbnail-wrapper {
  position: relative;
  display: block;
  margin-bottom: 8px;
  min-height: 160px;
}

.popup-thumbnail {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 0;
}

/* ── Thumbnail social-icon overlay (beta) ──────────────────────────────────── */
.popup-thumbnail-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 0;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 0 0 4px 4px;
}

.popup-thumbnail-overlay a {
  color: #ffffff;
  font-size: 1.7rem;
  line-height: 1;
  text-decoration: none;
  transition: color 0.2s ease;
}

.popup-thumbnail-overlay a[data-platform="instagram"]:hover { color: #E1306C; }
.popup-thumbnail-overlay a[data-platform="tiktok"]:hover    { color: #cccccc; }
.popup-thumbnail-overlay a[data-platform="youtube"]:hover   { color: #FF0000; }
.popup-thumbnail-overlay a[data-platform="threads"]:hover   { color: #cccccc; }
.popup-thumbnail-overlay a[data-platform="bluesky"]:hover   { color: #0085FF; }
.popup-thumbnail-overlay a[data-platform="facebook"]:hover  { color: #1877F2; }

/* ── Search toggle button ──────────────────────────────────────────────────── */
#search-toggle {
  position: absolute;
  top: 75px;
  left: 12px;
  z-index: 1001;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #1e2d47;
  transition: background 0.15s;
}
#search-toggle:hover { background: #e8f5e9; }
#search-toggle[aria-expanded="true"] { background: #d0e8d2; }

/* ── Search drawer ─────────────────────────────────────────────────────────── */
#search-drawer {
  position: absolute;
  top: 75px;
  left: 12px;
  z-index: 1001;
  width: 280px;
  max-height: calc(100vh - 100px);
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(0);
  opacity: 1;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

#search-drawer.search-drawer-closed {
  transform: translateX(-110%);
  opacity: 0;
  pointer-events: none;
}

#search-drawer-header {
  padding: 10px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

#search-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 0.88rem;
}
#search-input:focus { outline: 2px solid #4CAF50; border-color: transparent; }

#search-results {
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  margin: 0;
  padding: 0;
}

.search-result-item {
  padding: 8px 12px;
  font-size: 0.84rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  line-height: 1.3;
  transition: background 0.1s;
}
.search-result-item:hover { background: #e8f5e9; }

.search-result-county {
  font-size: 0.72rem;
  color: #888;
  margin-left: 4px;
}

/* ── Search drawer responsive ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  #search-drawer {
    width: calc(100vw - 24px);
  }
}

@media (min-width: 481px) and (max-width: 768px) {
}

/* ── Shared form/error utilities ───────────────────────────────────────────── */
.form-error {
  color: #c62828;
  font-size: 0.82rem;
  margin-top: 6px;
}
