/* ==========================================================================
   Shopping Cart Page - Custom Editorial Modern Design
   Refined light borders, compact checkout button, responsive layout
   ========================================================================== */

:root {
  --cart-ink: #141416;
  --cart-ink-soft: #65656b;
  --cart-line: #e2e2e6;
  --cart-line-soft: #f0eeea;
  --cart-paper: #ffffff;
  --cart-sand: #f8f7f5;
  --cart-red: #ef011c;
  --cart-red-deep: #c40016;
  --cart-red-tint: #fee6e9;
  --cart-radius: 4px;
}

/* Base override on cart page */
.html-shopping-cart-page body,
.html-shopping-cart-page .master-wrapper-content {
  background: var(--cart-sand) !important;
}

.html-shopping-cart-page .center-1 {
  max-width: 100% !important;
  padding: 0 !important;
}

/* Eliminate browser black focus outlines on any click */
.cart-wrap button:focus,
.cart-wrap button:active,
.cart-wrap a:focus,
.cart-wrap a:active,
.cart-wrap .btn-custom:focus,
.cart-wrap .btn-custom:active,
.cart-wrap .checkout-btn:focus,
.cart-wrap .checkout-btn:active,
.cart-wrap .btn-apply:focus,
.cart-wrap .btn-apply:active,
.cart-wrap .icon-btn:focus,
.cart-wrap .icon-btn:active,
.cart-wrap .qty button:focus,
.cart-wrap .qty button:active,
.mobile-cart-bar button:focus,
.mobile-cart-bar button:active {
  outline: none !important;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- top stepper ---------- */
.stepper-bar {
  background: var(--cart-paper);
  border-bottom: 1px solid var(--cart-line);
  padding: 20px 16px 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.stepper {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  max-width: 520px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  position: relative;
}

/* Stepper line - RTL */
[dir="rtl"] .step:not(:last-child)::after,
body.rtl .step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 14px;
  right: calc(-50% + 15px);
  left: calc(50% + 15px);
  height: 2px;
  background: var(--cart-line);
  z-index: 0;
}

[dir="rtl"] .step.done:not(:last-child)::after,
body.rtl .step.done:not(:last-child)::after {
  background: var(--cart-red);
}

/* Stepper line - LTR */
[dir="ltr"] .step:not(:last-child)::after,
body:not(.rtl) .step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 14px;
  left: calc(50% + 15px);
  right: calc(-50% + 15px);
  height: 2px;
  background: var(--cart-line);
  z-index: 0;
}

[dir="ltr"] .step.done:not(:last-child)::after,
body:not(.rtl) .step.done:not(:last-child)::after {
  background: var(--cart-red);
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: var(--cart-radius);
  background: var(--cart-paper);
  border: 1.5px solid var(--cart-line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--cart-ink-soft);
  z-index: 1;
  line-height: 1;
  transition: all 0.2s ease;
}

.step.active .step-dot {
  background: var(--cart-red);
  border-color: var(--cart-red);
  color: #fff;
}

.step.done .step-dot {
  background: var(--cart-ink);
  border-color: var(--cart-ink);
  color: #fff;
}

.step-label {
  font-size: 12px;
  color: var(--cart-ink-soft);
  font-weight: 600;
  text-decoration: none;
  cursor: default;
}

a.step-label {
  cursor: pointer;
}

.step.active .step-label {
  color: var(--cart-ink);
  font-weight: 700;
}

/* ---------- page shell ---------- */
.cart-wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 16px 140px;
  text-align: start;
}

h1.cart-title {
  font-size: 26px !important;
  font-weight: 800 !important;
  text-align: center !important;
  margin: 6px 0 4px !important;
  letter-spacing: -0.01em;
  color: var(--cart-ink) !important;
  border: none !important;
}

.count-note {
  text-align: center;
  color: var(--cart-ink-soft);
  font-size: 13px;
  margin-bottom: 24px;
  margin-top: 0;
}

/* ---------- layout grid ---------- */
.cart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media(min-width: 860px) {
  .cart-grid {
    grid-template-columns: 1fr 340px;
    align-items: start;
  }
}

