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

:root {
  --bg: #0f0f13;
  --surface: #1a1a24;
  --surface2: #22222f;
  --border: #2e2e40;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --text: #e2e2f0;
  --text-muted: #8888aa;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Navbar ──────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.nav-back {
  color: var(--text);
  text-decoration: none;
  opacity: 0.8;
}
.nav-back:hover { opacity: 1; }

.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-user { color: var(--text-muted); font-size: 0.85rem; }

/* ── Container ───────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }
.btn-full { width: 100%; justify-content: center; }

/* ── Auth pages ──────────────────────────────────────── */
body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}

.auth-logo { font-size: 2.5rem; text-align: center; margin-bottom: 0.5rem; }
.auth-card h1 { text-align: center; font-size: 1.5rem; }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 2rem; }

/* ── Forms ───────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.form-group input, .url-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus, .url-input:focus { border-color: var(--accent); }

/* ── Alerts ──────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }

/* ── Page header ─────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-header h2 { font-size: 1.4rem; }

/* ── Add form ────────────────────────────────────────── */
.add-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 2rem;
}
.add-form {
  display: flex;
  gap: 0.75rem;
}
.url-input { flex: 1; }

/* ── Artist grid ─────────────────────────────────────── */
.artist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.artist-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s, transform 0.15s;
}
.artist-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.artist-link { display: block; text-decoration: none; color: inherit; }

.artist-image {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.artist-image img { width: 100%; height: 100%; object-fit: cover; }
.image-placeholder { font-size: 3rem; opacity: 0.4; }

.artist-info { padding: 1rem; }
.artist-name { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.4rem; }
.artist-url { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.4rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-events { background: rgba(124,58,237,0.2); color: #c4b5fd; }
.badge-pending { background: rgba(234,179,8,0.15); color: #fcd34d; }

.btn-delete {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0,0,0,0.5);
  border: none;
  color: var(--text-muted);
  border-radius: 999px;
  width: 26px;
  height: 26px;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.artist-card:hover .btn-delete { opacity: 1; }
.btn-delete:hover { color: var(--danger); }

/* ── Empty state ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-hint { font-size: 0.85rem; margin-top: 0.4rem; }

/* ── Artist hero ─────────────────────────────────────── */
.artist-hero {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}
.artist-hero-image {
  width: 180px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.artist-hero-info h1 { font-size: 1.6rem; margin-bottom: 0.5rem; }
.eventim-link { color: var(--accent); text-decoration: none; font-size: 0.875rem; }
.eventim-link:hover { text-decoration: underline; }
.scraped-at { color: var(--text-muted); font-size: 0.8rem; margin: 0.75rem 0; }

/* ── Section title ───────────────────────────────────── */
.section-title { font-size: 1.1rem; margin-bottom: 1rem; }

/* ── Events table ────────────────────────────────────── */
.events-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.events-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.events-table th {
  background: var(--surface2);
  padding: 0.7rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.events-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
}
.events-table tr:last-child td { border-bottom: none; }
.events-table tr:hover td { background: rgba(255,255,255,0.02); }

.date-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.event-link { color: var(--accent); text-decoration: none; font-size: 0.8rem; }
.event-link:hover { text-decoration: underline; }

.avail-badge {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
}
.avail-badgeinstock { background: rgba(34,197,94,0.15); color: #86efac; }
.avail-badgelimitedavailability { background: rgba(234,179,8,0.15); color: #fcd34d; }
.avail-badgesoldout { background: rgba(239,68,68,0.15); color: #fca5a5; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
  .add-form { flex-direction: column; }
  .artist-hero { flex-direction: column; }
  .artist-hero-image { width: 100%; height: 160px; }
  .events-table th:nth-child(4),
  .events-table td:nth-child(4) { display: none; }
}

/* ── Seatmap ─────────────────────────────────────────── */
.btn-seatmap {
  background: none; border: none; cursor: pointer; font-size: 0.9rem;
  padding: 0 0.25rem; opacity: 0.7; transition: opacity 0.15s;
}
.btn-seatmap:hover { opacity: 1; }
.seatmap-cell { min-width: 220px; }
.seatmap-loading { color: var(--text-muted); font-size: 0.8rem; }
.seatmap-error { color: #fca5a5; font-size: 0.75rem; }
.seatmap-result { font-size: 0.8rem; }
.sm-totals { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.3rem; flex-wrap: wrap; }
.sm-stat { font-weight: 600; font-size: 0.8rem; }
.sm-stat.sold { color: #fca5a5; }
.sm-stat.free { color: #86efac; }
.sm-stat.total { color: var(--text-muted); font-weight: 400; }
.sm-pct { background: rgba(124,58,237,0.2); color: #c4b5fd; padding: 0.1rem 0.4rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.sm-cats { display: flex; flex-direction: column; gap: 0.25rem; }
.sm-cat { display: flex; align-items: center; gap: 0.4rem; }
.sm-cat-name { font-size: 0.72rem; color: var(--text-muted); min-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-bar-wrap { background: rgba(255,255,255,0.05); border-radius: 3px; height: 6px; width: 60px; flex-shrink: 0; }
.sm-bar { height: 6px; border-radius: 3px; transition: width 0.3s; }
.sm-cat-stats { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.sm-stat.held { color: #fcd34d; }
.sm-section-label { font-size: 0.68rem; color: var(--text-muted); margin: 0.3rem 0 0.1rem; text-transform: uppercase; letter-spacing: 0.05em; }
