/* חיפוש תבניות ויחסים — the builder's third screen (qbpat.js). It borrows the
   builder's own cards, chips, buttons and colours (qb.css); only what is new to
   this screen is here, all of it under .qp-root, .qp-modal or a qp- class. */

.qp-root{ display:block; --bar:#2e61b8; --bar-muted:#c3c9d6; --grid:#e3e7f1; }
.qp-lead{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:8px; }
.qp-lead > .qb-sub{ flex:1 1 240px; font-size:14px; }

.qp-card .qb-scope-row > label{ min-width:116px; }
.qp-count{ display:inline-flex; align-items:center; gap:6px; flex-wrap:wrap; }
.qp-feat{ display:inline-flex; align-items:center; gap:6px; flex-wrap:wrap; min-width:0; }
.qp-mini{ display:inline-flex; align-items:center; gap:4px; color:var(--muted); font-size:13px; }
.qp-root .qp-mini input[type=number]{ width:58px; }
.qp-root input.qp-pat{ width:96px; font-family:ui-monospace,Menlo,Consolas,monospace; letter-spacing:.08em; text-transform:uppercase; }
.qp-list{ display:flex; flex-direction:column; gap:0; }
.qp-row{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding:6px 0; border-top:1px solid #edf0f6; }
.qp-row:first-child{ border-top:0; }
.qp-row .qb-x{ margin-inline-start:auto; }
.qp-row .qb-val{ flex:1 1 110px; min-width:90px; max-width:220px; }
.qp-dot{ display:inline-block; width:12px; height:12px; border-radius:50%; background:var(--qbc,#888); flex:0 0 auto; }

/* a value the engine discovers, against a value the reader types */
.qp-kind{ display:inline-flex; align-items:center; gap:5px; border-radius:999px; padding:2px 10px; font-size:12.5px; font-weight:700;
  white-space:nowrap; cursor:help; }
.qp-kind::before{ content:''; width:8px; height:8px; border-radius:50%; background:currentColor; }
.qp-kind.dyn{ background:#e8f0fd; color:#1e4fa3; border:1px dashed #9db7e6; }
.qp-kind.fix{ background:#f1efe6; color:#5d5330; border:1px solid #d8d2b8; }
.qp-kind.fix::before{ border-radius:2px; }

.qp-check{ display:inline-flex; align-items:center; gap:7px; padding:5px 0; font-size:14.5px; cursor:pointer; }
.qp-check input{ width:18px; height:18px; flex:0 0 auto; }
.qp-check.off{ color:var(--muted); cursor:default; }
.qp-opt{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding:5px 0; border-top:1px solid #edf0f6; }
.qp-opt.on{ background:#f6f8fc; border-radius:8px; padding:6px 8px; }

/* the numbered words of a pattern, drawn */
.qp-slots{ display:flex; gap:6px; flex-wrap:wrap; margin:8px 0 2px; }
.qp-slot{ display:flex; flex-direction:column; align-items:center; min-width:44px; padding:4px 8px; border-radius:9px;
  border:2px solid var(--qbc,#888); background:color-mix(in srgb, var(--qbc,#888) 9%, #fff); }
.qp-slot b{ font-size:13px; color:#39425f; }
.qp-slot i{ font-style:normal; font-weight:800; font-size:18px; color:var(--qbc,#333); font-family:ui-monospace,Menlo,Consolas,monospace; }

.qp-sum ol{ list-style:none; padding:0; }
.qp-sum li{ padding-inline-start:14px; position:relative; }
.qp-sum li::before{ content:''; position:absolute; inset-inline-start:2px; top:.72em; width:5px; height:5px; border-radius:50%; background:var(--accent); }

/* ── results ─────────────────────────────────────────────────────────────── */
.qp-legend{ display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin:6px 0 8px; font-size:13.5px; }
.qp-legend > .k{ color:var(--muted); }
.qp-val{ display:inline-flex; align-items:baseline; gap:3px; border-radius:8px; padding:2px 9px; font-size:14px;
  background:color-mix(in srgb, var(--qbc,#888) 11%, #fff); border:1px solid color-mix(in srgb, var(--qbc,#888) 38%, #fff); color:#1c2233; }
.qp-val .k{ color:#5a6079; font-size:12.5px; }
.qp-val b{ font-weight:800; unicode-bidi:isolate; }
.qp-val .qp-dot{ align-self:center; width:10px; height:10px; margin-inline-end:3px; }

.qp-res{ border:1px solid var(--line); border-radius:12px; background:#fff; padding:10px 12px; margin-bottom:9px; }
.qp-res-head{ display:flex; align-items:flex-start; gap:10px; flex-wrap:wrap; margin-bottom:4px; }
.qp-num{ flex:0 0 auto; min-width:30px; height:26px; padding:0 7px; border-radius:7px; background:#eef2fb; color:var(--navy); font-weight:800; font-size:13.5px;
  display:inline-flex; align-items:center; justify-content:center; font-variant-numeric:tabular-nums; }
.qp-place{ display:flex; align-items:baseline; gap:4px 12px; flex-wrap:wrap; flex:1 1 200px; min-width:0; }
.qp-ref{ border:0; background:none; padding:0; color:var(--accent); font:inherit; font-weight:800; font-size:15.5px; cursor:pointer;
  text-decoration:underline; text-underline-offset:3px; }
.qp-where{ color:#39425f; font-size:13px; }
.qp-where .k{ color:#7b8298; }
.qp-where.warn{ color:#8a5a00; }

.qp-verse{ font-family:'Hebrew',serif; font-size:calc(21px + var(--qbz,0px)); line-height:1.9; margin:2px 0; overflow-wrap:anywhere; }
.qp-verse[dir=ltr]{ font-family:'Translit',serif; font-size:calc(18px + var(--qbz,0px)); }
.qp-vn{ display:inline-block; font-family:system-ui,sans-serif; font-size:11.5px; font-weight:700; color:#fff; background:#7c88a8; border-radius:4px;
  padding:0 6px; margin-inline-end:6px; vertical-align:middle; line-height:1.6; }
.qp-skip{ color:var(--muted); font-size:12.5px; text-align:center; }
.qp-plain, .qp-hit{ border:0; background:none; padding:0; margin:0; font:inherit; color:inherit; cursor:pointer; border-radius:5px; }
.qp-plain{ color:#6b7187; }
.qp-plain:hover{ background:#f0f3fa; color:#1c2233; }
.qp-plain.dim{ cursor:default; color:#c3c8d6; }
.qp-plain.sam, .qp-word.sam{ font-family:'Samaritan',serif; font-size:1.12em; }
.qp-hit{ display:inline-flex; flex-direction:column; align-items:center; vertical-align:top; padding:0 3px; color:#141414;
  background:#f6f4ea; box-shadow:inset 0 -2px 0 #b9b08c; }
.qp-hit:hover{ background:#efeacc; }
.qp-word{ unicode-bidi:isolate; white-space:nowrap; }
.qp-word.whole{ box-shadow:0 2px 0 var(--qbc); }
/* a letter (or a sound) that answers a condition wears the condition's colour */
.qp-l{ color:var(--qbc); font-weight:700; background:color-mix(in srgb, var(--qbc) 16%, #fff); border-radius:3px; box-shadow:inset 0 -2px 0 var(--qbc); }
.qp-lat{ font-family:'Translit',serif; font-style:italic; font-size:.62em; line-height:1.25; color:#555; unicode-bidi:isolate; direction:ltr; white-space:nowrap; }
.qp-verse[dir=ltr] .qp-lat{ font-size:1em; color:#222; }
.qp-plain.fits{ color:#17603a; font-weight:700; cursor:default; }
.qp-plain.miss{ color:#8a1f1f; background:#fdecec; text-decoration:underline wavy #c0392b; text-underline-offset:5px; cursor:default; }

.qp-vals{ display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin-top:6px; }
.qp-res-foot{ display:flex; gap:8px; flex-wrap:wrap; margin-top:6px; }
.qp-res-foot .qb-link{ padding:4px 10px; font-size:13px; }
.qp-grouphead{ display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin:14px 0 6px; padding-bottom:4px; border-bottom:2px solid var(--line); }
.qp-grouphead .qp-val{ font-size:15.5px; }

.qp-detail-wrap{ overflow-x:auto; margin-top:8px; border:1px solid #e3e7f1; border-radius:8px; }
table.qp-detail{ width:100%; border-collapse:collapse; font-size:13.5px; }
.qp-detail th{ background:#eef2fb; color:var(--navy); font-weight:700; padding:5px 8px; text-align:start; white-space:nowrap; }
.qp-detail td{ padding:5px 8px; border-top:1px solid #e9ecf4; vertical-align:middle; }
.qp-detail td .qp-word{ font-family:'Hebrew',serif; font-size:18px; }
.qp-detail td.qp-latc{ font-family:'Translit',serif; font-style:italic; unicode-bidi:isolate; }
.qp-detail tr.bad td{ background:#fdf3f3; }

.qp-bar.pick{ cursor:pointer; }
.qp-bar.pick:hover .qb-bar-lab{ text-decoration:underline; }
.qp-bar.on .qb-bar-lab{ font-weight:800; color:var(--navy); }
.qp-bar.on .qb-bar-track i{ background:var(--navy); }
.qp-export{ justify-content:flex-end; }

/* two versions side by side */
.qp-cols{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.qp-col{ border:1px solid #e3e7f1; border-radius:10px; padding:8px 10px; min-width:0; background:#fcfcfa; }
.qp-col.other{ background:#f8f9fc; }
.qp-colname{ font-size:12px; font-weight:700; color:#fff; background:#7c88a8; border-radius:5px; padding:0 8px; display:inline-block; margin-bottom:2px; }
.qp-pair.both{ border-inline-start:5px solid #1e8a4c; }
.qp-pair.only{ border-inline-start:5px solid #d99a00; }

.qp-help p{ margin:0 0 8px; line-height:1.6; }

@media (max-width:720px){
  .qp-card .qb-scope-row > label{ min-width:0; flex:1 1 100%; }
  .qp-row{ gap:6px; }
  .qp-feat{ flex:1 1 100%; }
  .qp-feat select.qb-field{ flex:1 1 0; min-width:0; }
  .qp-cols{ grid-template-columns:1fr; }
  .qp-res{ padding:9px 9px; }
  .qp-verse{ font-size:calc(20px + var(--qbz,0px)); }
  .qp-export{ justify-content:flex-start; }
  .qp-export .qb-chip{ flex:1 1 auto; text-align:center; }
  .qp-check input{ width:20px; height:20px; }
  .qp-check{ min-height:40px; }
}
@media print{
  #qbPrint .qp-res{ break-inside:avoid; border-color:#bbb; }
  #qbPrint .qp-res-foot, #qbPrint .qp-export{ display:none; }
  #qbPrint .qp-plain, #qbPrint .qp-hit, #qbPrint .qp-ref{ cursor:default; }
}

/* gematria: the group's words added up */
.qp-gem-in{ flex:1 1 180px; min-width:120px; max-width:340px; }
.qp-gem-live{ color:#1a3873; font-weight:700; font-variant-numeric:tabular-nums; white-space:nowrap; }
.qp-gem-live.warn{ color:#8a5a00; font-weight:400; }
.qp-gem-sum{ font-variant-numeric:tabular-nums; unicode-bidi:isolate; }