/* ---------- cart panel list ---------- */
.cart-panel {
  background: var(--cart-paper);
  border: 1px solid var(--cart-line);
  border-radius: var(--cart-radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.cart-panel-head {
  padding: 13px 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--cart-ink);
  border-bottom: 1px solid var(--cart-line);
  background: #fafaf9;
}

.cart-item {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 16px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--cart-line-soft);
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-thumb {
  width: 80px;
  height: 80px;
  border-radius: var(--cart-radius);
  background: var(--cart-sand);
  border: 1px solid var(--cart-line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  overflow: hidden;
  box-sizing: border-box;
}

.cart-thumb a {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.cart-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}

.cart-item-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.cart-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: nowrap;
}

.cart-item-details {
  min-width: 0;
}

.cart-item-code {
  font-weight: 700;
  font-size: 14px;
  color: var(--cart-ink);
}

.cart-product-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--cart-ink);
  text-decoration: none;
  display: block;
  margin-top: 2px;
}

.cart-product-name:hover {
  color: var(--cart-red);
}

.cart-item-attrs {
  font-size: 12.5px;
  color: var(--cart-ink-soft);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.cart-item-top .link-btn {
  flex-shrink: 0;
}

.cart-item-bottom {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--cart-line);
}

.price-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.unit-price {
  font-size: 12px;
  color: var(--cart-ink-soft);
  white-space: nowrap;
}

.unit-price b {
  color: var(--cart-ink);
  font-weight: 700;
}

.item-total {
  font-weight: 800;
  font-size: 16px;
  white-space: nowrap;
  color: var(--cart-ink);
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

/* Quantity Stepper */
.qty {
  display: flex;
  align-items: center;
  border: 1px solid var(--cart-line);
  border-radius: var(--cart-radius);
  overflow: hidden;
  height: 36px;
  background: var(--cart-paper);
}

.qty button {
  width: 34px;
  height: 36px;
  border: none;
  background: var(--cart-sand);
  color: var(--cart-ink);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background 0.15s ease;
}

.qty button:hover {
  background: var(--cart-line-soft);
}

.qty button:active {
  background: #e0deda;
}

.qty input.qty-input-box {
  width: 38px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  border-top: none;
  border-bottom: none;
  border-right: 1px solid var(--cart-line);
  border-left: 1px solid var(--cart-line);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cart-paper);
  color: var(--cart-ink);
  padding: 0;
  box-shadow: none;
  border-radius: 0;
  outline: none;
}

.link-btn {
  background: none;
  border: none;
  color: var(--cart-red);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  border-bottom: 1.5px solid var(--cart-red);
  text-decoration: none;
  flex-shrink: 0;
}

.link-btn:hover {
  color: var(--cart-red-deep);
  border-bottom-color: var(--cart-red-deep);
}

.icon-btn {
  background: none;
  border: 1px solid var(--cart-line);
  color: var(--cart-ink-soft);
  cursor: pointer;
  padding: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--cart-radius);
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: #fee6e9;
  border-color: #fee6e9;
  color: var(--cart-red);
}

.cart-panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  background: #fafaf9;
  border-top: 1px solid var(--cart-line);
  flex-wrap: wrap;
}

