/* Konfigurator i wyszukiwarka produktów.
 *
 * Kolory i promienie bierzemy ze zmiennych z style.css — panel ma wyglądać
 * jak jedna aplikacja, a nie jak doklejona zakładka.
 */

/* ── Wspólne drobiazgi ──────────────────────────────────────────────────── */

.hint { color: var(--muted); font-size: 13px; line-height: 1.55; margin: 0 0 14px; }
.hint.tiny { font-size: 12px; margin: 6px 0 0; }
.hint a { text-decoration: underline; }
.page-cfg .card > .hint:first-child { margin-top: 0; }
.page-cfg .filters .grow { grid-column: span 2; }

.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.step-no {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 800;
  background: var(--green2); color: var(--green); border: 1px solid #276a98;
}

/* Uwaga: te dwie reguły ZMIENIAJĄ globalny wygląd karty, więc obowiązują
 * wyłącznie w obrębie `.page-cfg`. Bez tego zakresu doklejony padding
 * rozjechałby tabele na stronach logów, alertów i transferu. */
.page-cfg .card { padding: 20px; }
.page-cfg .card .table-wrap { margin: 0 -20px -20px; }

.kw-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.kw-status { font-size: 12px; color: var(--muted); }
.kw-status.is-warn { color: var(--amber); }

/* Przełącznik dwustanowy (konto / lista wspólna). */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg-btn {
  background: transparent; color: var(--muted); border: 0; cursor: pointer;
  padding: 0 16px; font-size: 13px; font-weight: 650; white-space: nowrap;
}
.seg-btn:hover { color: var(--text); background: var(--panel2); }
.seg-btn.is-active { background: var(--green2); color: var(--green); }

/* ── Pola konfiguracji ──────────────────────────────────────────────────── */

.field-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field > label { font-size: 13px; font-weight: 650; color: var(--text); }
.field input[type="text"], .field input[type="number"], .field select {
  width: 100%; background: #0e151d; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--green); }
.req {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--amber); font-weight: 700; margin-left: 4px;
}

.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; cursor: pointer; }
.switch input { width: auto; min-height: 0; accent-color: var(--green); }

.check-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.check-item {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 10px;
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
  background: #0e151d; cursor: pointer; font-size: 13px;
}
.check-item.is-on { border-color: #276a98; background: var(--green2); }
.check-item input { width: auto; min-height: 0; accent-color: var(--green); }
.check-item em { grid-column: 2; font-style: normal; font-size: 11px; color: var(--muted); }

/* ── Lista reguł ────────────────────────────────────────────────────────── */

.builder-split { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 20px; }
.rule-list { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rule-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }

.rule {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  border: 1px solid var(--line); border-radius: 10px; background: #0e151d; overflow: hidden;
}
.rule.is-active { border-color: var(--green); background: var(--green2); }
.rule.is-off { opacity: .5; }
.rule-pick {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  background: transparent; border: 0; color: var(--text); cursor: pointer;
  padding: 10px 12px; text-align: left; min-width: 0; width: 100%;
}
.rule-pick strong { font-size: 13px; }
.rule-pick span {
  font-size: 11px; color: var(--muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.rule-tools { display: flex; padding-right: 6px; }
.rule-tools button {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  min-height: 30px; padding: 0 5px; font-size: 13px; border-radius: 6px;
}
.rule-tools button:hover { color: var(--text); background: #ffffff10; }

/* ── Edytor reguły ──────────────────────────────────────────────────────── */

.rule-editor {
  border: 1px solid var(--line); border-radius: 12px; background: #0e151db0;
  padding: 18px; min-width: 0;
}
.editor-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.sub-head {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--green); font-weight: 800; margin: 22px 0 8px;
  padding-top: 16px; border-top: 1px solid var(--line);
}

.kw-group { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 9px; }
.kw-group-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; font-size: 11px; color: var(--muted); margin-bottom: 8px;
}
.link-btn {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  font-size: 11px; text-decoration: underline; min-height: 0; padding: 2px 0;
}
.link-btn:hover { color: var(--red); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 6px 5px 12px; font-size: 12px; color: #d5e2ec;
}
.chip button {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  min-height: 0; width: 18px; height: 18px; border-radius: 50%; padding: 0; line-height: 1;
}
.chip button:hover { background: #7c3138; color: #fff; }
.chip-input {
  flex: 1 1 170px; min-width: 150px; background: transparent; border: 1px dashed var(--line);
  border-radius: 999px; padding: 6px 12px; color: var(--text); outline: none; font-size: 12px;
  min-height: 32px;
}
.chip-input:focus { border-color: var(--green); border-style: solid; }

.tiers { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.tier {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted);
}
.tier input {
  width: 110px; background: #0e151d; color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; outline: none; min-height: 36px;
}

/* ── Podgląd trafień ────────────────────────────────────────────────────── */

.preview-badge {
  font-size: 12px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--muted);
}
.preview-badge.is-ok { border-color: #276a98; background: var(--green2); color: var(--green); }
.preview-badge.is-warn { border-color: #6b5320; background: #2a2113; color: var(--amber); }

.preview-box { margin-top: 18px; }
.preview-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.preview-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.preview-list li {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  font-size: 12px; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #0b1119;
}
.pl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-price { color: var(--muted); white-space: nowrap; }

/* ── Werdykt walidacji ──────────────────────────────────────────────────── */

.verdict {
  border: 1px solid var(--line); border-radius: 10px; padding: 13px 16px;
  margin: 14px 0; font-size: 13px; line-height: 1.6;
}
.verdict ul { margin: 7px 0 0; padding-left: 20px; }
.verdict.is-good { border-color: #276a98; background: var(--green2); color: #b9dcf7; }
.verdict.is-bad { border-color: #73343a; background: #251416; color: #ffb3b8; }
.verdict.is-warn { border-color: #6b5320; background: #2a2113; color: #f2d79a; }

/* ── Wyszukiwarka produktów ─────────────────────────────────────────────── */

.id-copy {
  font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 7px;
  color: #d5e2ec; padding: 5px 9px; cursor: pointer; min-height: 32px;
}
.id-copy:hover { border-color: var(--green); color: var(--green); }
.id-copy.is-done { border-color: var(--green); background: var(--green2); color: var(--green); }

@media (max-width: 950px) {
  .builder-split { grid-template-columns: 1fr; }
  .rules { max-height: 260px; overflow: auto; }
}
