/* ==========================================================================
   FlagsExpo redesign V1 (Figma) — Shopping cart page
   ========================================================================== */

.v2-cartpage, .v2-cartpage * { box-sizing: border-box; font-family: var(--v2-font); }

/* ---------- Checkout step indicator ---------- */
.v2-cart-steps { display: flex; align-items: center; gap: 8px; margin-bottom: 40px; }
.v2-cart-step { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.v2-cart-step-num {
  width: 28px; height: 28px; border-radius: 50%; background: #efefef; color: #888a8f;
  font-family: var(--v2-font); font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.v2-cart-step-label { font-family: var(--v2-font); font-weight: 500; font-size: 14px; color: #888a8f; white-space: nowrap; }
.v2-cart-step.is-active .v2-cart-step-num { background: var(--v2-navy); color: #fff; }
.v2-cart-step.is-active .v2-cart-step-label { color: #021433; }
.v2-cart-step.is-done .v2-cart-step-num { background: #1a7a3c; color: #fff; }
.v2-cart-step.is-done .v2-cart-step-label { color: #021433; }
.v2-cart-step-link { color: inherit; text-decoration: none; }
.v2-cart-step-link:hover { text-decoration: underline; }
.v2-cart-step-line { flex: 1 1 40px; height: 1px; background: #efefef; min-width: 20px; }

.v2-cart-title { font-family: var(--v2-font-display); font-weight: 500; font-size: 40px; color: #021433; margin: 0 0 32px; }
.v2-cart-title span { font-family: var(--v2-font); font-weight: 400; font-size: 20px; color: rgba(2,20,51,0.6); margin-left: 12px; }

.v2-cart-layout { display: flex; gap: 32px; align-items: flex-start; }
.v2-cart-main { flex: 1 1 0; min-width: 0; }
.v2-cart-side { flex: 0 0 348px; }

.v2-cart-head { background: var(--v2-navy); color: #fff; display: flex; align-items: center; gap: 8px; padding: 16px 16px 16px 32px; font-family: var(--v2-font-display); font-weight: 500; font-size: 18px; border: 1px solid #efefef; }
.v2-cart-head-product { flex: 1 1 0; }
.v2-cart-head-meta { display: flex; gap: 40px; flex: 0 0 auto; }
.v2-cart-head-meta span:nth-child(1) { width: 130px; }
.v2-cart-head-meta span:nth-child(2) { width: 96px; }
.v2-cart-head-meta span:nth-child(3) { width: 83px; text-align: right; }

.v2-cart-row { background: #fff; border: 1px solid #efefef; border-top: none; display: flex; align-items: center; gap: 8px; padding: 24px 16px 24px 0; }
.v2-cart-row-product { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 8px; padding-left: 32px; }
/* Sized to the image, not a fixed box: the container shrinks/grows around
   whatever the actual (small) product thumbnail is, capped so an unusually
   large image can't blow out the row. */
.v2-cart-row-media { background: #f9f9f9; flex-shrink: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 14px; }
.v2-cart-row-media img { max-width: 130px; max-height: 130px; width: auto; height: auto; object-fit: contain; }
.v2-cart-row-info { flex: 1 1 0; min-width: 0; padding: 16px 16px 16px; display: flex; flex-direction: column; gap: 16px; }
.v2-cart-row-name { font-family: var(--v2-font-display); font-weight: 500; font-size: 18px; color: #021433; margin: 0; }
.v2-cart-row-size { font-family: var(--v2-font-display); font-weight: 500; font-size: 14px; color: #b0b1b4; margin: 0; }
.v2-cart-row-remove { display: flex; align-items: center; gap: 8px; background: none; border: none; padding: 0; cursor: pointer; font-family: var(--v2-font-display); font-weight: 500; font-size: 14px; color: #b90600; }
.v2-cart-row-remove img { width: 20px; height: 20px; }

/* flex:0 0 auto + a fixed gap mirrors .v2-cart-head-meta exactly (same
   130/96/83 column widths, same 40px gap) so the two stay lined up at any
   viewport width instead of the row's columns spreading out via
   space-between while the head stays a fixed compact block. */
.v2-cart-row-meta { flex: 0 0 auto; display: flex; align-items: center; gap: 40px; }
.v2-cart-qty { border: 1px solid #efefef; display: flex; align-items: center; justify-content: space-between; width: 130px; padding: 16px 24px; flex-shrink: 0; box-sizing: border-box; }
.v2-cart-qty button { background: none; border: none; width: 16px; height: 16px; cursor: pointer; padding: 0; }
.v2-cart-qty button img { width: 16px; height: 16px; display: block; }
.v2-cart-qty input { width: 30px; border: none; text-align: center; font-family: var(--v2-font); font-size: 16px; color: #1c1c1c; background: transparent; }

.v2-cart-price { width: 96px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; white-space: nowrap; }
.v2-cart-price-was { font-size: 14px; color: #b0b1b4; text-decoration: line-through; }
.v2-cart-price-now { font-size: 20px; color: #021433; }
.v2-cart-linetotal { width: 83px; flex-shrink: 0; text-align: right; font-weight: 500; font-size: 20px; color: #021433; white-space: nowrap; }

.v2-cart-footbar { background: #f9f9f9; border: 1px solid #efefef; border-top: none; display: flex; align-items: center; gap: 36px; padding: 24px 16px 24px 32px; flex-wrap: wrap; }
.v2-cart-continue { display: flex; align-items: center; gap: 16px; text-decoration: none; flex-shrink: 0; }
.v2-cart-continue-icon { background: #c8102e; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.v2-cart-continue-icon img { width: 24px; height: 24px; }
.v2-cart-continue span { font-family: var(--v2-font-display); font-weight: 500; font-size: 18px; color: #021433; }

.v2-cart-coupon { flex: 1 1 0; min-width: 260px; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.v2-cart-coupon input { flex: 1 1 0; min-width: 0; background: #fff; border: none; padding: 12px 16px; font-size: 14px; color: #1c1c1c; }
.v2-cart-coupon-btn { flex: 0 0 auto; background: var(--v2-navy); border: none; padding: 16px 24px; color: #fff; font-weight: 600; font-size: 16px; cursor: pointer; }
.v2-cart-coupon-btn:hover { background: var(--v2-navy-dark); }
.v2-cart-coupon-error { flex-basis: 100%; color: #b90600; font-size: 14px; display: none; }

.v2-cart-summary-head { background: var(--v2-navy); color: #fff; padding: 16px; font-family: var(--v2-font-display); font-weight: 700; font-size: 18px; border: 1px solid #efefef; }
.v2-cart-summary-row { background: #fff; border: 1px solid #efefef; border-top: none; display: flex; align-items: center; justify-content: space-between; padding: 28px 16px; font-size: 16px; }
.v2-cart-summary-row span:first-child { color: #888a8f; }
.v2-cart-summary-row span:last-child { color: #021433; font-weight: 500; }
.v2-cart-summary-row.is-discount span:last-child { color: #5cb531; }

.v2-cart-summary-total { background: #fff; border: 1px solid #efefef; border-top: none; padding: 28px 16px; display: flex; flex-direction: column; gap: 28px; }
.v2-cart-summary-total-row { display: flex; align-items: center; justify-content: space-between; }
.v2-cart-summary-total-row span:first-child { font-weight: 700; font-size: 16px; color: #000; }
.v2-cart-summary-total-row span:last-child { font-weight: 700; font-size: 24px; color: #021433; }
.v2-cart-summary-note { font-size: 14px; color: #888a8f; margin: 0; }

.v2-cart-checkout {
  background: var(--v2-navy); border: none; color: #fff; display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 16px 32px; font-family: var(--v2-font); font-weight: 600; font-size: 16px; cursor: pointer; width: 100%;
}
.v2-cart-checkout:hover { background: var(--v2-navy-dark); }
.v2-cart-checkout-icon { width: 24px; height: 24px; flex-shrink: 0; }

.v2-cart-related { margin-top: 96px; }
.v2-cart-related-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 48px; flex-wrap: wrap; }
.v2-cart-related-title { font-family: var(--v2-font-display); font-weight: 400; font-size: 56px; line-height: 0.96; color: #021433; margin: 0; }

@media (max-width: 1279px) {
  .v2-cart-title { font-size: 32px; }
  .v2-cart-related-title { font-size: 44px; }
}

@media (max-width: 1023px) {
  .v2-cart-layout { flex-direction: column; }
  .v2-cart-side { flex: none; width: 100%; }
  .v2-cart-row { flex-wrap: wrap; }
  .v2-cart-row-product { flex: 1 1 100%; }
  .v2-cart-row-meta { flex: 1 1 100%; padding-left: 32px; margin-top: 16px; }
}

@media (max-width: 640px) {
  .v2-cart-title { font-size: 26px; }
  .v2-cart-related-title { font-size: 32px; }
  /* .v2-cart-coupon's 260px min-width doesn't fit inside the footbar's own
     32px+16px padding on a phone (232px available at 320px) — this was the
     second cause of the page-wide horizontal scroll. */
  .v2-cart-footbar { flex-direction: column; align-items: stretch; padding: 20px 16px; }
  .v2-cart-coupon { min-width: 0; width: 100%; }
  .v2-cart-row-meta { flex-direction: column; align-items: flex-start; gap: 16px; }
  .v2-cart-empty { padding: 56px 20px; }
  .v2-cart-empty-title { font-size: 24px; }
  .v2-modal { padding: 24px; }
  .v2-modal-actions { flex-direction: column; }
  /* Step indicator: 4 circles + 3 connector lines were flex-shrink:0 with
     min-width:20px each, so they never actually shrank on a phone — that's
     what was forcing the whole page to side-scroll. Shrink the circles and
     let the lines collapse down to a hairline instead of a fixed 20px. */
  .v2-cart-steps { gap: 4px; }
  .v2-cart-step { gap: 6px; }
  .v2-cart-step-num { width: 22px; height: 22px; font-size: 11px; }
  .v2-cart-step:not(.is-active) .v2-cart-step-label { display: none; }
  .v2-cart-step-line { flex-basis: 10px; min-width: 6px; }

  /* Shrink the thumbnail cap so the name/size/remove column isn't squeezed
     next to a large image on a narrow phone (still sized to the image, not
     a fixed box). */
  .v2-cart-row-media { padding: 8px; }
  .v2-cart-row-media img { max-width: 70px; max-height: 70px; }

  /* The 3-column head bar (Quantity / Unit Price / Total) is a fixed ~390px
     wide block that doesn't fit next to "Product" on a phone — once the row
     itself stacks its meta below the product (see 1023px block above), the
     head bar is redundant, so hide it and label each stacked value instead. */
  .v2-cart-head { display: none; }
  .v2-cart-qty::before,
  .v2-cart-price::before,
  .v2-cart-linetotal::before {
    content: 'Qty';
    font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
    color: #888a8f;
  }
  .v2-cart-qty { width: auto; flex-wrap: wrap; justify-content: flex-start; gap: 8px 12px; padding: 12px 16px; }
  .v2-cart-qty::before { flex-basis: 100%; }
  .v2-cart-price { align-items: flex-start; }
  .v2-cart-price::before { content: 'Unit Price'; }
  .v2-cart-linetotal { display: flex; align-items: center; gap: 8px; }
  .v2-cart-linetotal::before { content: 'Total'; }
}

/* ---------- Empty cart state ---------- */
.v2-cart-empty {
  display: none; flex-direction: column; align-items: center; text-align: center; gap: 16px;
  padding: 96px 24px; background: #f9f9f9; border: 1px solid #efefef;
}
.v2-cart-empty-title { font-family: var(--v2-font-display); font-weight: 500; font-size: 32px; color: #021433; margin: 0; }
.v2-cart-empty-body { font-size: 16px; color: rgba(2,20,51,0.7); margin: 0 0 8px; max-width: 420px; }

/* ---------- Confirm dialog (remove item) ---------- */
.v2-modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(2,20,51,0.55); z-index: 1000;
  align-items: center; justify-content: center; padding: 24px;
}
.v2-modal-overlay.is-open { display: flex; }
.v2-modal { background: #fff; max-width: 400px; width: 100%; padding: 32px; text-align: center; }
.v2-modal-title { font-family: var(--v2-font-display); font-weight: 500; font-size: 22px; color: #021433; margin: 0 0 12px; }
.v2-modal-body { font-size: 15px; color: rgba(2,20,51,0.7); margin: 0 0 28px; }
.v2-modal-actions { display: flex; gap: 12px; }
.v2-modal-btn { flex: 1 1 0; padding: 14px; font-family: var(--v2-font); font-weight: 600; font-size: 15px; cursor: pointer; border: none; }
.v2-modal-btn-cancel { background: #f0f0f0; color: #021433; }
.v2-modal-btn-cancel:hover { background: #e4e4e4; }
.v2-modal-btn-confirm { background: #b90600; color: #fff; }
.v2-modal-btn-confirm:hover { background: #941504; }