.btn-custom {
  border: 1px solid var(--cart-line);
  border-radius: var(--cart-radius);
  padding: 10px 18px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-custom-ghost {
  background: var(--cart-ink);
  color: #fff;
  border-color: var(--cart-ink);
}

.btn-custom-ghost:hover {
  background: #000;
  border-color: #000;
  color: #fff;
}

.btn-custom-line {
  background: #fff;
  color: var(--cart-ink);
  border: 1px solid var(--cart-line);
}

.btn-custom-line:hover {
  border-color: var(--cart-ink);
  color: var(--cart-ink);
}

/* ---------- discount panel ---------- */
.discount-panel {
  background: var(--cart-paper);
  border: 1px solid var(--cart-line);
  border-radius: var(--cart-radius);
  padding: 18px;
  margin-top: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.discount-panel label {
  font-weight: 700;
  font-size: 13.5px;
  display: block;
  margin-bottom: 8px;
  color: var(--cart-ink);
}

.discount-form {
  display: flex;
  gap: 0;
}

[dir="rtl"] .discount-form input,
body.rtl .discount-form input {
  flex: 1;
  border: 1px solid var(--cart-line);
  border-left: none;
  border-radius: 0 var(--cart-radius) var(--cart-radius) 0;
  padding: 0 14px;
  height: 42px;
  font-family: inherit;
  font-size: 13.5px;
  background: var(--cart-sand);
  color: var(--cart-ink);
}

[dir="ltr"] .discount-form input,
body:not(.rtl) .discount-form input,
.discount-form input {
  flex: 1;
  border: 1px solid var(--cart-line);
  border-right: none;
  border-radius: var(--cart-radius) 0 0 var(--cart-radius);
  padding: 0 14px;
  height: 42px;
  font-family: inherit;
  font-size: 13.5px;
  background: var(--cart-sand);
  color: var(--cart-ink);
}

.discount-form input::placeholder {
  color: #a3a29e;
}

.discount-form input:focus {
  outline: none;
  background: var(--cart-paper);
}

.btn-apply {
  background: var(--cart-red);
  color: #fff;
  height: 42px;
  padding: 0 20px;
  font-weight: 700;
  font-size: 13px;
  border: 1px solid var(--cart-red);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  white-space: nowrap;
}

[dir="rtl"] .btn-apply,
body.rtl .btn-apply {
  border-radius: var(--cart-radius) 0 0 var(--cart-radius);
}

[dir="ltr"] .btn-apply,
body:not(.rtl) .btn-apply {
  border-radius: 0 var(--cart-radius) var(--cart-radius) 0;
}

.btn-apply:hover {
  background: var(--cart-red-deep);
  border-color: var(--cart-red-deep);
  color: #fff;
}

/* ---------- summary card ---------- */
.cart-summary {
  background: var(--cart-paper);
  border: 1px solid var(--cart-line);
  border-radius: var(--cart-radius);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.cart-summary h3 {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 700;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--cart-line);
  text-transform: none;
  color: var(--cart-ink);
}

.sum-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  font-size: 13.5px;
  color: var(--cart-ink-soft);
}

.sum-row b {
  color: var(--cart-ink);
  font-weight: 600;
}

.sum-row.pending b {
  color: #8a6a00;
  font-weight: 700;
  font-size: 12.5px;
}

.sum-div {
  border-top: 1px solid var(--cart-line);
  margin: 10px 0;
}

.sum-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0 2px;
}

.sum-total .label {
  font-weight: 800;
  font-size: 15px;
  color: var(--cart-ink);
}

.sum-total .value {
  font-weight: 800;
  font-size: 15px;
  color: var(--cart-red);
}

[dir="rtl"] .sum-total .value,
body.rtl .sum-total .value {
  text-align: left;
}

[dir="ltr"] .sum-total .value,
body:not(.rtl) .sum-total .value {
  text-align: right;
}

.sum-total .value small {
  display: block;
  font-weight: 600;
  font-size: 11px;
  color: var(--cart-ink-soft);
}

/* Compact Checkout Button */
.checkout-btn {
  width: 100%;
  margin-top: 16px;
  background: var(--cart-red);
  color: #fff;
  border: 1px solid var(--cart-red);
  border-radius: var(--cart-radius);
  height: 48px;
  padding: 0 18px;
  font-size: 14.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.checkout-btn:hover {
  background: var(--cart-red-deep);
  border-color: var(--cart-red-deep);
  color: #fff;
}

/* Universal compact arrow svg rule */
.checkout-btn svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
  vertical-align: middle;
}

[dir="rtl"] .checkout-btn svg,
body.rtl .checkout-btn svg {
  transform: scaleX(-1);
}

[dir="ltr"] .checkout-btn svg,
body:not(.rtl) .checkout-btn svg {
  transform: none;
}

.secure-note {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--cart-ink-soft);
}

