/* =============================================================================
   Order — order.php
   -----------------------------------------------------------------------------
   Sits on landing.css (the nav, .ld-wrap, .ld-btn, .ld-kicker, the footer) and
   the --sh-* tokens, so light and dark follow the app. Every colour is a token;
   nothing here needs tools/gen-dark-theme.php.

   Phone first: one column of numbered cards, the summary after them, and a bar
   at the bottom with the total and the button. From 992px the summary is a
   sticky column on the right and the bar goes away.
   ============================================================================= */

.od { padding: var(--sh-5) 0 calc(112px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 992px) { .od { padding: var(--sh-6) 0 var(--sh-7); } }

.od-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.od-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 419px) { .od-hide-xs { display: none; } }

/* ----------------------------------------------------------------- head -- */

.od-head { margin-bottom: var(--sh-4); }
.od-head h1 { font-size: clamp(1.6rem, 6vw, 2.3rem); margin-bottom: 6px; }
.od-sub { color: var(--sh-text-muted); max-width: 60ch; }
.od-steps {
    display: flex; gap: 8px; margin-top: var(--sh-4);
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin-left: calc(var(--sh-4) * -1); margin-right: calc(var(--sh-4) * -1); padding: 2px var(--sh-4);
}
.od-steps::-webkit-scrollbar { display: none; }
@media (min-width: 768px) { .od-steps { margin-left: 0; margin-right: 0; padding: 0; } }
.od-steps li {
    flex: none; display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px 6px 6px; border-radius: var(--sh-r-pill);
    background: var(--sh-surface); border: 1px solid var(--sh-border);
    font-size: var(--sh-fs-sm); color: var(--sh-text-muted); white-space: nowrap;
}
.od-steps span {
    width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
    background: var(--sh-accent-soft); color: var(--sh-accent-strong); font-weight: 700; font-size: var(--sh-fs-xs);
}

/* --------------------------------------------------------------- layout -- */

.od-grid { display: grid; gap: var(--sh-4); }
.od-main { display: grid; gap: var(--sh-4); min-width: 0; }
@media (min-width: 992px) {
    .od-grid { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; gap: var(--sh-5); }
    .od-main { gap: var(--sh-5); }
    .od-side { position: sticky; top: 84px; }
}

.od-card {
    background: var(--sh-surface);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-r-xl);
    box-shadow: var(--sh-shadow-1);
    padding: var(--sh-4);
}
@media (min-width: 768px) { .od-card { padding: var(--sh-5); } }
.od-card > h2 {
    display: flex; align-items: center; gap: 10px;
    font-size: var(--sh-fs-lg); margin-bottom: var(--sh-4);
}
.od-n {
    width: 30px; height: 30px; border-radius: 50%; flex: none;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--sh-accent), var(--sh-accent-strong));
    color: var(--sh-text-on-accent); font-size: var(--sh-fs-sm); font-weight: 700;
}

.od-alert {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; margin-bottom: var(--sh-4);
    border-radius: var(--sh-r-lg); border: 1px solid var(--sh-border);
    background: var(--sh-surface); color: var(--sh-text); font-weight: 600;
}
.od-alert i { font-size: 1.1rem; flex: none; margin-top: 1px; }
.od-alert.is-warning { background: var(--sh-warning-soft); border-color: var(--sh-warning); }
.od-alert.is-warning i { color: var(--sh-warning); }
.od-alert.is-error { background: var(--sh-danger-soft); border-color: var(--sh-danger); }
.od-alert.is-error i { color: var(--sh-danger); }
.od-alert[hidden] { display: none; }

/* ------------------------------------------------------------- products -- */

.od-products { display: grid; gap: 12px; }
.od-product {
    display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px;
    padding: 12px; border-radius: var(--sh-r-lg);
    border: 1.5px solid var(--sh-border); background: var(--sh-surface);
    transition: border-color var(--sh-fast), background var(--sh-fast), box-shadow var(--sh-fast);
}
@media (min-width: 576px) { .od-product { grid-template-columns: 108px minmax(0, 1fr); gap: 16px; padding: 14px; } }
.od-product.is-picked { border-color: var(--sh-accent); background: var(--sh-accent-soft); box-shadow: 0 0 0 3px var(--sh-accent-soft); }
.od-product-img { aspect-ratio: 1 / 1; border-radius: var(--sh-r-md); overflow: hidden; background: var(--sh-surface-sunken); }
.od-product-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; }
.od-product-body { display: grid; gap: 4px; min-width: 0; align-content: start; }
.od-product h3 { font-size: var(--sh-fs-md); }
@media (min-width: 576px) { .od-product h3 { font-size: var(--sh-fs-lg); } }
.od-product-tag {
    color: var(--sh-text-muted); font-size: var(--sh-fs-sm); line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.od-product-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-top: 6px; }
