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

:root {
  --brand:      #2563eb;
  --brand-dark: #1d4ed8;
  --bg:         #f8fafc;
  --surface:    #ffffff;
  --border:     #e2e8f0;
  --text:       #1e293b;
  --muted:      #64748b;
  --tag-bg:     #eff6ff;
  --tag-text:   #1d4ed8;
  --radius:     8px;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ───────────────────────────────────────────────────── */
header {
  background: var(--brand);
  color: #fff;
  padding: 1.25rem 1rem;
}
.header-inner { max-width: 900px; margin: 0 auto; }
header h1 a { color: #fff; font-size: 1.6rem; font-weight: 700; }
.tagline { font-size: .9rem; opacity: .85; margin-top: .2rem; }

/* ── Ad banners ───────────────────────────────────────────────── */
.ad-banner {
  max-width: 900px;
  margin: .75rem auto;
  min-height: 90px;
  background: var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: .8rem;
}

/* ── Main layout ──────────────────────────────────────────────── */
main { max-width: 900px; margin: 0 auto; padding: 0 1rem 2rem; }

/* ── Search ───────────────────────────────────────────────────── */
.search-bar { margin: 1.25rem 0 .75rem; }
#searchInput {
  width: 100%;
  padding: .75rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s;
}
#searchInput:focus { border-color: var(--brand); }

/* ── Filters ──────────────────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.filter-group { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.filter-group label { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.filter-buttons { display: flex; flex-wrap: wrap; gap: .35rem; }
.filter-btn {
  padding: .3rem .75rem;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  font-size: .82rem;
  cursor: pointer;
  color: var(--muted);
  transition: all .15s;
}
.filter-btn:hover { border-color: var(--brand); color: var(--brand); }
.filter-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ── Results meta ─────────────────────────────────────────────── */
.results-meta { font-size: .85rem; color: var(--muted); margin-bottom: .75rem; }

/* ── API Cards ────────────────────────────────────────────────── */
.results { display: flex; flex-direction: column; gap: .75rem; }

.api-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  transition: box-shadow .15s;
}
.api-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }

.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.card-title { font-size: 1.05rem; font-weight: 600; }
.card-provider { font-size: .82rem; color: var(--muted); margin-top: .1rem; }
.card-description { font-size: .88rem; color: var(--muted); margin: .5rem 0; }

.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: .75rem;
  font-weight: 500;
  padding: .15rem .6rem;
  border-radius: 99px;
}
.tag.auth-tag { background: #f0fdf4; color: #15803d; }
.tag.sector-tag { background: #fef9c3; color: #92400e; }

.card-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.btn {
  padding: .4rem .9rem;
  border-radius: var(--radius);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .15s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }

/* ── No results ───────────────────────────────────────────────── */
.empty { text-align: center; color: var(--muted); padding: 3rem 0; font-size: .95rem; }
.loading { color: var(--muted); font-size: .95rem; }

/* ── Modal ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 680px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  padding: 1.5rem;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none; font-size: 1.2rem;
  cursor: pointer; color: var(--muted);
}
.modal h2 { font-size: 1.2rem; margin-bottom: .25rem; }
.modal .provider { color: var(--muted); font-size: .85rem; margin-bottom: 1rem; }

.modal section { margin-top: 1.25rem; }
.modal section h3 { font-size: .9rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .5rem; }

.auth-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .88rem;
}
.auth-box strong { display: block; margin-bottom: .25rem; color: #15803d; }

.sample-request { margin-bottom: 1rem; }
.sample-request h4 { font-size: .88rem; font-weight: 600; margin-bottom: .35rem; }
.sample-request p { font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }

.curl-block {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-family: 'Courier New', monospace;
  font-size: .78rem;
  overflow-x: auto;
  white-space: pre;
  position: relative;
}
.copy-btn {
  position: absolute; top: .5rem; right: .5rem;
  background: #334155; color: #e2e8f0;
  border: none; border-radius: 4px;
  padding: .2rem .55rem; font-size: .72rem;
  cursor: pointer;
}
.copy-btn:hover { background: #475569; }

.postman-steps { list-style: none; counter-reset: steps; }
.postman-steps li {
  counter-increment: steps;
  padding: .4rem 0 .4rem 2rem;
  position: relative;
  font-size: .88rem;
  border-bottom: 1px solid var(--border);
}
.postman-steps li:last-child { border-bottom: none; }
.postman-steps li::before {
  content: counter(steps);
  position: absolute; left: 0;
  background: var(--brand); color: #fff;
  width: 1.3rem; height: 1.3rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700;
  top: .45rem;
}

/* ── Footer ───────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem;
  font-size: .82rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  .card-header { flex-direction: column; }
}
