/* =========================================================
   Phieu dat ban (tao don) - ban mau. Dung lai .ticket / .seat-dialog /
   .stamp cua style.css; chi them phan rieng (tien to oc-).
   ========================================================= */

.oc-cta { margin-top: 1.5rem; }
.oc-open { font-size: var(--t-md); padding: 0.8rem 1.6rem; background: #f2c14e; color: var(--ink); }
.oc-open:hover { background: #f6cf6e; }
.oc-preview { margin-top: 1rem; font-size: var(--t-sm); color: var(--on-wall-muted); }
.oc-preview a { color: var(--on-wall); }

/* Phieu rong hon phieu don (21rem): co danh sach mon */
.oc-ticket {
  width: 34rem;
  max-width: 100%;
  margin-top: 10px;
  padding: 1.1rem 1.2rem 0;
  cursor: default;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (hover: hover) { .oc-ticket:hover { transform: none; } }
.oc-head { padding-right: 2rem; padding-bottom: 0.6rem; border-bottom: 1px dashed #b9bfc2; }

.oc-sec {
  margin: 0;
  padding: 0.85rem 0;
  border: 0;
  border-bottom: 1px dashed #b9bfc2;
  min-width: 0;
}
.oc-label {
  padding: 0;
  margin-bottom: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--muted);
}
.oc-note { margin-top: 0.5rem; color: var(--muted); font-size: 0.75rem; }

/* ---- nut +/- ---- */
.oc-step {
  width: 2.4rem; height: 2.4rem;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  font: inherit; font-size: 1.15rem; font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.oc-step:hover:not(:disabled) { background: #eceee9; }
.oc-step:disabled { opacity: 0.3; cursor: default; }
.oc-step-sm { width: 1.8rem; height: 1.8rem; font-size: 0.95rem; border-width: 1px; }

/* ---- so khach ---- */
.oc-party { display: flex; align-items: center; gap: 0.6rem; }
.oc-party-n {
  min-width: 2.2ch;
  text-align: center;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 2.4rem;
  line-height: 1;
}
.oc-party-note { margin-left: 0.4rem; line-height: 1.35; }
.oc-party-note small { color: var(--muted); font-size: 0.72rem; }

/* ---- gio toi ---- */
.oc-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.45rem; }
.oc-slot {
  display: flex; flex-direction: column; align-items: center;
  padding: 0.55rem 0.2rem;
  border: 1.5px solid #c9ced0;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
}
.oc-slot:hover { border-color: var(--ink); }
.oc-slot.is-on { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.oc-slot:focus-within { outline: 3px solid #f2c14e; outline-offset: 2px; }
.oc-slot-time { font-weight: 700; font-size: 1.05rem; }
.oc-slot-wait { font-size: 0.68rem; opacity: 0.75; }

/* ---- mon ---- */
.oc-search {
  width: 100%;
  margin-bottom: 0.4rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid #c9ced0;
  border-radius: 6px;
  background: #fff;
  font: inherit;
}
.oc-menu { list-style: none; margin: 0; padding: 0; max-height: 17rem; overflow-y: auto; }
.oc-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  column-gap: 0.7rem;
  padding: 0.3rem 0.25rem;
  border-radius: 4px;
}
.oc-item + .oc-item { border-top: 1px dotted #dde0e1; }
.oc-item.has-qty { background: #f3f1e4; }
/* da du 5 mon: mon chua chon mo di (van xem duoc, khong them duoc) */
.oc-item.is-locked { opacity: 0.45; }
/* bo dem "2/5 mon" canh tieu de Goi mon */
.oc-limit {
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #e6e9e8;
  color: var(--ink);
  letter-spacing: 0.02em;
  text-transform: none;
}
.oc-limit.is-full { background: #fbe7bb; color: #6b4a05; }
.oc-menu-rule { margin: 0 0 0.5rem; }
.oc-item-name { min-width: 0; overflow-wrap: anywhere; }
.oc-item.has-qty .oc-item-name { font-weight: 700; }
.oc-item-price { color: var(--muted); white-space: nowrap; }
.oc-qty { display: inline-flex; align-items: center; gap: 0.35rem; }
.oc-qty-n { min-width: 1.6ch; text-align: center; font-weight: 700; }
.oc-empty { padding: 0.6rem 0.25rem; color: var(--muted); }

/* ---- thu loi ---- */
.oc-test { border-bottom: 0; }
.oc-switch { display: flex; align-items: flex-start; gap: 0.5rem; cursor: pointer; }
.oc-switch input { margin-top: 0.2rem; accent-color: var(--fail); }
/* the thanh toan / muon bao lau */
.oc-sub { margin-top: 0.75rem; font-weight: 700; font-size: 0.75rem; }
.oc-sub small { font-weight: 400; color: var(--muted); }
.oc-seg { display: flex; gap: 0.45rem; margin-top: 0.35rem; flex-wrap: wrap; }
.oc-seg-opt {
  flex: 1 1 0;
  padding: 0.45rem 0.6rem;
  border: 1.5px solid #c9ced0;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
}
.oc-seg-opt small { display: block; font-size: 0.68rem; color: var(--muted); }
.oc-seg-opt:hover { border-color: var(--ink); }
.oc-seg-opt:focus-within { outline: 3px solid #f2c14e; outline-offset: 2px; }
.oc-seg-opt.is-on { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.oc-seg-opt.is-on small { color: var(--steel); }
.oc-seg-bad.is-on { border-color: var(--fail); background: var(--fail); }
.oc-seg-sm .oc-seg-opt { padding: 0.35rem 0.5rem; font-size: 0.8rem; }

/* dich vu tra loi muon */
.oc-fail-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; margin-top: 0.35rem; }
.oc-fail-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem;
  padding: 0.5rem 0.6rem;
  border: 1.5px dashed #c9ced0;
  border-radius: 6px;
  background: transparent;
  font: inherit; text-align: left; color: var(--ink);
  cursor: pointer;
}
.oc-fail-opt:hover { border-color: var(--pending); }
.oc-fail-name { font-weight: 700; }
.oc-fail-why { font-size: 0.7rem; color: var(--muted); }
.oc-fail-opt[aria-pressed="true"] { border-style: solid; border-color: var(--pending); background: #f7eed6; }
.oc-fail-opt[aria-pressed="true"] .oc-fail-why { color: var(--pending); }

/* dong thoi gian du kien */
.oc-timeline { list-style: none; margin: 0.75rem 0 0; padding: 0.55rem 0 0; border-top: 1px dashed #b9bfc2; }
.oc-timeline li {
  display: grid;
  grid-template-columns: 3.9rem 6.5rem 1fr;
  gap: 0.5rem;
  padding: 0.12rem 0;
}
.oc-ev-t { color: var(--muted); text-align: right; }
.oc-ev-who { font-weight: 700; }
.oc-ev-who::before { display: inline-block; width: 1.1em; font-weight: 700; }
.oc-ev-ok .oc-ev-who::before { content: "✓"; color: var(--ok); }
.oc-ev-done .oc-ev-who::before { content: "✓"; color: var(--ok); }
.oc-ev-done { color: var(--ok); }
.oc-ev-fail .oc-ev-who::before { content: "✕"; }
.oc-ev-fail, .oc-ev-saga { color: var(--fail); }
.oc-ev-saga .oc-ev-who::before { content: "■"; }
.oc-ev-timeout { color: var(--pending); }

/* thu su co: thu tu 3 ben tra loi */
.oc-order { list-style: none; margin: 0.4rem 0 0; padding: 0; display: grid; gap: 0.4rem; }
.oc-order-row {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr) auto;
  grid-template-areas: "no name move" "no opts opts";
  align-items: center;
  gap: 0.2rem 0.6rem;
  padding: 0.5rem 0.6rem;
  border: 1.5px solid #c9ced0;
  border-radius: 6px;
}
.oc-order-no {
  grid-area: no; align-self: start;
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--paper); font-weight: 700; font-size: 0.85rem;
}
.oc-order-name { grid-area: name; font-weight: 700; }
.oc-order-name small { display: block; font-weight: 400; font-size: 0.72rem; color: var(--muted); }
.oc-order-move { grid-area: move; display: flex; gap: 0.3rem; }
.oc-order-opts { grid-area: opts; display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; font-size: 0.8rem; }
.oc-order-opt { display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; }
.oc-order-bad { color: var(--fail); }
.oc-order-opt small { font-size: 0.7rem; color: var(--muted); }
.oc-order-row.is-silent { border-style: dashed; border-color: var(--pending); background: #f7eed6; }
.oc-order-row.is-silent .oc-order-no { background: var(--pending); }
.oc-ev-timeout .oc-ev-who::before { content: "⏱"; }
.oc-ev-silent { color: var(--muted); }
.oc-ev-silent .oc-ev-who::before { content: "…"; }
.oc-ev-undo, .oc-ev-late { color: var(--undo); }
.oc-ev-undo .oc-ev-who::before, .oc-ev-late .oc-ev-who::before { content: "↺"; }
.oc-ev-late .oc-ev-text { font-weight: 700; }
.oc-forecast .step { gap: 1rem; }
.oc-f-text { text-align: right; color: var(--muted); }
.oc-f-ok .step-name::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.oc-f-fail .step-name, .oc-f-fail .oc-f-text { color: var(--fail); }
.oc-f-fail .step-name::before { content: "✕ "; font-weight: 700; }
.oc-f-undo .step-name::before { content: "↺ "; color: var(--undo); font-weight: 700; }
.oc-f-undo .oc-f-text { color: var(--undo); }

/* ---- chan phieu: tong + gui, dinh duoi khi cuon ---- */
.oc-foot {
  position: sticky;
  bottom: 0;
  margin: 0 -1.2rem;
  padding: 0.75rem 1.2rem 1.1rem;
  background: var(--paper);
  border-top: 2px solid var(--ink);
}
.oc-sum { display: flex; justify-content: space-between; align-items: baseline; }
.oc-sum b { font-size: var(--t-md); }
.oc-hint { margin-top: 0.25rem; color: var(--pending); font-size: 0.75rem; }
.oc-error { margin-top: 0.35rem; color: var(--fail); font-size: 0.8rem; font-weight: 700; }
.oc-retry { margin-left: 0.5rem; font-family: var(--f-body); }
.oc-soon { padding: 0.6rem 0 0.2rem; }
.oc-sent-real { margin: 0.35rem 0; }
.oc-sent-fail { margin: 0.35rem 0; padding: 0.5rem 0.65rem; border-left: 3px solid var(--fail); background: rgba(192, 54, 44, 0.06); }
/* ty le loi ngau nhien cua payment - luon hien o phan thu loi */
.oc-rates { margin-top: 0.5rem; font-size: 0.8125rem; color: var(--muted); }
.oc-rates ul { margin: 0.25rem 0 0; padding-left: 1.1rem; }
.oc-rates li { margin: 0.2rem 0; }
.oc-rates b { color: var(--ink); }
.oc-send { width: 100%; margin-top: 0.6rem; font-family: var(--f-body); }

/* ---- chua dang nhap / da gui ---- */
.oc-guest, .oc-sent { position: relative; padding: 1.2rem 0 3.6rem; }
.oc-guest p { margin-bottom: 1rem; }
.oc-guest .btn { font-family: var(--f-body); }
.oc-sent-code { font-size: var(--t-md); font-weight: 700; }

/* ---- man vua: 1 cot, rong hon ---- */
@media (min-width: 900px) {
  .oc-ticket { width: 40rem; }
}

/* ---- man rong (>=1100px): phieu to, 2 cot ----
   Trai: so khach, gio toi, thu loi. Phai: danh sach mon (2 cot mon,
   cao gan het man). Chan phieu (tong + nut gui) van ngang ca phieu. */
@media (min-width: 1100px) {
  .oc-ticket {
    width: min(68rem, calc(100vw - 4rem));
    max-height: calc(100vh - 4rem);
    padding: 1.4rem 1.8rem 0;
    font-size: 0.9rem;
  }
  .oc-foot { margin: 0 -1.8rem; padding: 0.9rem 1.8rem 1.3rem; }
  .oc-body {
    display: grid;
    grid-template-columns: minmax(0, 23rem) minmax(0, 1fr);
    /* thu loi: hang rieng DUOI ca 2 cot, rong het phieu */
    grid-template-areas:
      "party menu"
      "time  menu"
      "test  test";
    grid-template-rows: auto 1fr auto;
    column-gap: 2rem;
  }
  .oc-sec-party { grid-area: party; }
  .oc-sec-time { grid-area: time; }
  .oc-test, .oc-soon { grid-area: test; align-self: start; border-top: 1px dashed #c9ced0; padding-top: 0.9rem; }
  .oc-sec-menu { grid-area: menu; border-bottom: 0; }
  .oc-slots { grid-template-columns: repeat(2, 1fr); }
  .oc-menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1.4rem;
    align-content: start;
    max-height: calc(100vh - 19rem);
    min-height: 18rem;
  }
  .oc-item + .oc-item { border-top: 0; }
  .oc-item { border-bottom: 1px dotted #dde0e1; padding: 0.4rem 0.3rem; }
  .oc-step-sm { width: 2rem; height: 2rem; }
  .oc-party-n { font-size: 2.8rem; }
  .oc-send { font-size: 1rem; padding: 0.85rem 1.1rem; }
}

/* ---- man rat rong (27"+): phieu rong them, ten mon it xuong dong ---- */
@media (min-width: 1700px) {
  .oc-ticket { width: min(84rem, calc(100vw - 6rem)); font-size: 0.95rem; }
  .oc-body { grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); column-gap: 2.5rem; }
}

@media (max-width: 640px) {
  /* GOTCHA: trinh duyet tu dat max-height cho <dialog> = 100% - 2em - 6px.
     Phieu cao gan het man -> phan duoi (nut gui) bi cat. Bo gioi han do,
     dung 100dvh (tinh ca thanh dia chi tren dien thoai, 100vh thi khong). */
  .oc-dialog { max-width: 100vw; max-height: 100dvh; margin: auto 0 0; width: 100%; }
  .oc-ticket { width: 100%; max-height: calc(100dvh - 12px); }
  .oc-slots { grid-template-columns: repeat(2, 1fr); }
  .oc-fail-opts { grid-template-columns: 1fr; }
  .oc-timeline li { grid-template-columns: 2.6rem 5.4rem 1fr; font-size: 0.75rem; }
  .oc-menu { max-height: none; }
}

/* ---- da du 5 don chua toi gio (js/order-create.js limitState=full) ---- */
.oc-full { padding: 1rem 0 1.2rem; }
.oc-full-title { font-size: var(--t-md); font-weight: 700; margin-bottom: 0.4rem; }
.oc-full > p + p { margin-top: 0.3rem; }
.oc-full-list { list-style: none; margin: 0.8rem 0 0.6rem; padding: 0; border-top: 1px dashed #b9bfc2; }
.oc-full-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px dashed #b9bfc2;
}
.oc-full-info small { display: block; color: var(--muted); }
.oc-full-cancel { background: transparent; color: var(--fail); border: 1.5px solid var(--fail); }
.oc-full-cancel:hover { background: rgba(192, 54, 44, 0.08); }
.oc-full-late { font-size: 0.8rem; color: var(--muted); }