.od-price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.od-price b { font-size: var(--sh-fs-lg); color: var(--sh-heading); }
.od-price s { color: var(--sh-text-faint); font-size: var(--sh-fs-sm); }
.od-price-ask { font-size: var(--sh-fs-sm); font-weight: 600; color: var(--sh-accent-strong); }

/* quantity: an "add" button until there is one, then a stepper */
.od-qty { display: flex; }
.od-add {
    display: none; align-items: center; gap: 6px;
    min-height: 40px; padding: 0 16px; border-radius: var(--sh-r-pill);
    border: 1.5px solid var(--sh-accent); background: var(--sh-surface); color: var(--sh-accent-strong);
    font: inherit; font-weight: 700; font-size: var(--sh-fs-sm); cursor: pointer;
}
.od-add:hover { background: var(--sh-accent-soft); }
.od-js .od-qty.is-empty .od-add { display: inline-flex; }
.od-js .od-qty.is-empty .od-stepper { display: none; }
.od-stepper {
    display: inline-flex; align-items: center;
    border: 1.5px solid var(--sh-border-strong); border-radius: var(--sh-r-pill);
    background: var(--sh-surface); overflow: hidden;
}
.od-product.is-picked .od-stepper { border-color: var(--sh-accent); }
.od-step {
    width: 40px; height: 40px; border: 0; background: transparent; color: var(--sh-heading);
    display: grid; place-items: center; cursor: pointer; font-size: 1rem;
}
.od-step:hover { background: var(--sh-accent-soft); color: var(--sh-accent-strong); }
.od-stepper input {
    width: 40px; height: 40px; border: 0; background: transparent; text-align: center;
    font: inherit; font-weight: 700; font-size: var(--sh-fs-md); color: var(--sh-heading);
    -moz-appearance: textfield; appearance: textfield;
}
.od-stepper input::-webkit-outer-spin-button,
.od-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.od-add:focus-visible, .od-step:focus-visible, .od-stepper input:focus-visible { outline: none; box-shadow: var(--sh-ring); }

/* --------------------------------------------------------------- fields -- */

