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

:root {
  --warm-50: #fdf8f0;
  --warm-100: #f7ede0;
  --warm-200: #eedcc2;
  --warm-300: #e2c49a;
  --warm-400: #d4a66e;
  --warm-500: #c4884a;
  --warm-600: #a06830;
  --warm-700: #7a4e24;
  --warm-800: #5c3a1c;
  --warm-900: #3d2612;
  --warm-950: #251709;
  --ember: #e8632b;
  --ember-light: #f4a261;
  --ash: #6b6560;
  --smoke: #9c9590;
  --text: #2c2420;
  --text-secondary: #6b6560;
  --bg: #faf6f1;
  --card-bg: #ffffff;
  --card-border: #eedcc2;
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar-w: 380px;
}

html, body { height: 100%; font-size: 15px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--card-border);
  z-index: 200;
  transition: transform 0.3s ease;
}

.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-w)));
  min-width: 0;
  width: 0;
}

.sidebar-header {
  padding: 1.25rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--card-border);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-icon { font-size: 1.5rem; }

.brand h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--warm-900);
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.8rem;
  color: var(--smoke);
  margin-top: 0.2rem;
}

.brand-sub span { font-weight: 600; color: var(--ember); }

/* Sidebar controls */
.sidebar-controls {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}

.sidebar-controls input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--card-bg);
  color: var(--text);
  transition: border-color 0.2s;
}

.sidebar-controls input:focus {
  outline: none;
  border-color: var(--ember);
}

.sidebar-controls input::placeholder { color: var(--smoke); }

.filter-section { display: flex; flex-wrap: wrap; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; }

.chip {
  padding: 0.25rem 0.55rem;
  border: 1.5px solid var(--card-border);
  border-radius: 16px;
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.chip:hover { border-color: var(--warm-400); color: var(--text); }

.chip.active {
  background: var(--warm-900);
  border-color: var(--warm-900);
  color: #fff;
}

.chip.toggle.active {
  background: var(--ember);
  border-color: var(--ember);
  color: #fff;
}

/* Pub list */
.pub-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.pub-item {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--warm-100);
}

.pub-item:last-child { border-bottom: none; }

.pub-item:hover { background: var(--warm-100); }

.pub-item.active { background: var(--warm-200); }

.pub-item-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.pub-item-img {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.pub-item-info { flex: 1; min-width: 0; }

.pub-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.4rem;
}

.pub-item-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--warm-900);
  line-height: 1.3;
}

.pub-item-fires {
  font-size: 0.75rem;
  color: var(--ember);
  flex-shrink: 0;
  white-space: nowrap;
}

.pub-item-area {
  font-size: 0.75rem;
  color: var(--smoke);
  margin-top: 0.1rem;
}

.pub-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-top: 0.35rem;
}

.pub-item-tag {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: var(--warm-50);
  color: var(--ash);
}

/* Sidebar footer */
.sidebar-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--card-border);
  flex-shrink: 0;
}

.sidebar-footer p {
  font-size: 0.7rem;
  color: var(--smoke);
  line-height: 1.4;
}

/* Map */
.map-container {
  flex: 1;
  position: relative;
}

#map { width: 100%; height: 100%; }

.sidebar-toggle {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1000;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.sidebar-toggle:hover { background: var(--warm-100); }

/* Leaflet popup override */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius) !important;
  box-shadow: 0 4px 20px rgba(60, 40, 20, 0.15) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  font-family: 'Inter', -apple-system, sans-serif !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  max-width: 300px;
  min-width: 240px;
}

.popup-inner { padding: 1rem; }

.popup-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--warm-900);
  margin-bottom: 0.15rem;
}

.popup-name a {
  color: inherit;
  text-decoration: none;
}

.popup-name a:hover { color: var(--ember); }

.popup-area {
  font-size: 0.8rem;
  color: var(--smoke);
  margin-bottom: 0.5rem;
}

.popup-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.popup-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.popup-tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--warm-50);
  border: 1px solid var(--warm-200);
  color: var(--warm-700);
}

.popup-tag.fire {
  background: #fff3ec;
  border-color: var(--ember-light);
  color: var(--ember);
}

/* Responsive */
@media (max-width: 768px) {
  .layout {
    flex-direction: column-reverse;
  }

  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    min-width: 100vw;
    height: 55vh;
    max-height: 55vh;
    border-right: none;
    border-top: 2px solid var(--card-border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    transform: translateY(0);
    z-index: 300;
    transition: transform 0.3s ease, height 0.3s ease;
  }

  .sidebar.collapsed {
    transform: translateY(calc(100% - 60px));
  }

  .sidebar.collapsed .pub-list,
  .sidebar.collapsed .sidebar-controls,
  .sidebar.collapsed .sidebar-footer {
    display: none;
  }

  .sidebar-header {
    cursor: pointer;
    padding: 0.75rem 1.25rem;
  }

  .sidebar-header::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--warm-300);
    border-radius: 2px;
    margin: 0 auto 0.5rem;
  }

  .map-container {
    height: 100vh;
    width: 100vw;
  }

  #map { height: 100vh; }

  .sidebar-toggle {
    display: none;
  }

  .pub-grid { grid-template-columns: 1fr; }
}
