:root {
  --red:        #d00000;
  --red-dark:   #9b0000;
  --red-light:  #ff4444;
  --red-tint:   #fff4f4;
  --red-border: #ffd0d0;

  --chapter-accent: #b00020;
  --region-accent:  #e53030;

  --text:       #111827;
  --text-sub:   #374151;
  --text-muted: #6b7280;

  --bg:         #f3f4f8;
  --surface:    #ffffff;
  --surface-2:  #f9fafb;
  --border:     #e5e7eb;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 28px rgba(0,0,0,.10), 0 4px 10px rgba(0,0,0,.05);

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Header ─────────────────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, var(--red-light) 0%, var(--red) 45%, var(--red-dark) 100%);
  padding: 0;
  box-shadow: 0 4px 20px rgba(150, 0, 0, 0.30);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.bni-logo {
  width: 200px;
  height: auto;
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 6px 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
  flex-shrink: 0;
}

.header-copy h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}

.header-copy p {
  margin: 3px 0 0;
  font-size: 0.9rem;
  color: rgba(255,255,255,.82);
}

/* ── Page wrapper ───────────────────────────────────────── */
.page-content {
  max-width: 1200px;
  margin: 32px auto 60px;
  padding: 0 20px;
}

/* ── Empty state ────────────────────────────────────────── */
.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 56px 28px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.empty-state h2 {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.empty-state p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Region block ───────────────────────────────────────── */
.region-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  margin-bottom: 28px;
  overflow: hidden;
}

/* block header bar */
.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.block-title {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.block-title h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.slug-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--red-tint);
  color: var(--red-dark);
  border: 1px solid var(--red-border);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  width: fit-content;
}

.block-stats {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.stat-pill.regions {
  background: #fff5f0;
  color: #b84000;
  border-color: #ffd9c2;
}

.stat-pill.chapters {
  background: var(--red-tint);
  color: var(--red-dark);
  border-color: var(--red-border);
}

.stat-pill strong {
  font-size: 1rem;
  font-weight: 700;
}

/* block body */
.block-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Panel (Regions / Chapters) ─────────────────────────── */
.list-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.panel-icon.region-icon {
  background: #fff0eb;
}

.panel-icon.chapter-icon {
  background: var(--red-tint);
}

.panel-icon svg {
  width: 17px;
  height: 17px;
}

.panel-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.panel-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ── Cards grid ─────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.empty-label {
  color: var(--text-muted);
  font-size: 0.87rem;
  padding: 10px 0;
  margin: 0;
}

/* ── Card ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 100px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.card-region::before { background: var(--region-accent); }
.card-chapter::before { background: var(--chapter-accent); }

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--red-border);
}

.card-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.card h4 {
  margin: 0;
  font-size: 0.93rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  flex: 1;
}

.card-cta {
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--red);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-cta::after {
  content: '→';
  font-size: 0.9em;
  transition: transform 0.15s ease;
}

.card:hover .card-cta::after {
  transform: translateX(3px);
}

/* ── Search bar ─────────────────────────────────────────── */
.search-bar-wrap {
  background: rgba(0,0,0,.18);
  border-top: 1px solid rgba(255,255,255,.12);
  padding: 10px 24px 12px;
}

.search-bar {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 17px;
  height: 17px;
  color: rgba(255,255,255,.6);
  pointer-events: none;
  flex-shrink: 0;
}

#searchInput {
  width: 100%;
  padding: 10px 100px 10px 42px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
}

#searchInput::placeholder { color: rgba(255,255,255,.55); }

#searchInput:focus {
  background: rgba(255,255,255,.22);
  border-color: rgba(255,255,255,.5);
}

/* hide native clear button in webkit */
#searchInput::-webkit-search-cancel-button { display: none; }

.search-clear {
  position: absolute;
  right: 72px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  color: #fff;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.search-clear:hover { background: rgba(255,255,255,.35); }

.search-clear svg {
  width: 13px;
  height: 13px;
}

.search-count {
  position: absolute;
  right: 14px;
  display: none;
  align-items: center;
  background: rgba(255,255,255,.22);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}

/* highlight matches */
mark {
  background: rgba(255, 230, 100, 0.55);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 720px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .block-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .block-stats {
    flex-wrap: wrap;
  }

  .block-body {
    padding: 16px;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .search-bar-wrap {
    padding: 8px 16px 10px;
  }
}