.od-fields { display: grid; gap: var(--sh-4); }
.od-row-2 { display: grid; gap: var(--sh-4); }
@media (min-width: 576px) { .od-row-2 { grid-template-columns: 1fr 1fr; } }
.od-field { display: grid; gap: 6px; align-content: start; }
.od-field label { font-weight: 600; font-size: var(--sh-fs-sm); color: var(--sh-heading); }
.od-req { color: var(--sh-danger); }
.od-optional { color: var(--sh-text-faint); font-weight: 500; }
.od-field input, .od-field select, .od-field textarea {
    width: 100%; min-height: 48px; padding: 12px 14px;
    border: 1.5px solid var(--sh-border-strong); border-radius: var(--sh-r-md);
    background: var(--sh-surface); color: var(--sh-text);
    font: inherit; font-size: 16px; /* 16px: no zoom on focus on iPhone */
    transition: border-color var(--sh-fast), box-shadow var(--sh-fast);
}
.od-field textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.od-field select {
    appearance: none; -webkit-appearance: none; padding-right: 40px;
    background-image: linear-gradient(45deg, transparent 50%, var(--sh-text-muted) 50%), linear-gradient(135deg, var(--sh-text-muted) 50%, transparent 50%);
    background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
    background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.od-field input::placeholder, .od-field textarea::placeholder { color: var(--sh-text-faint); }
.od-field input:focus, .od-field select:focus, .od-field textarea:focus { outline: none; border-color: var(--sh-accent); box-shadow: var(--sh-ring); }
.od-field.has-error input, .od-field.has-error select, .od-field.has-error textarea { border-color: var(--sh-danger); }
.od-hint { color: var(--sh-text-faint); font-size: var(--sh-fs-xs); }
.od-error { color: var(--sh-danger); font-size: var(--sh-fs-sm); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.od-error::before { content: "\F33A"; font-family: "bootstrap-icons"; font-weight: 400; }
.od-error[hidden] { display: none; }
.od-card > .od-error { margin-top: 10px; }

/* install wanted */
.od-check {
    display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start;
    padding: 14px; border-radius: var(--sh-r-lg); cursor: pointer;
    border: 1.5px solid var(--sh-border); background: var(--sh-surface-2);
}
.od-check input { position: absolute; opacity: 0; pointer-events: none; }
.od-check-box {
    width: 24px; height: 24px; border-radius: 7px; margin-top: 1px;
    border: 2px solid var(--sh-border-strong); background: var(--sh-surface);
    display: grid; place-items: center; color: transparent; font-size: .95rem;
    transition: background var(--sh-fast), border-color var(--sh-fast);
}
.od-check input:checked + .od-check-box { background: var(--sh-accent); border-color: var(--sh-accent); color: var(--sh-text-on-accent); }
.od-check input:focus-visible + .od-check-box { box-shadow: var(--sh-ring); }
.od-check:has(input:checked) { border-color: var(--sh-accent); background: var(--sh-accent-soft); }
.od-check-text { display: grid; gap: 2px; }
.od-check-text b { color: var(--sh-heading); font-size: var(--sh-fs-sm); }
.od-check-text small { color: var(--sh-text-muted); font-size: var(--sh-fs-xs); line-height: 1.5; }

/* payment */
.od-pay {
    display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
    padding: 14px; border-radius: var(--sh-r-lg);
    border: 1.5px solid var(--sh-accent); background: var(--sh-accent-soft);
}
.od-pay input { position: absolute; opacity: 0; pointer-events: none; }
.od-pay-ic {
    width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
    background: var(--sh-surface); color: var(--sh-success); font-size: 1.35rem; border: 1px solid var(--sh-border);
}
.od-pay-text { display: grid; gap: 2px; }
.od-pay-text b { color: var(--sh-heading); }
.od-pay-text small { color: var(--sh-text-muted); font-size: var(--sh-fs-xs); line-height: 1.5; }
.od-pay-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--sh-accent); display: grid; place-items: center; }
.od-pay-dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--sh-accent); }

/* -------------------------------------------------------------- summary -- */

.od-summary h2 { font-size: var(--sh-fs-lg); margin-bottom: var(--sh-3); }
.od-lines { display: grid; gap: 10px; padding-bottom: var(--sh-3); border-bottom: 1px dashed var(--sh-border-strong); }
.od-lines li { display: flex; justify-content: space-between; gap: 12px; font-size: var(--sh-fs-sm); }
.od-lines li span { color: var(--sh-text); min-width: 0; }
.od-lines li em { font-style: normal; color: var(--sh-text-faint); white-space: nowrap; }
.od-lines li b { color: var(--sh-heading); white-space: nowrap; font-weight: 600; }
.od-lines-empty { color: var(--sh-text-faint); }
.od-totals { display: grid; gap: 8px; margin: var(--sh-3) 0 0; }
.od-totals > div { display: flex; justify-content: space-between; gap: 12px; font-size: var(--sh-fs-sm); }
.od-totals dt { color: var(--sh-text-muted); font-weight: 500; }
.od-totals dd { margin: 0; color: var(--sh-heading); font-weight: 600; text-align: right; }
.od-totals .od-total { padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--sh-border); font-size: var(--sh-fs-md); }
.od-totals .od-total dt { color: var(--sh-heading); font-weight: 700; }
.od-totals .od-total dd { font-size: var(--sh-fs-xl); font-weight: 800; color: var(--sh-accent-strong); }
.od-totals .od-total dd.is-ask { font-size: var(--sh-fs-md); font-weight: 700; color: var(--sh-heading); }
.od-bar-total b.is-ask { font-size: var(--sh-fs-sm); }
.od-price-note { margin-top: 10px; font-size: var(--sh-fs-xs); color: var(--sh-text-muted); line-height: 1.5; }
.od-submit { width: 100%; margin-top: var(--sh-4); }
.od-submit[disabled], .od-bar-btn[disabled] { opacity: .7; cursor: progress; }
.od-trust { display: grid; gap: 8px; margin-top: var(--sh-4); }
.od-trust li { display: flex; gap: 10px; align-items: center; font-size: var(--sh-fs-sm); color: var(--sh-text-muted); }
.od-trust i { color: var(--sh-success); font-size: 1rem; }
.od-call { margin-top: var(--sh-3); font-size: var(--sh-fs-sm); color: var(--sh-text-muted); }
.od-call a { color: var(--sh-accent-strong); font-weight: 700; }

