/* =====================================================================
   BirTool.az — Cart & Checkout  ·  css/checkout.css
   step indicator · cart items · qty stepper · order summary ·
   checkout form · COD payment · success screen · empty cart ·
   mobile sticky action bar
   Depends on css/style.css (+ css/shell.css for header/footer)
   ===================================================================== */

.flow-wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ===================== STEP INDICATOR ===================== */
.steps { display: flex; align-items: center; justify-content: center; gap: 0; padding: 28px 0 8px; }
.step { display: flex; align-items: center; gap: 12px; }
.step__dot {
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gray-200); color: var(--gray-500);
  font-weight: 800; font-size: var(--fs-sm);
  border: 2px solid var(--gray-200); transition: all var(--dur) var(--ease);
}
.step__dot svg { width: 18px; height: 18px; }
.step__label { font-size: var(--fs-sm); font-weight: 700; color: var(--gray-500); white-space: nowrap; }
.step__line { width: clamp(40px, 9vw, 110px); height: 2px; background: var(--gray-200); margin: 0 14px; }
.step.is-done .step__dot { background: var(--success); border-color: var(--success); color: #fff; }
.step.is-done .step__label { color: var(--success-text); }
.step.is-done + .step__line { background: var(--success); }
.step.is-active .step__dot { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--red-100); }
.step.is-active .step__label { color: var(--text-strong); }
@media (max-width: 560px){
  .step__label { display: none; }
  .step.is-active .step__label { display: inline; }
  .step__line { margin: 0 8px; }
}

/* page title */
.flow-title { display: flex; align-items: center; gap: 12px; margin: 22px 0 22px; }
.flow-title .ic { width: 40px; height: 40px; flex: none; border-radius: var(--radius-md); background: var(--red-50); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; }
.flow-title .ic svg { width: 22px; height: 22px; }
.flow-title h1 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); font-weight: 800; color: var(--text-strong); letter-spacing: -0.02em; margin: 0; }
.flow-title .muted { font-size: var(--fs-sm); color: var(--text-muted); font-weight: 600; margin-left: auto; }

/* ===================== LAYOUT ===================== */
.flow-grid { display: grid; grid-template-columns: 1fr 372px; gap: 28px; align-items: start; padding-bottom: 56px; }
@media (max-width: 920px){ .flow-grid { grid-template-columns: 1fr; } }

/* ===================== CART ITEMS ===================== */
.cart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.cart-item {
  display: grid; grid-template-columns: 92px 1fr auto auto 40px;
  align-items: center; gap: 18px; padding: 20px; border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: none; }
.cart-item__media { width: 92px; height: 92px; border-radius: var(--radius-md); background: var(--gray-50); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--gray-300); overflow: hidden; }
.cart-item__media svg { width: 44px; height: 44px; }
.cart-item__media img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.cart-item__info { min-width: 0; }
.cart-item__brand { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.cart-item__name { font-size: var(--fs-base); font-weight: 700; color: var(--text-strong); line-height: 1.3; margin: 3px 0 6px; }
.cart-item__unit { font-size: var(--fs-sm); color: var(--gray-500); font-weight: 600; }
.cart-item__unit b { color: var(--text-strong); }
.cart-item__stock { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 700; color: var(--success-text); margin-top: 6px; }
.cart-item__stock svg { width: 13px; height: 13px; }
.cart-item__total { font-size: var(--fs-lg); font-weight: 800; color: var(--text-strong); white-space: nowrap; text-align: right; min-width: 96px; }
.cart-item__remove { width: 40px; height: 40px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--gray-400); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all var(--dur) var(--ease); }
.cart-item__remove svg { width: 18px; height: 18px; }
.cart-item__remove:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }

/* qty stepper */
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.qty button { width: 38px; height: 40px; border: none; background: var(--surface); color: var(--text-strong); cursor: pointer; font-size: 1.1rem; display: inline-flex; align-items: center; justify-content: center; transition: background var(--dur) var(--ease); }
.qty button svg { width: 16px; height: 16px; }
.qty button:hover { background: var(--gray-100); color: var(--primary); }
.qty button:disabled { color: var(--gray-300); cursor: not-allowed; }
.qty input { width: 44px; height: 40px; border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border); text-align: center; font: inherit; font-weight: 800; color: var(--text-strong); -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

