/* The checkout and the order's own page (porosia.html, js/checkout.js). Uses the tokens and
   pieces of style.css (buttons, .field, .empty-state). */

body[data-page="order"] .list-bar { display: none; } /* the page itself is the "order" button */

.co-grid { display: grid; gap: 18px; align-items: start; }
.co-form, .co-track { display: grid; gap: 16px; min-width: 0; }
@media (min-width: 900px) {
  .co-grid { grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; }
  .co-aside { position: sticky; top: calc(var(--header-h) + 16px); }
}

.co-card { display: grid; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); }
.co-card-title { font-size: 1.08rem; font-weight: 600; }

/* delivery / pickup, cash / card */
.co-choices { display: grid; gap: 10px; }
@media (min-width: 560px) { .co-choices { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); } }
.co-choice { position: relative; display: block; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.co-choice input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.co-choice-box { display: flex; align-items: center; gap: 12px; height: 100%; min-height: 68px; padding: 12px 14px; border: 1.5px solid #d5d7da; border-radius: var(--radius-sm); transition: border-color 0.2s ease, background-color 0.2s ease; }
.co-choice:hover .co-choice-box { border-color: #b9bcc0; }
.co-choice-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 50%; background: var(--bg-alt); color: var(--green-dark); }
.co-choice-icon .icon { width: 22px; height: 22px; }
.co-choice-text { display: grid; gap: 2px; min-width: 0; line-height: 1.3; }
.co-choice-text span { color: var(--muted); font-size: 0.84rem; }
.co-choice-tick { display: grid; place-items: center; width: 24px; height: 24px; flex: none; margin-left: auto; border: 1.5px solid #d5d7da; border-radius: 50%; color: transparent; transition: background-color 0.2s ease; }
.co-choice-tick .icon { width: 14px; height: 14px; }
.co-choice input:checked + .co-choice-box { border-color: var(--green); background: var(--green-50); }
.co-choice input:checked + .co-choice-box .co-choice-icon { background: #fff; }
.co-choice input:checked + .co-choice-box .co-choice-tick { border-color: var(--green); background: var(--green); color: #fff; }
.co-choice input:focus-visible + .co-choice-box { outline: 3px solid var(--red); outline-offset: 2px; }

.co-field .co-hint { color: var(--muted); font-size: 0.82rem; font-weight: 400; }
.co-error { color: #a4241a; font-size: 0.86rem; font-weight: 600; }
.co-field [aria-invalid] { border-color: #c0392b; }
.co-locate { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.co-located { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--green-dark); font-size: 0.9rem; font-weight: 600; }
.co-located .icon { width: 18px; height: 18px; }
.co-locate-remove { min-height: 36px; }
.co-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.co-open { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--green-50); color: var(--green-dark); font-weight: 600; text-decoration: none; }
.co-open .icon { width: 20px; height: 20px; flex: none; }
.co-open strong { margin-left: auto; }
.empty-state + .co-open, .co-open + .empty-state { margin-top: 12px; }

/* the list and totals */
.co-sum-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-block: -6px; }
.co-lines { display: grid; margin: 0; padding: 0; list-style: none; }
.co-line { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.co-line-qty { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.co-line-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.co-line-unit { color: var(--muted); font-size: 0.82rem; }
.co-line-price { display: grid; justify-items: end; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.co-line-price small { color: var(--muted); font-size: 0.74rem; font-weight: 400; }
.co-line-price del { color: var(--muted); font-weight: 400; }
.co-line.is-gone .co-line-name > span:first-child { color: var(--muted); text-decoration: line-through; }
.co-tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; background: var(--bg-alt); color: var(--muted); font-size: 0.72rem; font-weight: 600; line-height: 1.6; }
.co-tag .icon { width: 12px; height: 12px; }
.co-tag--weigh { background: #fff3dc; color: #7a4a00; }
.co-tag--done { background: var(--green-50); color: var(--green-dark); }
.co-tag--missing { background: var(--red-soft); color: var(--red-strong); }
.co-totals { display: grid; gap: 6px; margin: 0; }
.co-total { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.co-total dd { margin: 0; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.co-total--sum { padding-top: 10px; border-top: 1px solid var(--line); color: var(--ink); font-size: 1.05rem; font-weight: 600; }
.co-total--sum dd { color: var(--red-strong); font-size: 1.35rem; }
.co-note { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg-alt); font-size: 0.85rem; }
.co-note > .icon { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--green-dark); }
.co-note--warn { display: grid; gap: 10px; background: #fff3dc; color: #5c3800; }
.co-note--warn .btn { justify-self: start; }
.co-privacy { text-align: center; }

/* the order's own page */
.co-status { justify-items: start; }
.co-status-icon { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: var(--green-50); color: var(--green-dark); }
.co-status-icon .icon { width: 28px; height: 28px; }
.co-status--new .co-status-icon { background: #fff3dc; color: #7a4a00; }
.co-status--ended .co-status-icon { background: var(--red-soft); color: var(--red-strong); }
.co-status-title { font-size: clamp(1.45rem, 5vw, 1.85rem); font-weight: 600; line-height: 1.2; }
.co-status-text { margin-top: -8px; color: var(--muted); }
.co-status-reason { font-weight: 600; }
.co-steps { display: grid; width: 100%; margin: 2px 0 0; padding: 0; list-style: none; }
.co-steps li { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 46px; color: var(--muted); }
.co-steps li:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 32px; bottom: -14px; width: 2px; background: var(--line); }
.co-steps li.is-done::after { background: var(--green); }
.co-step-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid var(--line); border-radius: 50%; background: #fff; }
.co-step-dot .icon { width: 14px; height: 14px; }
.co-steps .is-done, .co-steps .is-now { color: var(--ink); }
.is-done .co-step-dot, .is-now .co-step-dot { border-color: var(--green); background: var(--green); color: #fff; }
.is-now .co-step-dot { box-shadow: 0 0 0 5px rgb(71 115 31 / 18%); }
.is-now .co-step-label { font-weight: 700; }
.co-steps time { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.co-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.co-confirm { width: 100%; font-weight: 600; }
.co-updated { margin-top: -6px; }
.co-facts { display: grid; gap: 10px; margin: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.co-facts dt { color: var(--muted); font-size: 0.82rem; }
.co-facts dd { display: grid; gap: 2px; margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.co-map { color: var(--green-dark); font-size: 0.88rem; }
.co-loading { padding: 48px 20px; color: var(--muted); text-align: center; }
@media (prefers-reduced-motion: no-preference) {
  .is-now .co-step-dot { animation: co-pulse 2s ease-in-out infinite; }
}
@keyframes co-pulse { 50% { box-shadow: 0 0 0 9px rgb(71 115 31 / 8%); } }