.od-spin {
    width: 18px; height: 18px; border-radius: 50%; flex: none;
    border: 2.5px solid currentColor; border-right-color: transparent;
    animation: od-spin .7s linear infinite;
}
@keyframes od-spin { to { transform: rotate(360deg); } }

/* phone: total and button at the bottom */
.od-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center;
    padding: 10px var(--sh-4) calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--sh-glass-strong);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--sh-border);
}
.od-bar-total { display: grid; line-height: 1.2; }
.od-bar-total small { color: var(--sh-text-faint); font-size: var(--sh-fs-xs); }
.od-bar-total b { color: var(--sh-heading); font-size: var(--sh-fs-lg); white-space: nowrap; }
.od-bar-btn { min-height: 48px; width: 100%; }
@media (min-width: 992px) { .od-bar { display: none; } }

/* -------------------------------------------------------- order views -- */

.od-empty { text-align: center; display: grid; gap: 10px; justify-items: center; padding: var(--sh-6) var(--sh-4); }
.od-empty > i { font-size: 2.4rem; color: var(--sh-accent-strong); }
.od-empty h1, .od-empty h2 { font-size: var(--sh-fs-xl); }
.od-empty p { color: var(--sh-text-muted); max-width: 52ch; }

.od-done { max-width: 720px; margin: 0 auto; display: grid; gap: var(--sh-4); }
.od-done-hero { text-align: center; display: grid; gap: 10px; justify-items: center; padding: var(--sh-3) 0 var(--sh-2); }
.od-done-ic {
    width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center;
    background: var(--sh-success); color: var(--sh-text-on-accent); font-size: 2.4rem;
    box-shadow: 0 0 0 10px var(--sh-success-soft);
    animation: od-pop .5s var(--sh-ease) both;
}
@keyframes od-pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .od-done-ic { animation: none; } }
.od-done-hero h1 { font-size: clamp(1.4rem, 5.4vw, 2rem); margin-top: 8px; }
.od-done-hero p { color: var(--sh-text-muted); max-width: 46ch; }
.od-done-hero b { color: var(--sh-heading); }

.od-ticket { display: grid; gap: var(--sh-4); }
.od-ticket-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.od-ticket-head small { display: block; color: var(--sh-text-faint); font-size: var(--sh-fs-xs); }
.od-no { font-size: var(--sh-fs-xl); color: var(--sh-heading); letter-spacing: .02em; font-variant-numeric: tabular-nums; }

.od-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--sh-r-pill);
    font-size: var(--sh-fs-xs); font-weight: 700; white-space: nowrap;
    background: var(--sh-surface-2); color: var(--sh-text-muted); border: 1px solid var(--sh-border);
}
.od-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.od-chip.is-pending   { background: var(--sh-warning-soft); color: var(--sh-warning); border-color: transparent; }
.od-chip.is-confirmed { background: var(--sh-accent-soft); color: var(--sh-accent-strong); border-color: transparent; }
.od-chip.is-shipped   { background: var(--sh-info-soft); color: var(--sh-info); border-color: transparent; }
.od-chip.is-delivered { background: var(--sh-success-soft); color: var(--sh-success); border-color: transparent; }
.od-chip.is-cancelled { background: var(--sh-danger-soft); color: var(--sh-danger); border-color: transparent; }

.od-track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; position: relative; }
.od-track li { position: relative; display: grid; gap: 4px; justify-items: center; text-align: center; padding-top: 30px; }
.od-track li::before {
    content: ""; position: absolute; top: 10px; left: -50%; right: 50%; height: 3px;
    background: var(--sh-border); border-radius: 2px;
}
.od-track li:first-child::before { display: none; }
.od-track li.is-done::before { background: var(--sh-success); }
.od-track-dot {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 23px; height: 23px; border-radius: 50%; z-index: 1;
    background: var(--sh-surface); border: 3px solid var(--sh-border-strong);
}
.od-track li.is-done .od-track-dot { background: var(--sh-success); border-color: var(--sh-success); }
.od-track li.is-now .od-track-dot { box-shadow: 0 0 0 5px var(--sh-success-soft); }
.od-track b { font-size: var(--sh-fs-xs); color: var(--sh-text-muted); font-weight: 600; line-height: 1.35; }
.od-track li.is-done b { color: var(--sh-heading); }
.od-track small { font-size: 11px; color: var(--sh-text-faint); line-height: 1.3; }
@media (min-width: 576px) { .od-track b { font-size: var(--sh-fs-sm); } }
.od-cancel { display: flex; gap: 8px; align-items: center; color: var(--sh-danger); font-weight: 600; }

