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

/* ── Brand tokens: Dark (default) ── */
:root {
  --bg:           #1E1208;
  --sidebar:      #251509;
  --panel:        #3D2410;
  --border:       #5A3820;
  --accent:       #C8871E;
  --accent-dim:   #A66912;
  --accent-glow:  rgba(200, 135, 30, 0.15);
  --text:         #F4E8C8;
  --text-muted:   #8A6535;
  --text-dim:     #C09050;
  --btn-text:     #3D2817;
  --error:        #E05050;
  --success:      #5CB85C;
  --overlay-bg:   rgba(30, 18, 8, 0.8);
  --logo-bg:        #C8871E;
  --logo-text:      #F4E8C8;
  --logo-accent:    #3D2817;
  --logo-pin-light: #F4E8C8;
  --logo-pin-dark:  #3D2817;
  --radius:       8px;
  --sidebar-w:    340px;
}

/* ── Brand tokens: Light ── */
html.light {
  --bg:           #FAF3E3;
  --sidebar:      #F0E6CE;
  --panel:        #E8D8B8;
  --border:       #D4B880;
  --accent:       #A66912;
  --accent-dim:   #8A5610;
  --accent-glow:  rgba(166, 105, 18, 0.12);
  --text:         #3D2817;
  --text-muted:   #8A6540;
  --text-dim:     #5A3820;
  --btn-text:     #FAF3E3;
  --error:        #C03030;
  --success:      #407840;
  --overlay-bg:   rgba(250, 243, 227, 0.85);
  --logo-bg:        #FAF3E3;
  --logo-text:      #3D2817;
  --logo-accent:    #A66912;
  --logo-pin-light: #F4E8C8;
  --logo-pin-dark:  #C8871E;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  transition: background 0.2s, color 0.2s;
}

#layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── Header / Logo ── */
header {
  position: relative;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

#site-logo {
  width: 100%;
  display: block;
  vertical-align: top;
  cursor: pointer;
}

/* ── Logo hover animation (driven by JS rAF) ─────── */
#logo-shadow {
  transition: opacity 0.3s ease-out;
}

#theme-toggle {
  flex-shrink: 0;
  width: 36px;
  border-radius: 0;
  border: none;
  border-left: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
#theme-toggle:hover { color: var(--text); background: var(--accent-glow); }
#theme-toggle svg { width: 14px; height: 14px; }

/* Show sun in dark mode (click → go light), moon in light mode (click → go dark) */
.icon-moon { display: none; }
.icon-sun  { display: block; }
html.light .icon-moon { display: block; }
html.light .icon-sun  { display: none; }

/* ── Mode tabs ── */
#mode-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.mode-tab {
  flex: 1;
  padding: 10px 2px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.mode-tab:hover { color: var(--text-dim); }
.mode-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Panels ── */
.panel, .mode-panel {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.panel-desc {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

/* ── Inputs ── */
.input-row { display: flex; gap: 6px; }

input[type="text"] {
  flex: 1;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]::placeholder { color: var(--text-muted); }
input[type="text"]:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ── Buttons ── */
.btn-icon {
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: var(--btn-text);
  cursor: pointer;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.btn-icon:hover { opacity: 0.85; }
.btn-icon svg { width: 16px; height: 16px; }

.btn-location {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  padding: 9px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-location:hover { border-color: var(--accent-dim); color: var(--text); }
.btn-location svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-location.active { border-color: var(--accent); color: var(--accent); }

.btn-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}
.btn-clear:hover { color: var(--error); }

.btn-find {
  margin: 16px;
  padding: 12px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: var(--btn-text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
  letter-spacing: 0.2px;
}
.btn-find:hover:not(:disabled) { opacity: 0.85; }
.btn-find:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Divider ── */
.divider-or {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  margin: 10px 0;
}
.divider-or::before, .divider-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Status ── */
.status-msg {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  min-height: 16px;
}
.status-msg.ok  { color: var(--success); }
.status-msg.err { color: var(--error); }

/* ── Dropdown ── */
.dropdown {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 6px;
  overflow: hidden;
  max-height: 300px;
  overflow-y: auto;
}

.dropdown-msg {
  padding: 12px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.beer-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.beer-option:last-child { border-bottom: none; }
.beer-option:hover { background: var(--accent-glow); }

.beer-option img {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}

.beer-option-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.beer-option-meta {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Selected item ── */
.selected-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-top: 8px;
}

.selected-item img {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}

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

#selected-beer-name, #selected-brewery-name {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#selected-beer-meta, #selected-brewery-meta {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Style chips ── */
#style-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.style-chip {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.style-chip:hover  { background: var(--accent-glow); border-color: var(--accent-dim); color: var(--accent); }
.style-chip.active { background: var(--accent-glow); border-color: var(--accent);     color: var(--accent); }

/* ── Venue panel ── */
#venue-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-bottom: none;
}

#venue-panel-header {
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

#venue-count { font-weight: 700; font-size: 13px; color: var(--accent); }
#venue-note  { font-size: 11px; color: var(--text-muted); }

#venue-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
}

.venue-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.venue-item:hover  { background: var(--accent-glow); }
.venue-item.active { background: var(--accent-glow); border-left: 3px solid var(--accent); }

.venue-name    { font-weight: 600; font-size: 13px; color: var(--text); margin-bottom: 3px; }
.venue-address { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }

.venue-distance {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-glow);
  border-radius: 4px;
  padding: 1px 6px;
}

.venue-checkin { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ── Map ── */
#map-container { flex: 1; position: relative; }
#map { width: 100%; height: 100%; }

#map-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
}

#map-message {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
  max-width: 300px;
  line-height: 1.6;
}

/* ── Legal footer ── */
#legal-links {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
#legal-links a {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
#legal-links a:hover { color: var(--text-dim); }
#legal-links .legal-sep { font-size: 11px; color: var(--border); }


/* ── Utility ── */
.hidden { display: none !important; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Responsive ── */
@media (max-width: 640px) {
  #layout { flex-direction: column; }
  #sidebar { width: 100%; max-height: 55vh; flex-shrink: 0; }
  #map-container { flex: 1; }
  #venue-panel { max-height: 200px; }
}

/* ── Google Maps InfoWindow overrides ── */
.gm-style .gm-style-iw-c {
  padding: 0 !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35) !important;
}
.gm-style .gm-style-iw-d {
  overflow: visible !important;
  padding: 0 !important;
  max-height: none !important;
}
.gm-style .gm-style-iw {
  padding: 0 !important;
  overflow: visible !important;
}
/* Close button: small × tucked flush into top-right corner */
.gm-style button.gm-ui-hover-effect {
  top: 2px !important;
  right: 2px !important;
  width: 20px !important;
  height: 20px !important;
  opacity: 0.4 !important;
}
.gm-style button.gm-ui-hover-effect:hover { opacity: 0.8 !important; }
.gm-style button.gm-ui-hover-effect span {
  width: 10px !important;
  height: 10px !important;
  margin: 5px !important;
}
