/* Built for a narrow window docked next to Mishloha. City and street sit side
   by side with their copy button under each, and the delivery panel keeps a
   fixed place below them -- an answer that appears and vanishes is one the
   agent has to hunt for while a customer waits. Everything fits one screen. */

:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #16191d;
  --muted: #6b7280;
  --line: #d8dbe0;
  --focus: #1f6feb;

  --go: #0f8a3d;
  --go-bg: #e6f5ec;
  --stop: #c62828;
  --stop-bg: #fdeaea;
  --warn: #b45309;
  --warn-bg: #fdf3e3;
}

* { box-sizing: border-box; }

/* An explicit `display` on a rule like #result beats the UA stylesheet's
   [hidden] { display: none }, which silently leaves "hidden" panels on screen.
   This has to win. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.35 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 12px;
  background: var(--ink);
  color: #fff;
}
header h1 { margin: 0; font-size: 12px; letter-spacing: .1em; }
#hint { font-size: 10px; color: #9aa3ad; letter-spacing: .04em; }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

/* ---- the two search columns ---- */

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: start;
}

/* Each column is its own stacking context so a dropdown cannot push the other
   column's copy button out of line. */
.col { position: relative; display: flex; flex-direction: column; }

label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

input {
  width: 100%;
  padding: 7px 10px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 6px;
}
input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, .18);
}
input:disabled { background: #eceef1; color: var(--muted); }

/* ---- result lists ---- */

/* Floated over what follows, so opening a list never moves the copy buttons. */
.results {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 5;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .16);
}
.results:empty { display: none; }

.results li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 9px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom: none;
  cursor: pointer;
}
.results li:first-child { border-radius: 6px 6px 0 0; }
.results li:last-child { border-bottom: 1px solid var(--line); border-radius: 0 0 6px 6px; }
.results li[aria-selected="true"] { background: #e8f0fe; border-color: var(--focus); }

/* The Latin label matches the Hebrew in size and weight. The agent cannot read
   the Hebrew at all -- the transliteration is the half of the row she actually
   uses to tell five results apart, so it must not be the faint one. */
.results .he { direction: rtl; font-size: 16px; font-weight: 600; }
.results .en { font-size: 16px; font-weight: 600; color: var(--ink); }

.weak {
  margin-top: 3px;
  padding: 4px 8px;
  background: var(--warn-bg);
  border: 1px solid var(--warn);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--warn);
}

/* Always occupies its line, empty or not, so the copy button below it never
   moves as the agent picks and re-picks. Empty it stays quiet -- green here
   means "this is the Hebrew you are about to copy". */
.picked {
  margin-top: 4px;
  padding: 4px 9px;
  /* Fixed, not min-: an empty box and a filled one must be exactly the same
     height, or the copy button under it shifts the moment she picks. */
  height: 32px;
  line-height: 22px;
  overflow: hidden;
  background: var(--go-bg);
  border: 1px solid #bfe0cb;
  border-radius: 6px;
  font-size: 17px;
  font-weight: 600;
}
.picked:empty { background: transparent; border-color: var(--line); }

.col .btn { margin-top: 5px; }

/* ---- delivery information ---- */

#result {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px 11px 10px;
}

#result h2 {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}

.empty { margin: 0; padding: 6px 0; font-size: 13px; color: var(--muted); }

.status {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .03em;
  text-align: center;
}
.status.delivery     { background: var(--go-bg);   color: var(--go);   border: 2px solid var(--go); }
.status.no_delivery  { background: var(--stop-bg); color: var(--stop); border: 2px solid var(--stop); }
.status.check_branch { background: var(--warn-bg); color: var(--warn); border: 2px solid var(--warn); }

.facts {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1px 12px;
  font-size: 13px;
}
.facts:empty { display: none; }
.facts:not(:empty) { margin-top: 6px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.branch-option { padding: 1px 0; }
.branch-terms { font-size: 12px; color: var(--muted); }

.result-note { margin-top: 5px; font-size: 12px; color: var(--warn); }

.kind {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--warn);
}

/* ---- branch rules ---- */

#branchRules {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

#branchRulesSummary {
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--muted);
  cursor: pointer;
}
#branchRulesSummary:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }

#branchRulesList {
  list-style: none;
  margin: 0;
  padding: 0 10px 7px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#branchRulesList li { font-size: 13px; }

.rule-kind {
  display: inline-block;
  margin-inline-end: 5px;
  padding: 0 5px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .05em;
  vertical-align: 1px;
  white-space: nowrap;
}
.rule-kind.stop { background: var(--stop-bg); color: var(--stop); }
.rule-kind.warn { background: var(--warn-bg); color: var(--warn); }

/* ---- buttons ---- */

.btn {
  width: 100%;
  padding: 9px 10px;
  font: 700 12px/1 inherit;
  letter-spacing: .06em;
  color: var(--ink);
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: 6px;
  cursor: pointer;
}
.btn:hover { background: #eef0f3; }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:disabled:hover { background: var(--panel); }

.btn.copied {
  background: var(--go);
  border-color: var(--go);
  color: #fff;
}

.btn-ghost {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 11px;
  padding: 2px;
}
.btn-ghost:hover { background: none; text-decoration: underline; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --panel: #1c2024;
    --ink: #e8eaed;
    --muted: #9aa3ad;
    --line: #333a41;
    --go-bg: #12301f;
    --stop-bg: #35191a;
    --warn-bg: #33270f;
    --go: #4ade80;
    --stop: #f87171;
    --warn: #fbbf24;
  }
  header { background: #0d1013; }
  .btn { border-color: var(--line); }
  .btn:hover { background: #262c32; }
  .results li[aria-selected="true"] { background: #1e3050; }
  .picked { border-color: #235437; }
  input:disabled { background: #23282d; }
}