.od-ship {
    display: grid; gap: 12px; grid-template-columns: 1fr;
    padding: var(--sh-4); border-radius: var(--sh-r-lg); background: var(--sh-surface-2); border: 1px solid var(--sh-border);
}
@media (min-width: 576px) { .od-ship { grid-template-columns: 1fr 1fr; } .od-ship-wide { grid-column: 1 / -1; } }
.od-ship small { display: block; color: var(--sh-text-faint); font-size: var(--sh-fs-xs); }
.od-ship b { color: var(--sh-heading); font-weight: 600; font-size: var(--sh-fs-sm); overflow-wrap: anywhere; }

.od-done-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.od-done-actions .ld-btn { flex: 1 1 200px; }
@media (min-width: 576px) { .od-done-actions .ld-btn { flex: none; } }
.od-done > .od-call { text-align: center; }

.od-mine { display: grid; gap: 10px; max-width: 720px; }
.od-mine-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 14px var(--sh-4); }
.od-mine-row:hover { border-color: var(--sh-accent-border); }
.od-mine-row .od-no { font-size: var(--sh-fs-md); display: block; }
.od-mine-row small { color: var(--sh-text-faint); font-size: var(--sh-fs-xs); }
.od-mine-row > i { color: var(--sh-text-faint); }
.od-mine + .od-done-actions { justify-content: flex-start; margin-top: var(--sh-4); }

.od-body .ld-footer { padding-bottom: calc(var(--sh-6) + 76px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 992px) { .od-body .ld-footer { padding-bottom: var(--sh-6); } }

/* --------------------------------------------- product options (the wire) -- */

.od-opts {
    grid-column: 1 / -1; margin: 4px 0 0; padding: 12px 0 0; border: 0;
    border-top: 1px dashed var(--sh-border-strong); min-width: 0;
}
.od-js .od-product:not(.is-picked) .od-opts { display: none; }
.od-opts legend {
    float: left; width: 100%; padding: 0; margin: 0 0 4px;
    font-size: var(--sh-fs-sm); font-weight: 700; color: var(--sh-heading);
}
.od-opts-hint { clear: both; color: var(--sh-text-muted); font-size: var(--sh-fs-xs); line-height: 1.5; margin-bottom: 10px; }
.od-opts-list { clear: both; display: grid; gap: 8px; }
@media (min-width: 576px) { .od-opts-list { grid-template-columns: 1fr 1fr; } }
.od-opt {
    display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
    min-height: 48px; padding: 10px 12px; border-radius: var(--sh-r-md); cursor: pointer;
    border: 1.5px solid var(--sh-border-strong); background: var(--sh-surface);
    transition: border-color var(--sh-fast), background var(--sh-fast);
}
.od-opt input { position: absolute; opacity: 0; pointer-events: none; }
.od-opt-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--sh-border-strong); display: grid; place-items: center; background: var(--sh-surface); }
.od-opt-dot::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: transparent; }
.od-opt-text { font-size: var(--sh-fs-sm); font-weight: 600; color: var(--sh-heading); line-height: 1.35; }
.od-opt-price { font-size: var(--sh-fs-sm); font-weight: 700; color: var(--sh-accent-strong); white-space: nowrap; }
.od-opt:has(input:checked) { border-color: var(--sh-accent); background: var(--sh-accent-soft); }
.od-opt input:checked + .od-opt-dot { border-color: var(--sh-accent); }
.od-opt input:checked + .od-opt-dot::after { background: var(--sh-accent); }
.od-opt input:focus-visible + .od-opt-dot { box-shadow: var(--sh-ring); }
.od-opts.has-error .od-opt { border-color: var(--sh-danger); }
.od-opts > .od-error { margin-top: 8px; }

.od-line-opt { display: block; color: var(--sh-text-faint); font-size: var(--sh-fs-xs); margin-top: 2px; }

/* thana / upazila: "other" opens a field to write it in */
.od-area-other { margin-top: 8px; }
.od-js .od-area-other:not(.is-on) { display: none; }
.od-field select optgroup { font-weight: 700; }
