:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --border: #2d3a4f;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #f5a623;
  --accent-dim: #c4841c;
  --green: #3dd68c;
  --red: #f07178;
  --blue: #6cb6ff;
  --radius: 12px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.header {
  background: linear-gradient(135deg, #1a2332 0%, #0f1419 100%);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand { display: flex; align-items: center; gap: 1rem; }
.brand-icon { font-size: 2rem; }
.brand h1 { font-size: 1.35rem; font-weight: 700; }
.subtitle { color: var(--muted); font-size: 0.85rem; }

.status-pills { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pill {
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
}
.pill-ok { border-color: var(--green); color: var(--green); }
.pill-warn { border-color: var(--accent); color: var(--accent); }
.pill-bad { border-color: var(--red); color: var(--red); }
.pill-loading { color: var(--muted); }

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }
  .results-panel { grid-column: 1 / -1; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.panel h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.panel-header h2 { margin-bottom: 0; }

.scrape-form { display: flex; flex-direction: column; gap: 1rem; }
.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  font-weight: 500;
}
.field input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.15);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field-grow { grid-column: span 1; }
@media (min-width: 600px) {
  .field-row:has(.field-grow) { grid-template-columns: 2fr 1fr; }
}
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

.optional-url {
  font-size: 0.85rem;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
}
.optional-url summary { cursor: pointer; user-select: none; }
.optional-url[open] summary { margin-bottom: 0.25rem; }

.discover-preview {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
}
.discover-preview a { color: var(--blue); }

.checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.checkboxes input { margin-right: 0.4rem; accent-color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  color: #1a1200;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-dim); color: #fff; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

.btn-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #1a1200;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.hidden { display: none !important; }
@keyframes spin { to { transform: rotate(360deg); } }

.progress-box { margin-top: 1rem; }
.progress-bar {
  height: 6px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.progress-fill {
  height: 100%;
  width: 30%;
  background: var(--accent);
  border-radius: 999px;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { width: 20%; margin-left: 0; }
  50% { width: 60%; margin-left: 20%; }
}
#progressText { font-size: 0.85rem; color: var(--muted); }

.search-input {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  min-width: 140px;
}

.brewery-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 420px; overflow-y: auto; }
.brewery-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.brewery-card:hover { border-color: var(--accent); background: var(--surface2); }
.brewery-card h3 { font-size: 0.95rem; font-weight: 600; }
.brewery-card p { font-size: 0.8rem; color: var(--muted); margin-top: 0.15rem; }
.brewery-meta { text-align: right; font-size: 0.75rem; color: var(--muted); }
.brewery-meta strong { display: block; color: var(--accent); font-size: 0.85rem; }

.muted { color: var(--muted); font-size: 0.9rem; }

.results-content { display: flex; flex-direction: column; gap: 1.25rem; }

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.result-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}
.result-card h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.75rem;
  font-weight: 600;
}
.result-card ul { list-style: none; }
.result-card li {
  font-size: 0.88rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}
.result-card li:last-child { border-bottom: none; }
.result-card a { color: var(--blue); text-decoration: none; }
.result-card a:hover { text-decoration: underline; }

.tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--surface2);
  color: var(--muted);
  margin-right: 0.35rem;
}

.rating-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
}
.rating-val { font-weight: 600; color: var(--green); font-family: var(--mono); }

.beer-table, .event-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.beer-table th, .event-table th {
  text-align: left;
  padding: 0.5rem;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.beer-table td, .event-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.beer-table tr:hover td, .event-table tr:hover td { background: var(--surface2); }

.footer {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.footer a { color: var(--blue); text-decoration: none; }

.error-box {
  background: rgba(240, 113, 120, 0.1);
  border: 1px solid var(--red);
  color: var(--red);
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.social-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.social-links a {
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  background: var(--surface2);
  border-radius: 6px;
  color: var(--blue);
  text-decoration: none;
}

/* Brewery hero + logo */
.brewery-hero {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.brewery-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  padding: 6px;
  flex-shrink: 0;
}
.brewery-logo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: var(--surface2);
}
.brewery-hero-text h3 { font-size: 1.4rem; margin-bottom: 0.25rem; }
.brewery-website { color: var(--blue); font-size: 0.85rem; text-decoration: none; }
.brewery-website:hover { text-decoration: underline; }
.coords { font-family: var(--mono); font-size: 0.8rem; margin-top: 0.25rem; }

.description-card .description-text {
  font-size: 0.95rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

/* Map */
.map-card { grid-column: 1 / -1; }
.brewery-map {
  height: 360px;
  border-radius: 8px;
  border: 1px solid var(--border);
  z-index: 1;
}

/* Ratings */
.ratings-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.rating-card {
  background: var(--surface2);
  border-radius: 8px;
  padding: 0.75rem;
}
.rating-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}
.rating-source {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  font-weight: 600;
}
.rating-link { font-size: 0.75rem; color: var(--blue); text-decoration: none; }
.rating-score {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--green);
}
.rating-max { font-size: 0.9rem; color: var(--muted); font-weight: 400; }
.rating-pct { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.35rem; }
.rating-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.35rem 0;
}
.rating-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 999px;
}
.rating-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Locations */
.locations-list { list-style: none; }
.location-item {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.location-item:last-child { border-bottom: none; }
.loc-address, .loc-phone { margin-top: 0.25rem; }
.loc-hours, .loc-coords { font-size: 0.8rem; margin-top: 0.15rem; }
.loc-map-link {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--blue);
  text-decoration: none;
}

/* Beer grid */
.beer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.beer-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.beer-card:hover { border-color: var(--accent); }
.beer-img {
  width: 100%;
  height: 160px;
  object-fit: contain;
  background: #fff;
  display: block;
}
.beer-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: var(--surface2);
}
.beer-img.img-error { display: none; }
.beer-body { padding: 0.85rem; }
.beer-body h4 { font-size: 0.95rem; margin-bottom: 0.25rem; }
.beer-style { font-size: 0.8rem; color: var(--accent); margin-bottom: 0.35rem; }
.beer-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.beer-rating { color: var(--green); font-family: var(--mono); }
.beer-desc {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
  margin: 0.35rem 0;
}