@media (max-width: 620px){
  .cart-item { grid-template-columns: 76px 1fr auto; grid-template-areas: "media info remove" "media qty total"; gap: 10px 14px; row-gap: 14px; }
  .cart-item__media { width: 76px; height: 76px; grid-area: media; align-self: start; }
  .cart-item__info { grid-area: info; }
  .cart-item .qty { grid-area: qty; align-self: end; }
  .cart-item__total { grid-area: total; align-self: end; text-align: right; min-width: 0; }
  .cart-item__remove { grid-area: remove; align-self: start; justify-self: end; }
}

/* cart footer actions */
.cart-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; flex-wrap: wrap; }
.cart-actions .link-danger { display: inline-flex; align-items: center; gap: 7px; background: none; border: none; cursor: pointer; font-size: var(--fs-sm); font-weight: 700; color: var(--gray-500); }
.cart-actions .link-danger svg { width: 16px; height: 16px; }
.cart-actions .link-danger:hover { color: var(--danger); }

/* ===================== ORDER SUMMARY ===================== */
.summary { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 16px; }
.summary__card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; }
.summary__title { display: flex; align-items: center; gap: 10px; font-size: var(--fs-lg); font-weight: 800; color: var(--text-strong); margin: 0 0 18px; }
.summary__title svg { width: 20px; height: 20px; color: var(--primary); }

/* mini line items (checkout summary) */
.summary__items { display: flex; flex-direction: column; gap: 12px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.sitem { display: flex; align-items: center; gap: 12px; }
.sitem__media { width: 46px; height: 46px; flex: none; border-radius: var(--radius-sm); background: var(--gray-50); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--gray-300); }
.sitem__media svg { width: 24px; height: 24px; }
.sitem__info { flex: 1; min-width: 0; }
.sitem__name { font-size: var(--fs-sm); font-weight: 700; color: var(--text-strong); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.sitem__meta { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; }
.sitem__price { font-size: var(--fs-sm); font-weight: 800; color: var(--text-strong); white-space: nowrap; }

.sumrow { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; font-size: var(--fs-sm); font-weight: 600; color: var(--gray-600); }
.sumrow .val { font-weight: 700; color: var(--text-strong); }
.sumrow .free { color: var(--success-text); font-weight: 800; }
.sumrow--total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 16px; }
.sumrow--total .lbl { font-size: var(--fs-lg); font-weight: 800; color: var(--text-strong); }
.sumrow--total .val { font-size: 1.5rem; font-weight: 900; color: var(--text-strong); letter-spacing: -0.02em; }

/* COD reassurance */
.cod-box { display: flex; gap: 12px; padding: 14px 16px; background: var(--success-bg); border: 1px solid #bfe7d0; border-radius: var(--radius-md); margin-top: 16px; }
.cod-box svg { width: 22px; height: 22px; flex: none; color: var(--success-text); margin-top: 1px; }
.cod-box b { display: block; color: var(--success-text); font-size: var(--fs-sm); }
.cod-box span { font-size: var(--fs-xs); color: var(--success-text); opacity: .85; line-height: 1.5; }

.summary__cta { margin-top: 16px; }
.summary__cta .btn { font-size: var(--fs-lg); }

/* trust list under summary */
.trust-list { display: flex; flex-direction: column; gap: 12px; padding: 4px 2px; }
.trust-list li { display: flex; align-items: center; gap: 11px; font-size: var(--fs-sm); font-weight: 600; color: var(--gray-600); }
.trust-list svg { width: 18px; height: 18px; flex: none; color: var(--primary); }
.trust-list b { color: var(--text-strong); }

.back-link { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 700; color: var(--gray-500); margin-top: 2px; justify-content: center; }
.back-link svg { width: 16px; height: 16px; }
.back-link:hover { color: var(--primary); }

/* ===================== CHECKOUT FORM ===================== */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 26px 28px; }
.fsection + .fsection { margin-top: 30px; padding-top: 30px; border-top: 1px solid var(--border); }
.fsection__head { display: flex; align-items: center; gap: 11px; margin-bottom: 20px; }
.fsection__num { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--navy-800); color: #fff; font-weight: 800; font-size: var(--fs-sm); display: inline-flex; align-items: center; justify-content: center; }
.fsection__head h2 { font-size: var(--fs-h4); font-weight: 800; color: var(--text-strong); margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 520px){ .form-grid { grid-template-columns: 1fr; } }

