/* ============================================================
   Primalevia — css/cart.css
   Left slide-out bag, cart page, coupon, single-page checkout
   accordion, payment methods, card fields, processing overlay.
   ============================================================ */

/* ---- slide-out bag (left) ---- */
.pv-cart-overlay { position: fixed; inset: 0; background: rgba(42,27,29,.45); opacity: 0; visibility: hidden; z-index: 420; transition: opacity var(--t); }
.pv-cart-overlay.pv-is-open { opacity: 1; visibility: visible; }
.pv-cart-panel { position: fixed; top: 0; left: 0; bottom: 0; width: min(400px, 90vw); background: var(--bg); z-index: 430; transform: translateX(-100%); transition: transform .4s cubic-bezier(.22,1,.36,1); display: flex; flex-direction: column; box-shadow: 2px 0 24px rgba(42,27,29,.18); }
.pv-cart-panel.pv-is-open { transform: translateX(0); }
.pv-cart-panel__head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.2rem; border-bottom: 1px solid var(--line); }
.pv-cart-panel__head h2 { font-size: 1.15rem; }
.pv-cart-panel__close { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--text); }
.pv-cart-panel__close .pv-ico { width: 22px; height: 22px; }
.pv-cart-panel__body { flex: 1; overflow-y: auto; padding: .6rem 1.2rem; }
.pv-cart-panel__foot { border-top: 1px solid var(--line); padding: 1rem 1.2rem; }

/* ---- cart line ---- */
.pv-cartline { display: grid; grid-template-columns: 74px 1fr; gap: .9rem; padding: 1rem 0; border-bottom: 1px solid var(--line-soft); }
.pv-cartline__img { width: 74px; height: 92px; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius); }
.pv-cartline__name { font-weight: 600; font-size: .92rem; }
.pv-cartline__opt { font-size: .78rem; color: var(--text-muted); margin: .2rem 0; }
.pv-cartline__price { font-weight: 700; font-size: .9rem; color: var(--accent-deep); }
.pv-cartline__foot { display: flex; align-items: center; justify-content: space-between; margin-top: .5rem; gap: .5rem; }
.pv-cartline__remove { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--text-muted); min-height: 44px; }
.pv-cartline__remove:hover { color: var(--accent-deep); }
.pv-cartline__remove .pv-ico { width: 15px; height: 15px; }
.pv-cart-empty { text-align: center; color: var(--text-muted); padding: 2.5rem 1rem; }
.pv-cart-empty .pv-ico { width: 40px; height: 40px; color: var(--line); margin: 0 auto .8rem; }

