/* ============================================================
   OdpisKRS.pl - WYSZUKIWARKA (/szukaj)
   Tylko style specyficzne dla układu strony wyników. Tokeny,
   chrome, atomy (.btn/.badge/.num/.mono) pochodzą z app.css.
   Hairline-siatka, ostre rogi, tabular-nums, polska czerwień.
   ============================================================ */

.search-page { display: block; }

/* ---------- HERO / pasek wyszukiwania ---------- */
.search-hero {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.search-hero .wrap { padding: 2.6rem 0 2.8rem; }
.search-hero .eyebrow { margin-bottom: 1rem; }
.search-title {
  font-family: var(--font-sans); font-weight: 700;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  letter-spacing: -.02em; line-height: 1.08; color: var(--ink);
  text-wrap: balance;
}
.search-lead {
  margin-top: .7rem; max-width: 60ch;
  font-size: .96rem; color: var(--ink-2);
}

/* ---------- formularz ---------- */
.search-form { margin-top: 1.8rem; }
.search-label {
  display: block; margin-bottom: .6rem;
  font-family: var(--font-mono); font-size: .66rem; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3);
}
.search-box {
  display: flex; align-items: stretch; gap: 0;
  border: 1.5px solid var(--ink); background: var(--paper);
  transition: box-shadow .2s ease;
}
.search-box:focus-within { box-shadow: 0 0 0 3px var(--red-wash); }
.search-icon {
  flex: none; display: grid; place-items: center;
  width: 3rem; color: var(--ink-3); border-right: 1px solid var(--line);
}
.search-input-wrap { position: relative; flex: 1; min-width: 0; }
.search-input-wrap input {
  width: 100%; height: 100%;
  padding: 1.05rem 1.1rem;
  font-family: var(--font-sans); font-size: 1rem; color: var(--ink);
  background: transparent; border: 0;
}
.search-input-wrap input::placeholder { color: var(--ink-3); }
.search-input-wrap input:focus { outline: 0; }
.search-btn {
  flex: none; border: 0; border-left: 1.5px solid var(--red);
}