/* payment method (single COD) */
.pay-method {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  border: 2px solid var(--primary); background: var(--red-50); border-radius: var(--radius-md); cursor: pointer;
}
.pay-method__ic { width: 44px; height: 44px; flex: none; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--red-200); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; }
.pay-method__ic svg { width: 24px; height: 24px; }
.pay-method__txt b { display: block; color: var(--text-strong); font-size: var(--fs-base); font-weight: 800; }
.pay-method__txt span { font-size: var(--fs-sm); color: var(--gray-600); }
.pay-method__radio { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--primary); display: inline-flex; align-items: center; justify-content: center; }
.pay-method__radio::after { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--primary); }

.safe-banner { display: flex; align-items: center; gap: 12px; padding: 16px 18px; margin-top: 18px; background: var(--success-bg); border: 1px solid #bfe7d0; border-radius: var(--radius-md); }
.safe-banner svg { width: 24px; height: 24px; flex: none; color: var(--success-text); }
.safe-banner p { margin: 0; font-size: var(--fs-sm); font-weight: 700; color: var(--success-text); }
.safe-banner p span { font-weight: 500; opacity: .9; }

/* ===================== SUCCESS SCREEN ===================== */
.success { max-width: 720px; margin: 0 auto; padding: 24px 0 64px; }
.success__hero { text-align: center; padding: 16px 0 8px; }
.success__check { width: 96px; height: 96px; margin: 0 auto 22px; border-radius: 50%; background: var(--success-bg); color: var(--success); display: flex; align-items: center; justify-content: center; position: relative; }
.success__check svg { width: 52px; height: 52px; }
.success__check::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 2px solid #bfe7d0; }
.success__hero h2 { font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.4rem); font-weight: 900; color: var(--text-strong); letter-spacing: -0.02em; margin: 0 0 10px; }
.success__hero p { font-size: var(--fs-lg); color: var(--gray-600); margin: 0; }
.order-no { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; padding: 10px 20px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-full); font-weight: 700; color: var(--gray-600); }
.order-no b { color: var(--primary); font-size: var(--fs-lg); letter-spacing: .02em; }

.recap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; margin-top: 28px; }
.recap__head { font-size: var(--fs-base); font-weight: 800; color: var(--text-strong); margin: 0 0 16px; display: flex; align-items: center; gap: 9px; }
.recap__head svg { width: 19px; height: 19px; color: var(--primary); }
.recap__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
@media (max-width: 560px){ .recap__grid { grid-template-columns: 1fr; } }
.recap__field .k { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.recap__field .v { font-size: var(--fs-sm); font-weight: 700; color: var(--text-strong); }
.recap__items { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.recap__total { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 16px; display: flex; align-items: center; justify-content: space-between; }
.recap__total .lbl { font-weight: 800; color: var(--text-strong); }
.recap__total .v { font-size: 1.4rem; font-weight: 900; color: var(--text-strong); }

/* next steps */
.next-steps { margin-top: 28px; }
.next-steps h3 { font-size: var(--fs-base); font-weight: 800; color: var(--text-strong); margin: 0 0 16px; }
.next-steps__row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 620px){ .next-steps__row { grid-template-columns: 1fr; } }
.nstep { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px; }
.nstep__ic { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--red-50); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.nstep__ic svg { width: 21px; height: 21px; }
.nstep b { display: block; font-size: var(--fs-sm); color: var(--text-strong); margin-bottom: 4px; }
.nstep span { font-size: var(--fs-xs); color: var(--gray-500); line-height: 1.5; }
.success__ctas { display: flex; gap: 12px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }

/* ===================== EMPTY CART ===================== */
.empty-state { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 64px 32px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.empty-state__icon { width: 104px; height: 104px; border-radius: 50%; background: var(--gray-100); color: var(--gray-400); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 24px; }
.empty-state__icon svg { width: 50px; height: 50px; }
.empty-state h2 { font-size: var(--fs-h2); font-weight: 800; color: var(--text-strong); margin: 0 0 10px; }
.empty-state p { color: var(--gray-600); font-size: var(--fs-lg); margin: 0 0 28px; max-width: 440px; line-height: 1.55; }
.empty-state__ctas { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ===================== MOBILE STICKY BAR ===================== */
.sticky-bar { display: none; }
@media (max-width: 920px){
  .summary { position: static; }
  .sticky-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -6px 20px rgba(15,19,31,.10);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    display: flex; align-items: center; gap: 14px;
  }
  .sticky-bar__total { display: flex; flex-direction: column; line-height: 1.1; }
  .sticky-bar__total .k { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 700; }
  .sticky-bar__total .v { font-size: 1.3rem; font-weight: 900; color: var(--text-strong); }
  .sticky-bar .btn { flex: 1; }
  .flow-has-bar { padding-bottom: 84px; }
}