/* ---- ship progress ---- */
.pv-shipbar { margin: .4rem 0 1rem; }
.pv-shipbar__track { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.pv-shipbar__fill { height: 100%; width: 0; background: var(--accent); transition: width .4s ease; }
.pv-shipbar__label { font-size: .78rem; color: var(--text-muted); margin-top: .4rem; }
.pv-shipbar__label strong { color: var(--accent-deep); }

.pv-cart-subtotal { display: flex; justify-content: space-between; align-items: center; font-size: .95rem; margin-bottom: .8rem; }
.pv-cart-subtotal strong { font-size: 1.1rem; font-family: var(--font-head); }

/* ---- cart page layout ---- */
.pv-cartpage { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(1.5rem, 4vw, 2.5rem); align-items: start; }
.pv-cart-items { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem 1.2rem; margin-bottom: 1.4rem; }

/* ---- summary ---- */
.pv-summary { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; position: sticky; top: calc(var(--nav-h) + 12px); }
.pv-summary h2 { font-size: 1.1rem; margin-bottom: 1rem; }
.pv-summary__row { display: flex; justify-content: space-between; align-items: center; padding: .5rem 0; font-size: .92rem; border-bottom: 1px solid var(--line-soft); }
.pv-summary__row--discount { color: var(--accent-deep); }
.pv-summary__row--total { border-bottom: none; border-top: 2px solid var(--line); margin-top: .4rem; padding-top: .8rem; font-weight: 700; font-size: 1.1rem; }
.pv-summary__row--total strong { font-family: var(--font-head); }
.pv-summary__muted { font-size: .78rem; color: var(--text-soft); margin: .5rem 0; }

/* ---- coupon ---- */
.pv-coupon { margin: 1rem 0; }
.pv-coupon__row { display: flex; gap: .5rem; }
.pv-coupon__row input { flex: 1; min-height: 46px; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); text-transform: uppercase; letter-spacing: .06em; }
.pv-coupon__row button { min-height: 46px; padding: 0 1rem; }
.pv-coupon__msg { font-size: .8rem; margin-top: .5rem; min-height: 1.1em; }
.pv-coupon__msg.pv-is-ok { color: #2e6b45; }
.pv-coupon__msg.pv-is-err { color: #a83232; }
.pv-coupon__applied { display: flex; align-items: center; justify-content: space-between; gap: .5rem; background: var(--bg-alt); border: 1px solid var(--accent-soft); border-radius: var(--radius); padding: .5rem .8rem; font-size: .85rem; margin-top: .5rem; }
.pv-coupon__applied button { color: var(--accent-deep); text-decoration: underline; font-size: .8rem; min-height: 44px; }

/* ---- checkout accordion (single page, one section open) ---- */
.pv-co { display: grid; gap: .9rem; }
.pv-co__sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.pv-co__sec.pv-is-open { border-color: var(--accent-soft); box-shadow: var(--shadow); }
.pv-co__head { margin: 0; font-size: 1rem; }
.pv-co__sec.pv-is-open .pv-co__head { border-bottom: 1px solid var(--line-soft); }
.pv-co__toggle { width: 100%; display: flex; align-items: center; gap: .8rem; padding: 1rem 1.2rem; min-height: 60px; text-align: left; color: var(--text); font-weight: 700; font-family: var(--font-head); transition: background var(--t); }
.pv-co__toggle:not(:disabled):hover { background: var(--bg-alt); }
.pv-co__toggle:disabled { color: var(--text-soft); cursor: default; }
.pv-co__num { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%; border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: .85rem; font-family: var(--font-head); }
.pv-co__sec.pv-is-done .pv-co__num { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.pv-co__sec.pv-is-open .pv-co__num { border-color: var(--accent); background: var(--accent); color: #fff; }
.pv-co__label { flex: 0 0 auto; font-size: 1rem; }
.pv-co__summary { flex: 1; min-width: 0; font-family: var(--font-body); font-weight: 400; font-size: .82rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-co__edit { flex: 0 0 auto; margin-left: auto; font-family: var(--font-body); font-weight: 600; font-size: .8rem; color: var(--accent-deep); text-decoration: underline; }
.pv-co__toggle:disabled .pv-co__edit { display: none; }
.pv-co__sec.pv-is-open .pv-co__summary, .pv-co__sec.pv-is-open .pv-co__edit { display: none; }
.pv-co__body { padding: 1.2rem; }
.pv-co__nav { display: flex; gap: .7rem; margin-top: 1.4rem; }
.pv-co__nav .pv-btn { flex: 1; }

/* ---- gift wrap ---- */
.pv-gift { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: var(--bg-alt); margin-bottom: 1.2rem; }
.pv-gift label { display: flex; align-items: flex-start; gap: .6rem; font-size: .9rem; }
.pv-gift input { width: 20px; height: 20px; margin-top: .2rem; accent-color: var(--accent); flex: 0 0 auto; }
.pv-gift__fee { color: var(--accent-deep); font-weight: 700; }
.pv-gift small { display: block; color: var(--text-muted); font-size: .8rem; margin-top: .2rem; }

/* ---- payment methods ---- */
.pv-pay { display: grid; gap: .7rem; }
.pv-pay__method { display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; transition: border-color var(--t); flex-wrap: wrap; min-height: 56px; }
.pv-pay__method:hover { border-color: var(--accent-soft); }
.pv-pay__method.pv-is-selected { border-color: var(--accent); background: var(--bg-alt); }
.pv-pay__method input { width: 20px; height: 20px; accent-color: var(--accent); flex: 0 0 auto; }
.pv-pay__label { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .92rem; }
.pv-pay__label .pv-ico { width: 20px; height: 20px; color: var(--accent); }
.pv-pay__meta { margin-left: auto; font-size: .78rem; color: var(--text-muted); }
.pv-pay__brands { margin-left: auto; display: inline-flex; gap: .3rem; flex-wrap: wrap; }
.pv-cardmark { display: inline-flex; align-items: center; height: 22px; padding: 0 .4rem; border: 1px solid var(--line); border-radius: var(--radius); font-size: .62rem; font-weight: 700; letter-spacing: .02em; color: var(--text); background: var(--surface); }

/* ---- card fields ---- */
.pv-card-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px dashed var(--line); }
.pv-card-fields .pv-form-field { margin-bottom: 0; }
.pv-card-fields .pv-span { grid-column: 1 / -1; }
.pv-cardnum-wrap { position: relative; }
.pv-cardnum-wrap .pv-cardbrand { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: .66rem; font-weight: 700; color: var(--accent-deep); }
.pv-card-note { grid-column: 1 / -1; font-size: .78rem; color: var(--text-muted); line-height: 1.7; background: var(--bg-alt); border-radius: var(--radius); padding: .7rem .9rem; }

/* ---- confirm (step 3) ---- */
.pv-confirm__sec { padding: 1rem 0; border-bottom: 1px solid var(--line-soft); }
.pv-confirm__sec h3 { font-size: .95rem; margin-bottom: .5rem; }
.pv-confirm__row { display: flex; justify-content: space-between; gap: 1rem; font-size: .88rem; padding: .2rem 0; }
.pv-confirm__row--total { font-weight: 700; font-size: 1.05rem; border-top: 1px solid var(--line); margin-top: .4rem; padding-top: .6rem; }
.pv-confirm__hint { font-size: .82rem; color: var(--text-muted); margin-top: .4rem; }
.pv-rule { font-size: .82rem; color: var(--text-muted); background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; margin: 1rem 0; }
.pv-agree { font-size: .85rem; color: var(--text-muted); margin: 1rem 0; }
.pv-agree a { color: var(--accent-deep); text-decoration: underline; }

/* ---- processing overlay ---- */
.pv-processing { position: fixed; inset: 0; z-index: 500; background: rgba(42,27,29,.72); display: none; align-items: center; justify-content: center; }
.pv-processing.pv-is-open { display: flex; }
.pv-processing__card { background: var(--bg); border-radius: var(--radius); padding: 2.2rem 2.4rem; text-align: center; max-width: 320px; }
.pv-processing__card p { margin-top: 1rem; font-family: var(--font-head); font-size: 1.05rem; }
.pv-processing__sub { font-size: .8rem; color: var(--text-muted); margin-top: .4rem !important; font-family: var(--font-body) !important; }
.pv-spinner { width: 46px; height: 46px; margin: 0 auto; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: pvSpin .8s linear infinite; }
@keyframes pvSpin { to { transform: rotate(360deg); } }

/* ---- thanks ---- */
.pv-thanks { text-align: center; max-width: 620px; margin: 0 auto; }
.pv-thanks__ico { width: 72px; height: 72px; margin: 0 auto 1.2rem; border: 2px solid var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--accent); }
.pv-thanks__ico .pv-ico { width: 38px; height: 38px; }
.pv-thanks h1 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); }
.pv-order-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; text-align: left; margin: 1.6rem 0; }
.pv-order-box h2 { font-size: 1.05rem; margin-bottom: .8rem; }
.pv-order-box__id { font-family: var(--font-head); font-weight: 700; color: var(--accent-deep); }