/* ---------- autocomplete (z prototypu home) ---------- */
.ac-list {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 50;
  margin-top: -1.5px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  display: none;
  box-shadow: 0 28px 60px -30px rgba(23, 23, 27, .5);
}
.ac-list.open { display: block; }
.ac-head {
  font-family: var(--font-mono); font-size: .62rem; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3);
  padding: .65rem 1.15rem .5rem; border-bottom: 1px solid var(--line-2);
  background: var(--paper-2);
}
.ac-opt {
  display: flex; align-items: baseline; gap: 1rem;
  padding: .78rem 1.15rem; cursor: pointer; text-decoration: none;
  border-bottom: 1px solid var(--line-2);
  transition: background-color .15s ease;
}
.ac-opt:last-child { border-bottom: 0; }
.ac-opt .ac-name { font-family: var(--font-sans); font-weight: 600; font-size: .92rem; color: var(--ink); flex: 1; min-width: 0; }
.ac-opt .ac-krs { font-family: var(--font-mono); font-size: .74rem; font-weight: 500; color: var(--red); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ac-opt .ac-city { font-family: var(--font-mono); font-size: .74rem; color: var(--ink-3); white-space: nowrap; }
.ac-opt:hover, .ac-opt.active { background: var(--red-wash); }
.ac-opt.active { box-shadow: inset 3px 0 0 var(--red); }
.ac-opt mark { background: transparent; color: var(--red); font-weight: 700; }

/* ---------- stan początkowy (pusty $q) ---------- */
.search-intro { padding: 2.6rem 0 3.4rem; }
.intro-panel {
  border: 1px solid var(--line); border-top: 2px solid var(--red);
  background: var(--paper); padding: 1.8rem 1.9rem; max-width: 70ch;
}
.intro-lead { font-size: 1rem; color: var(--ink); font-weight: 500; }
.intro-tips { list-style: none; margin: 1.2rem 0 0; padding: 0; border-top: 1px solid var(--line-2); }
.intro-tips li {
  padding: .7rem 0; border-bottom: 1px solid var(--line-2);
  font-size: .92rem; color: var(--ink-2);
}
.intro-tips li b { color: var(--ink); }
.intro-alt { margin-top: 1.3rem; font-size: .92rem; color: var(--ink-2); }
.intro-alt a {
  color: var(--red); text-decoration: none;
  border-bottom: 1px solid rgba(192, 18, 40, .35);
  transition: border-color .2s ease, color .2s ease;
}
.intro-alt a:hover { color: var(--red-dk); border-color: var(--red-dk); }

/* ---------- stan pusty (brak wyników) ---------- */
.search-empty { padding: 3rem 0 3.6rem; }
.empty-panel {
  border: 1px solid var(--line); background: var(--paper-3);
  padding: 2.6rem 2rem; text-align: center; max-width: 60ch; margin: 0 auto;
}
.empty-mark { font-family: var(--font-mono); font-size: 3.4rem; font-weight: 600; color: var(--line-3); line-height: 1; }
.empty-title { margin-top: 1rem; font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; color: var(--ink); text-wrap: balance; }
.empty-hint { margin-top: .8rem; font-size: .94rem; color: var(--ink-2); }
.empty-hint b { color: var(--ink); }
.search-empty .intro-alt { margin-top: 1.4rem; }

/* ---------- wyniki ---------- */
.search-results { padding: 2.4rem 0 3.6rem; }
.results-head { padding-bottom: 1.1rem; border-bottom: 1px solid var(--line); margin-bottom: .2rem; }
.results-title { font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.results-title .num { color: var(--red); }
.results-sub { margin-top: .35rem; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }

/* tabela wyników - hairline, w stylu kartoteki KRS */
.results-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.results-table th {
  text-align: left; font-family: var(--font-mono); font-size: .62rem; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
  padding: .7rem .9rem .7rem 0; border-bottom: 1px solid var(--line);
}
.results-table td {
  padding: .85rem .9rem .85rem 0; border-bottom: 1px solid var(--line-2);
  vertical-align: baseline;
}
.results-table tbody tr { transition: background-color .18s ease; }
.results-table tbody tr:hover { background: var(--paper-2); }
.res-link {
  font-family: var(--font-sans); font-weight: 600; font-size: .96rem; color: var(--ink);
  text-decoration: none; line-height: 1.3;
  border-bottom: 1px solid transparent; transition: color .18s ease, border-color .18s ease;
}
.res-link:hover { color: var(--red); border-color: var(--red); }
.c-krs .mono { color: var(--red); font-weight: 500; }
.results-table .muted { color: var(--ink-3); }
.c-loc .loc-city { display: block; color: var(--ink); }
.c-loc .loc-woj { display: block; font-family: var(--font-mono); font-size: .72rem; color: var(--ink-3); margin-top: .1rem; }
.c-pkd .pkd-code { color: var(--ink); font-weight: 500; }
.c-pkd .pkd-desc { display: block; font-size: .8rem; color: var(--ink-2); margin-top: .12rem; max-width: 28ch; }

/* ---------- paginacja ---------- */
.pager {
  margin-top: 2.2rem; padding-top: 1.4rem; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.pg-link {
  font-family: var(--font-mono); font-size: .78rem; font-weight: 500; letter-spacing: .02em;
  text-decoration: none; color: var(--ink-2);
  padding: .55rem .9rem; border: 1px solid var(--line);
  transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}
.pg-link:hover { color: var(--ink); border-color: var(--ink-3); }
.pg-link.is-disabled { color: var(--line-3); border-color: var(--line-2); pointer-events: none; }
.pg-nums { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.pg-num {
  display: inline-grid; place-items: center; min-width: 2.2rem; height: 2.2rem; padding: 0 .5rem;
  font-family: var(--font-mono); font-size: .82rem; font-weight: 500;
  text-decoration: none; color: var(--ink-2); border: 1px solid var(--line);
  transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}
.pg-num:hover { color: var(--ink); border-color: var(--ink-3); }
.pg-num.is-current { color: #fff; background: var(--red); border-color: var(--red); font-weight: 600; }
.pg-gap { font-family: var(--font-mono); font-size: .82rem; color: var(--ink-3); padding: 0 .2rem; }

/* ---------- responsywność ---------- */
@media (max-width: 720px) {
  .search-box { flex-wrap: wrap; }
  .search-icon { display: none; }
  .search-input-wrap { flex: 1 1 100%; }
  .search-btn { flex: 1 1 100%; border-left: 0; border-top: 1.5px solid var(--red); justify-content: center; }

  .results-table thead { display: none; }
  .results-table, .results-table tbody, .results-table tr, .results-table td { display: block; width: 100%; }
  .results-table tr {
    border: 1px solid var(--line); padding: .9rem 1rem; margin-bottom: .8rem; background: var(--paper);
  }
  .results-table tr:hover { background: var(--paper-2); }
  .results-table td { border: 0; padding: .25rem 0; }
  .results-table td.c-name { padding-bottom: .5rem; }
  .results-table td::before {
    content: attr(data-label); display: block;
    font-family: var(--font-mono); font-size: .58rem; letter-spacing: .12em;
    text-transform: uppercase; color: var(--ink-3); margin-bottom: .15rem;
  }
  .c-pkd .pkd-desc { max-width: none; }
  .pager { justify-content: center; }
  .pg-link.pg-prev, .pg-link.pg-next { flex: 1 1 100%; text-align: center; order: 3; }
}