/* ---------- mobile sticky checkout bar ---------- */
.mobile-cart-bar {
  display: none;
}

@media(max-width: 859px) {
  .mobile-cart-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--cart-paper);
    border-top: 1px solid var(--cart-line);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    z-index: 1000;
    box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.06);
  }

  .mobile-cart-bar .mb-total {
    display: flex;
    flex-direction: column;
  }

  .mobile-cart-bar .mb-total span {
    font-size: 11px;
    color: var(--cart-ink-soft);
    font-weight: 600;
  }

  .mobile-cart-bar .mb-total b {
    font-size: 16px;
    font-weight: 800;
    color: var(--cart-ink);
  }

  .mobile-cart-bar .checkout-btn {
    width: auto;
    flex: 1;
    max-width: 180px;
    height: 44px;
    margin: 0;
    padding: 0 14px;
    font-size: 13.5px;
  }

  .cart-summary .checkout-btn,
  .cart-summary .secure-note {
    display: none;
  }

  .cart-summary {
    margin-top: 18px;
  }
}

@media(min-width: 860px) {
  .cart-summary {
    position: sticky;
    top: 96px;
  }
}

/* ---------- empty cart panel ---------- */
.cart-empty-panel {
  background: var(--cart-paper);
  border: 1px solid var(--cart-line);
  border-radius: var(--cart-radius);
  padding: 48px 24px;
  text-align: center;
}

.cart-empty-icon {
  color: var(--cart-ink-soft);
  margin-bottom: 16px;
}

.cart-empty-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--cart-ink);
  margin-bottom: 18px;
}

/* ---------- small phones ---------- */
@media(max-width: 480px) {
  .stepper-bar {
    padding: 14px 10px 10px;
  }

  .stepper {
    gap: 0;
  }

  .step-dot {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .step-label {
    font-size: 10.5px;
  }

  [dir="rtl"] .step:not(:last-child)::after,
  [dir="ltr"] .step:not(:last-child)::after,
  body.rtl .step:not(:last-child)::after,
  body:not(.rtl) .step:not(:last-child)::after {
    top: 12px;
  }

  .cart-wrap {
    padding: 18px 12px 120px;
  }

  h1.cart-title {
    font-size: 22px !important;
  }

  .count-note {
    font-size: 12px;
    margin-bottom: 18px;
  }

  .cart-panel-head {
    padding: 10px 14px;
    font-size: 12px;
  }

  .cart-item {
    grid-template-columns: 60px 1fr;
    gap: 12px;
    padding: 14px 12px;
  }

  .cart-thumb {
    width: 60px;
    height: 60px;
    padding: 2px;
  }

  .cart-item-code {
    font-size: 13px;
  }

  .cart-product-name {
    font-size: 13.5px;
  }

  .cart-item-attrs {
    font-size: 11.5px;
    gap: 6px;
  }

  .link-btn {
    font-size: 12px;
  }

  .price-line {
    flex-wrap: wrap;
  }

  .unit-price {
    font-size: 11px;
  }

  .item-total {
    font-size: 14.5px;
  }

  .qty {
    height: 34px;
  }

  .qty button {
    width: 32px;
    height: 34px;
    font-size: 15px;
  }

  .qty input.qty-input-box {
    width: 32px;
    font-size: 13px;
  }

  .icon-btn {
    padding: 6px;
  }

  .cart-panel-actions {
    padding: 12px;
    gap: 8px;
  }

  .btn-custom {
    padding: 9px 12px;
    font-size: 12px;
    flex: 1;
    text-align: center;
  }

  .discount-panel {
    padding: 14px;
    margin-top: 14px;
  }

  .discount-form input {
    font-size: 12.5px;
    padding: 0 10px;
    height: 38px;
  }

  .btn-apply {
    padding: 0 14px;
    font-size: 12px;
    height: 38px;
  }

  .mobile-cart-bar .mb-total b {
    font-size: 14.5px;
  }

  .mobile-cart-bar .checkout-btn {
    font-size: 13px;
    height: 40px;
    max-width: 150px;
  }
}