/* ---- quick view ---- */
.pv-qv__dialog { position: fixed; z-index: 440; top: 50%; left: 50%; transform: translate(-50%, -48%) scale(.98); opacity: 0; visibility: hidden; width: min(860px, 94vw); max-height: 90vh; overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); display: grid; grid-template-columns: 1fr 1fr; transition: opacity var(--t), transform var(--t), visibility var(--t); }
.pv-qv__dialog.pv-is-open { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.pv-qv__media { background: var(--bg-alt); }
.pv-qv__media img { width: 100%; height: 100%; object-fit: cover; min-height: 280px; }
.pv-qv__body { padding: 1.6rem; }
.pv-qv__name { font-size: 1.4rem; margin: .3rem 0 .5rem; }
.pv-qv__close { position: absolute; top: 10px; right: 10px; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; background: rgba(250,247,241,.9); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); z-index: 2; }
.pv-qv__close .pv-ico { width: 22px; height: 22px; }
@media (max-width: 680px) {
  .pv-qv__dialog { grid-template-columns: 1fr; }
  .pv-qv__media img { min-height: 220px; max-height: 40vh; }
}

@media (max-width: 900px) {
  .pv-cartpage { grid-template-columns: 1fr; }
  .pv-summary { position: static; }
}
@media (max-width: 520px) {
  .pv-card-fields { grid-template-columns: 1fr; }
  .pv-co__toggle { flex-wrap: wrap; padding: .9rem 1rem; }
  .pv-co__summary { flex-basis: 100%; order: 3; white-space: normal; padding-left: calc(30px + .8rem); }
  .pv-co__nav { flex-direction: column-reverse; }
}

/* payment-availability notice (confirm screen + thanks) */
.pv-paynote { display: flex; gap: .7rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--accent-soft); border-left: 3px solid var(--accent-deep); border-radius: var(--radius); padding: .9rem 1.1rem; margin: 0 0 1.3rem; font-size: .86rem; line-height: 1.75; color: var(--text); text-align: left; }
.pv-paynote .pv-ico { flex: none; width: 20px; height: 20px; color: var(--accent-deep); margin-top: .15rem; }
.pv-paynote p { margin: 0; }
