/* configurator.css: the shade page where the client chooses size, fabric and extras and sees the price move.
   The fields themselves share their look with the cart (cart.css). */

.configurator { margin: 6px 0 14px; }

/* ---------- The rows: collapsed by default, a shortcut tick-box on the right ---------- */
.opts { margin: 8px 0 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.opt { border-top: 1px solid var(--line); }
.opt:first-child { border-top: 0; }
.opt-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; padding-right: 14px; }
.opt-toggle { flex: 1 1 11rem; display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 50px; padding: 10px 0 10px 14px; background: none; border: 0; font: inherit; text-align: left; color: var(--head); cursor: pointer; }
.opt-caret { flex: none; width: 14px; height: 14px; display: grid; place-items: center; }
.opt-caret::before { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform .15s; }
.opt.is-open .opt-caret::before { transform: rotate(45deg); }
.opt-title { flex: none; font-weight: 650; }
.opt-title small { margin-left: 4px; font-size: .76rem; font-weight: 500; color: var(--muted); }
.opt.is-done .opt-title::after { content: "\2713"; margin-left: 7px; font-size: .9rem; color: var(--ok); }
.opt-pick { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; color: var(--muted); }
.opt-auto { display: flex; align-items: center; gap: 8px; margin: 0 0 0 auto; padding: 6px 0; font-size: .9rem; font-weight: 600; color: var(--head); cursor: pointer; }
.opt-auto input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--accent-dark); }
.opt-auto b { font-weight: 700; }
.opt-body { padding: 2px 14px 16px; }
.opts.is-js .opt:not(.is-open) > .opt-body { display: none; }
.opt.is-auto .opt-body { opacity: .5; }
.opt.has-error { background: #fff4f2; }
.opt-err { margin: 0; padding: 0 14px 12px; color: var(--danger); font-size: .88rem; font-weight: 600; }
.opt-notes .field, .opt-addons .field { margin-bottom: 8px; }

/* picture cards (choose one) */
.pic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.pic-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 6px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.pic-card input { position: absolute; opacity: 0; pointer-events: none; }
.pic-img { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: #faf9f7; border-radius: 6px; }
.pic-img img { display: block; width: 100%; height: 100%; object-fit: contain; }
.pic-name { font-size: .84rem; font-weight: 600; line-height: 1.2; color: var(--head); }
.pic-price { font-size: .78rem; color: var(--muted); }
.pic-card input:checked + .pic-img { outline: 3px solid var(--accent-dark); outline-offset: -1px; }
.pic-card input:checked ~ .pic-name { color: var(--accent-dark); }
.pic-card input:focus-visible + .pic-img { outline: 3px solid var(--accent); }
.pic-card:has(input:checked) { border-color: var(--accent-dark); background: #fff7e8; }
.opt-body [data-clear-choice] { margin-top: 8px; }

@media (max-width: 560px) {
    /* the shortcut box drops under the title so neither gets squeezed */
    .opt-toggle { flex-basis: 100%; padding-bottom: 4px; }
    .opt-auto { flex-basis: 100%; margin: 0 0 8px 38px; padding: 4px 0 6px; }
}

.configurator .fabric-chosen img { width: 72px; height: 72px; cursor: zoom-in; }
.configurator .fabric-name { font-size: 1rem; }
.configurator .fabric-field .btn { padding: 9px 16px; }
.choice em { font-style: normal; font-weight: 500; opacity: .8; }

/* add-ons (.field .addon beats base.css's ".field > label" rule) */
.field .addon { display: grid; grid-template-columns: auto 48px 1fr auto; gap: 12px; align-items: center; margin-bottom: 8px; padding: 10px 12px; background: #fff; border: 1px solid #cfccc5; border-radius: 10px; cursor: pointer; }
.field .addon:has(input:checked) { border-color: var(--accent-dark); background: #fff7e8; }
.field .addon input { width: 20px; height: 20px; accent-color: var(--accent-dark); }
.field .addon img { width: 48px; height: 48px; object-fit: contain; background: #faf9f7; border-radius: 6px; }
.field .addon-text { display: flex; flex-direction: column; min-width: 0; }
.field .addon-text small { color: var(--muted); font-size: .82rem; }
.field .addon-price { font-weight: 700; white-space: nowrap; }

/* live price */
.price-box { margin: 6px 0 4px; padding: 14px 16px; background: #faf9f7; border: 1px solid var(--line); border-radius: var(--radius); }
.price-lines { list-style: none; margin: 0 0 8px; padding: 0; font-size: .94rem; }
.price-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.price-lines .qty-line { color: var(--muted); }
.price-tax { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0 6px; font-size: .94rem; color: var(--muted); }
.price-tax[hidden] { display: none; }
.price-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 8px; border-top: 1px solid var(--line); font-weight: 650; color: var(--head); }
.price-total strong { font-size: 1.5rem; }
.price-box p { margin: 6px 0 0; }

.buybar { display: flex; align-items: center; gap: 12px; padding: 12px 0 0; }
.buybar .qty { margin: 0; flex: none; }
.buybar .qty input { width: 64px; }
.btn-buy { flex: 1; padding: 14px 12px; font-size: 1.05rem; white-space: nowrap; }

@media (max-width: 819px) {
    /* the price and the button stay in reach while choosing on a phone */
    .buybar { position: sticky; bottom: 0; z-index: 20; margin: 0 -20px; padding: 10px 20px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 16px rgba(29, 28, 26, .08); }
    .field .addon { grid-template-columns: auto 40px 1fr auto; gap: 10px; }
    .field .addon img { width: 40px; height: 40px; }
}

/* a long form next to the photo: keep the photo in view while scrolling (desktop only) */
@media (min-width: 820px) {
    .detail .gallery { align-self: start; position: sticky; top: 76px; }
}
