/* ============================================================
   Sietsema's NYC Restaurant Map — Warm Editorial Design
   ============================================================ */

/* --- Design tokens --- */
:root {
  --bg: #FAF7F2;
  --white: #FFFFFF;
  --burgundy: #8B2332;
  --burgundy-light: #A63446;
  --amber: #D4941A;
  --text: #1A1A1A;
  --muted: #6B6B6B;
  --light-gray: #E8E4DF;
  --blush: #F5EEED;
  --substack-orange: #FF6719;

  --price-cheap: #2D8B55;
  --price-mid: #D4941A;
  --price-high: #8B2332;
  --price-unknown: #9B9B9B;

  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --sidebar-width: 420px;
  --header-height: 56px;
  --filter-radius: 20px;
  --card-radius: 8px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
}

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

html, body {
  height: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- Header --- */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--light-gray);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.header-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--burgundy);
  letter-spacing: -0.02em;
}

.header-star {
  color: var(--amber);
  font-size: 18px;
}

.header-subtitle {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 400;
  color: var(--muted);
}

.header-right {
  display: flex;
  align-items: center;
}

.search-wrapper {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  font-family: var(--font-body);
  font-size: 13px;
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--light-gray);
  border-radius: var(--filter-radius);
  width: 280px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--burgundy);
  box-shadow: 0 0 0 3px rgba(139, 35, 50, 0.08);
}

.search-input::placeholder {
  color: var(--muted);
}

/* --- Main layout --- */
.main {
  position: fixed;
  top: var(--header-height);
  left: 0; right: 0; bottom: 0;
  display: flex;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--white);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--light-gray);
  overflow: hidden;
}

/* --- Filters --- */
.filters {
  flex-shrink: 0;
  border-bottom: 1px solid var(--light-gray);
  background: var(--white);
}

.filter-toggle {
  display: none; /* shown on mobile */
}

.filter-body {
  padding: 14px 16px 8px;
}

.filter-section {
  margin-bottom: 10px;
}

.filter-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

/* Cuisine pills */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.pill {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--filter-radius);
  border: 1px solid var(--light-gray);
  background: var(--white);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

.pill:hover {
  border-color: var(--burgundy);
  color: var(--burgundy);
}

.pill.pill-active {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: var(--white);
}

.pill-all {
  font-weight: 600;
}

/* Price & Borough toggles */
.toggle-group {
  display: flex;
  gap: 6px;
}

.toggle-btn {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: var(--filter-radius);
  border: 1px solid var(--light-gray);
  background: var(--white);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}

.toggle-btn:hover {
  border-color: var(--burgundy);
}

.toggle-btn.toggle-active {
  background: var(--text);
  border-color: var(--text);
  color: var(--white);
}

.price-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.price-dot.price-cheap  { background: var(--price-cheap); }
.price-dot.price-mid    { background: var(--price-mid); }
.price-dot.price-high   { background: var(--price-high); }
.price-dot.price-unknown { background: var(--price-unknown); }

.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checkbox-label {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--burgundy);
}

.reset-btn {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  color: var(--burgundy);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.reset-btn:hover {
  color: var(--burgundy-light);
}

/* Counter */
.counter {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 16px;
  border-top: 1px solid var(--light-gray);
  background: var(--bg);
}

/* --- Card list --- */
.card-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}

.card-list::-webkit-scrollbar {
  width: 6px;
}
.card-list::-webkit-scrollbar-track {
  background: transparent;
}
.card-list::-webkit-scrollbar-thumb {
  background: var(--light-gray);
  border-radius: 3px;
}
.card-list::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* --- Restaurant card --- */
.card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--light-gray);
  cursor: pointer;
  transition: background 0.15s ease;
  border-left: 3px solid transparent;
}

.card:hover {
  background: var(--blush);
}

.card.card-active {
  background: var(--blush);
  border-left-color: var(--burgundy);
}

.card-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}

.card-name {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-name .closed-badge {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  color: var(--price-high);
  background: rgba(139, 35, 50, 0.08);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}

.card-price {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.card-price[data-price="$"]    { color: var(--price-cheap); }
.card-price[data-price="$$"]   { color: var(--price-mid); }
.card-price[data-price="$$$"]  { color: var(--price-high); }
.card-price[data-price="unknown"] { color: var(--price-unknown); }

.card-rating {
  font-size: 12px;
  color: var(--amber);
  white-space: nowrap;
}

.card-cuisine {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}

.card-location {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}

.card-address {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.card-dishes {
  font-size: 12px;
  color: var(--text);
  font-style: italic;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-summary {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.card-mentions {
  color: var(--muted);
}

.card-link {
  color: var(--substack-orange);
  text-decoration: none;
  font-weight: 500;
}

.card-link:hover {
  text-decoration: underline;
}

/* --- Map --- */
.map-container {
  flex: 1;
  min-width: 0;
}

/* Leaflet overrides */
.leaflet-popup-content-wrapper {
  border-radius: var(--card-radius) !important;
  box-shadow: var(--shadow-md) !important;
  font-family: var(--font-body) !important;
}

.leaflet-popup-content {
  margin: 12px 14px !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
}

.popup-name {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.popup-cuisine {
  font-size: 12px;
  color: var(--muted);
}

.popup-address {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.popup-dishes {
  font-size: 12px;
  font-style: italic;
  margin-top: 4px;
}

.popup-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--substack-orange);
  text-decoration: none;
  font-weight: 500;
}

.popup-link:hover {
  text-decoration: underline;
}

/* MarkerCluster custom styling */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: rgba(139, 35, 50, 0.15) !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background: var(--burgundy) !important;
  color: var(--white) !important;
  font-family: var(--font-body) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

/* No results state */
.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.no-results-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.no-results h3 {
  font-family: var(--font-heading);
  font-size: 16px;
  color: var(--text);
  margin-bottom: 8px;
}

.no-results p {
  font-size: 13px;
}

/* ============================================================
   Responsive — Mobile (<=768px)
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
    --header-height: 50px;
  }

  .header-subtitle {
    display: none;
  }

  .header-title {
    font-size: 17px;
  }

  .search-input {
    width: 180px;
    font-size: 14px; /* prevent zoom on iOS */
  }

  .main {
    flex-direction: column-reverse;
  }

  .sidebar {
    width: 100%;
    min-width: 100%;
    height: 45vh;
    border-right: none;
    border-top: 1px solid var(--light-gray);
  }

  .map-container {
    height: 55vh;
    flex: none;
  }

  /* Filter toggle visible on mobile */
  .filter-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 16px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    background: var(--white);
    border: none;
    cursor: pointer;
  }

  .filter-chevron {
    transition: transform 0.2s;
  }

  .filter-toggle.filter-open .filter-chevron {
    transform: rotate(180deg);
  }

  .filter-body {
    display: none;
    padding: 8px 16px 12px;
  }

  .filter-body.filter-body-open {
    display: block;
  }

  .counter {
    font-size: 11px;
    padding: 6px 16px;
  }

  .card {
    padding: 10px 14px;
  }

  .card-summary {
    display: none;
  }

  .card-address {
    display: none;
  }
}

/* ============================================================
   Responsive — Small phones (<=480px)
   ============================================================ */
@media (max-width: 480px) {
  .search-input {
    width: 140px;
  }

  .pill {
    font-size: 11px;
    padding: 3px 8px;
  }

  .toggle-btn {
    font-size: 11px;
    padding: 3px 8px;
  }
}
