/* SB Burger Week 2026 — Styles */

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

:root {
  --red: #e63946;
  --orange: #e76f51;
  --brown: #6b4226;
  --cream: #fdf0d5;
  --dark: #2b2b2b;
  --sidebar-width: 360px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--dark);
  color: var(--dark);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────── */

header {
  background: var(--dark);
  color: var(--cream);
  padding: 10px 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 1000;
  position: relative;
  border-bottom: 3px solid var(--red);
  flex-shrink: 0;
}

header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

header h1 span {
  color: var(--orange);
  font-weight: 400;
  margin-left: 6px;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

header a {
  color: var(--orange);
  text-decoration: none;
  font-size: 0.82rem;
  white-space: nowrap;
}

header a:hover {
  text-decoration: underline;
}

.attribution {
  font-size: 0.82rem;
  color: #999;
}

.attribution a {
  color: var(--orange);
  text-decoration: none;
}

.attribution a:hover {
  text-decoration: underline;
}

.github-icon {
  width: 0.9em;
  height: 0.9em;
  vertical-align: -0.1em;
}

.sidebar .attribution {
  padding: 12px 14px 16px;
  text-align: center;
  border-top: 1px solid #eee;
  background: #fafafa;
  flex-shrink: 0;
}

/* ── Layout ─────────────────────────────────── */

.app {
  display: flex;
  flex: 1;
  height: calc(100vh - 47px);
  height: calc(100dvh - 47px);
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-controls {
  padding: 10px 12px;
  border-bottom: 1px solid #e0e0e0;
  background: #fafafa;
}

.search-box {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
}

.search-box:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(230, 57, 70, 0.15);
}

.area-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.area-btn {
  padding: 4px 10px;
  border: 1px solid #ccc;
  border-radius: 14px;
  background: #fff;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.area-btn:hover {
  background: #f0f0f0;
}

.area-btn.active {
  color: #fff;
  border-color: transparent;
}

.area-btn[data-area="All"].active { background: var(--dark); }
.area-btn[data-area="Downtown SB"].active { background: #e63946; }
.area-btn[data-area="Goleta"].active { background: #2d6a4f; }
.area-btn[data-area="Carpinteria"].active { background: #1d3557; }
.area-btn[data-area="Isla Vista"].active { background: #7b2cbf; }
.area-btn[data-area="Santa Ynez"].active { background: #e76f51; }
.area-btn[data-area="Other SB"].active { background: #e07a5f; }

.restaurant-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  list-style: none;
}

.restaurant-item {
  padding: 10px 14px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 0.12s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.restaurant-item:hover {
  background: #fdf0d5;
}

.restaurant-item .name {
  font-size: 0.9rem;
  font-weight: 500;
}

.restaurant-item .area-badge {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
  flex-shrink: 0;
  margin-left: 8px;
}

.restaurant-count {
  padding: 6px 14px;
  font-size: 0.78rem;
  color: #888;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}

.no-results {
  padding: 24px 14px;
  text-align: center;
  color: #999;
  font-size: 0.9rem;
}

/* ── Map ────────────────────────────────────── */

#map {
  flex: 1;
  z-index: 1;
}

/* Burger icon overlay on selected marker */
.burger-icon-wrapper {
  background: none !important;
  border: none !important;
}

.burger-icon {
  font-size: 24px;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}

/* Popup styling */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
}

.popup-content h3 {
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--dark);
}


.popup-content p {
  font-size: 0.82rem;
  color: #555;
  margin-bottom: 2px;
}

.popup-content .popup-burger {
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 2px;
}

.popup-content .popup-description {
  margin-top: 0;
}

.directions-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.directions-links a {
  color: var(--red);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
}

.directions-links a:hover {
  text-decoration: underline;
}

.link-sep {
  color: #ccc;
  font-size: 0.8rem;
}

/* ── Mobile toggle button ───────────────────── */

.mobile-toggle {
  display: none;
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  background: var(--dark);
  color: var(--cream);
  border: 2px solid var(--red);
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}

/* ── Mobile ─────────────────────────────────── */

@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 55vh;
    z-index: 1050;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.25);
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateY(0);
  }

  .sidebar .drag-handle {
    display: block;
  }

  .mobile-toggle {
    display: block;
  }

  .sidebar.open ~ .mobile-toggle {
    display: none;
  }

  #map {
    width: 100%;
    height: calc(100vh - 47px);
    height: calc(100dvh - 47px);
  }

  header h1 {
    font-size: 1rem;
  }

}

/* Drag handle for mobile drawer */
.drag-handle {
  display: none;
  width: 40px;
  height: 5px;
  background: #ccc;
  border-radius: 3px;
  margin: 8px auto 4px;
  cursor: grab;
}

@media (max-width: 768px) {
  .drag-handle {
    display: block;
  }
}

/* ── Cluster tooltip ────────────────────────── */

.cluster-tooltip-wrapper {
  padding: 0;
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.cluster-tooltip {
  font-size: 0.82rem;
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
}

.cluster-tooltip div {
  padding: 2px 4px;
}

/* ── Marker Cluster overrides ───────────────── */

.marker-cluster-small {
  background-color: rgba(230, 57, 70, 0.25);
}

.marker-cluster-small div {
  background-color: rgba(230, 57, 70, 0.7);
  color: #fff;
}

.marker-cluster-medium {
  background-color: rgba(231, 111, 81, 0.25);
}

.marker-cluster-medium div {
  background-color: rgba(231, 111, 81, 0.7);
  color: #fff;
}

.marker-cluster-large {
  background-color: rgba(107, 66, 38, 0.25);
}

.marker-cluster-large div {
  background-color: rgba(107, 66, 38, 0.7);
  color: #fff;
}
