/* ==========================================================================
   DRIVMAN — Cart & Checkout shared styles
   ========================================================================== */

.dm-cc-layout {
  display: flex;
  gap: var(--dm-space-4);
  align-items: flex-start;
}
.dm-cc-main {
  flex: 1;
  min-width: 0;
}
.dm-cc-summary {
  width: 360px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--dm-navbar-height) + 16px);
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius-md);
  padding: var(--dm-space-3);
}
@media (max-width: 991px) {
  .dm-cc-layout {
    flex-direction: column;
    /* Stacked: columns take the full width. With flex-start they size to
       their content, and the suggestions carousel's content is unbounded —
       the whole cart page became millions of pixels wide on phones. */
    align-items: stretch;
  }
  .dm-cc-summary {
    width: 100%;
    position: static;
  }
}

/* ---------- Cart item row ---------- */
.dm-cart-item {
  display: flex;
  gap: var(--dm-space-3);
  padding: var(--dm-space-3) 0;
  border-bottom: 1px solid var(--dm-border);
}
.dm-cart-item__media {
  width: 110px;
  height: 110px;
  flex-shrink: 0;
  border-radius: var(--dm-radius-sm);
  overflow: hidden;
  background: var(--dm-grad-media);
}
.dm-cart-item__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dm-cart-item__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.dm-cart-item__brand {
  font-size: var(--dm-fs-xs);
  color: var(--dm-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.dm-cart-item__title {
  font-size: var(--dm-fs-base);
  font-weight: 600;
  color: var(--dm-text-primary);
  margin: 4px 0 8px;
}
.dm-cart-item__title a {
  color: inherit;
}
.dm-cart-item__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
}
.dm-cart-item__actions {
  display: flex;
  align-items: center;
  gap: 18px;
}
.dm-cart-item__remove {
  color: var(--dm-text-muted);
  font-size: var(--dm-fs-xs);
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
}
.dm-cart-item__remove:hover {
  color: var(--dm-red-bright);
}
.dm-cart-item__move {
  color: var(--dm-text-muted);
  font-size: var(--dm-fs-xs);
  background: none;
  border: none;
  text-decoration: underline;
}
.dm-cart-item__price {
  text-align: right;
}
.dm-cart-item__price .dm-price {
  font-size: var(--dm-fs-md);
}
.dm-cart-item__price .dm-price--old {
  display: block;
  font-size: var(--dm-fs-xs);
}

.dm-stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--dm-border-strong);
  border-radius: var(--dm-radius-sm);
}
.dm-stepper button {
  width: 32px;
  height: 34px;
  background: transparent;
  border: none;
  color: var(--dm-text-primary);
  font-size: 15px;
}
.dm-stepper span {
  width: 32px;
  text-align: center;
  font-family: var(--dm-font-display);
  color: var(--dm-text-primary);
  font-size: var(--dm-fs-sm);
}

/* ---------- Summary box ---------- */
.dm-cc-summary h3 {
  font-size: var(--dm-fs-md);
  margin-bottom: var(--dm-space-3);
}
.dm-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--dm-fs-sm);
  color: var(--dm-text-secondary);
  padding: 8px 0;
}
.dm-summary-row.is-discount {
  color: var(--dm-success);
}
.dm-summary-row.is-total {
  border-top: 1px solid var(--dm-border);
  margin-top: 8px;
  padding-top: 14px;
  font-size: var(--dm-fs-md);
  font-weight: 700;
  color: var(--dm-text-primary);
}
.dm-coupon-box {
  display: flex;
  gap: 0;
  margin: var(--dm-space-3) 0;
}
.dm-coupon-box input {
  flex: 1;
  min-width: 0; /* let it shrink so the Apply button stays on screen */
  background: rgba(var(--dm-tint-rgb), 0.04);
  border: 1px solid var(--dm-border-strong);
  border-right: none;
  color: var(--dm-text-primary);
  padding: 12px 14px;
  border-radius: var(--dm-radius-sm) 0 0 var(--dm-radius-sm);
  font-size: var(--dm-fs-sm);
  text-transform: uppercase;
}
.dm-coupon-box button {
  border-radius: 0 var(--dm-radius-sm) var(--dm-radius-sm) 0;
  padding: 12px 18px;
}
.dm-coupon-msg {
  font-size: var(--dm-fs-xs);
  margin-bottom: var(--dm-space-2);
  display: none;
}
.dm-coupon-msg.is-success {
  color: var(--dm-success);
  display: block;
}
.dm-coupon-msg.is-error {
  color: var(--dm-red-bright);
  display: block;
}
/* The summary's full-width button rule must not stretch the Apply button. */
.dm-cc-summary .dm-coupon-box .dm-btn {
  width: auto;
  margin-top: 0;
}
.dm-coupon-applied {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: var(--dm-space-3) 0;
  padding: 10px 14px;
  border: 1px dashed var(--dm-success);
  border-radius: var(--dm-radius-sm);
  font-size: var(--dm-fs-sm);
  color: var(--dm-success);
}
.dm-coupon-applied button {
  background: none;
  border: none;
  color: var(--dm-text-muted);
  font-size: var(--dm-fs-xs);
  text-decoration: underline;
  cursor: pointer;
}
.dm-payment-deadline {
  font-size: var(--dm-fs-xs);
  color: var(--dm-text-muted);
  text-align: center;
  margin-top: var(--dm-space-2);
}
.dm-cc-summary .dm-btn {
  width: 100%;
  margin-top: var(--dm-space-2);
}
.dm-cc-secure-note {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  color: var(--dm-text-muted);
  font-size: var(--dm-fs-xs);
  margin-top: var(--dm-space-2);
}

/* ---------- Empty state ---------- */
.dm-cart-empty {
  text-align: center;
  padding: var(--dm-space-7) var(--dm-space-3);
}
.dm-cart-empty i {
  font-size: 56px;
  color: var(--dm-text-faint);
  margin-bottom: var(--dm-space-3);
  display: block;
}
.dm-cart-empty h2 {
  font-size: var(--dm-fs-lg);
  margin-bottom: 10px;
}
.dm-cart-empty p {
  color: var(--dm-text-muted);
  margin-bottom: var(--dm-space-3);
}

/* ---------- Save-for-later strip ---------- */
.dm-cart-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: var(--dm-space-4) 0;
  color: var(--dm-text-muted);
  font-size: var(--dm-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.dm-cart-divider span {
  white-space: nowrap;
}
.dm-cart-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--dm-border);
  margin-left: 14px;
}

/* ==========================================================================
   Checkout-specific styles
   ========================================================================== */

.dm-checkout-step {
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius-md);
  padding: var(--dm-space-3);
  margin-bottom: var(--dm-space-3);
}
.dm-checkout-step__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: var(--dm-space-3);
}
.dm-checkout-step__num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--dm-grad-red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--dm-font-display);
  font-weight: 700;
  font-size: var(--dm-fs-sm);
  flex-shrink: 0;
}
.dm-checkout-step__head h3 {
  font-size: var(--dm-fs-md);
}

.dm-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 575px) {
  .dm-form-grid {
    grid-template-columns: 1fr;
  }
}
.dm-form-grid .full {
  grid-column: 1 / -1;
}
.dm-field label {
  display: block;
  font-size: var(--dm-fs-xs);
  color: var(--dm-text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dm-field input,
.dm-field select,
.dm-field textarea {
  width: 100%;
  background: rgba(var(--dm-tint-rgb), 0.04);
  border: 1px solid var(--dm-border-strong);
  color: var(--dm-text-primary);
  padding: 12px 14px;
  border-radius: var(--dm-radius-sm);
  font-size: var(--dm-fs-sm);
}
.dm-field input::placeholder {
  color: var(--dm-text-faint);
}

.dm-address-card {
  border: 1px solid var(--dm-border-strong);
  border-radius: var(--dm-radius-md);
  padding: var(--dm-space-3);
  display: flex;
  gap: 14px;
  align-items: flex-start;
  cursor: pointer;
  margin-bottom: 12px;
  transition: border-color var(--dm-speed-fast) var(--dm-ease);
}
.dm-address-card.is-selected {
  border-color: var(--dm-red-bright);
  background: rgba(196, 0, 24, 0.06);
}
.dm-address-card input[type="radio"] {
  margin-top: 4px;
  accent-color: var(--dm-red);
  width: 16px;
  height: 16px;
}
.dm-address-card strong {
  color: var(--dm-text-primary);
  display: block;
}
.dm-address-card span {
  color: var(--dm-text-muted);
  font-size: var(--dm-fs-sm);
}
.dm-address-card .tag {
  display: inline-block;
  background: rgba(var(--dm-tint-rgb), 0.06);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--dm-text-secondary);
  margin-left: 8px;
}

.dm-add-address-toggle {
  color: var(--dm-red-bright);
  font-size: var(--dm-fs-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.dm-new-address-form {
  display: none;
  margin-top: var(--dm-space-3);
  padding-top: var(--dm-space-3);
  border-top: 1px solid var(--dm-border);
}
.dm-new-address-form.is-open {
  display: block;
}

.dm-delivery-option,
.dm-payment-option {
  border: 1px solid var(--dm-border-strong);
  border-radius: var(--dm-radius-md);
  padding: var(--dm-space-3);
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color var(--dm-speed-fast) var(--dm-ease);
}
.dm-delivery-option.is-selected,
.dm-payment-option.is-selected {
  border-color: var(--dm-red-bright);
  background: rgba(196, 0, 24, 0.06);
}
.dm-delivery-option input,
.dm-payment-option input {
  accent-color: var(--dm-red);
  width: 16px;
  height: 16px;
}
.dm-delivery-option i,
.dm-payment-option i {
  font-size: 18px;
  color: var(--dm-red-bright);
  width: 22px;
  text-align: center;
}
.dm-delivery-option strong,
.dm-payment-option strong {
  display: block;
  color: var(--dm-text-primary);
  font-size: var(--dm-fs-sm);
}
.dm-delivery-option span.sub,
.dm-payment-option span.sub {
  color: var(--dm-text-muted);
  font-size: var(--dm-fs-xs);
}
.dm-delivery-option .price {
  margin-left: auto;
  font-family: var(--dm-font-display);
  color: var(--dm-text-primary);
}

.dm-cc-summary .dm-order-items {
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: var(--dm-space-2);
  padding-right: 4px;
}
.dm-cc-summary .dm-order-item-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--dm-border);
}
.dm-cc-summary .dm-order-item-row img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.dm-cc-summary .dm-order-item-row .name {
  font-size: var(--dm-fs-xs);
  color: var(--dm-text-secondary);
  flex: 1;
}
.dm-cc-summary .dm-order-item-row .qty {
  font-size: var(--dm-fs-xs);
  color: var(--dm-text-muted);
}
.dm-cc-summary .dm-order-item-row .price {
  font-size: var(--dm-fs-xs);
  color: var(--dm-text-primary);
}
/* ---------- Small mobile fixes for cart item row ---------- */
@media (max-width: 480px) {
  .dm-cart-item {
    gap: 12px;
  }
  .dm-cart-item__media {
    width: 80px;
    height: 80px;
  }
  .dm-cart-item__actions {
    flex-wrap: wrap;
    gap: 10px 16px;
  }
  .dm-cart-item__title {
    font-size: var(--dm-fs-sm);
  }
}

/* ---------- Cart "You might also like" swiper ---------- */
.dm-product-swiper {
  overflow: hidden;
  padding: 4px 2px 36px;
  position: relative;
  min-height: 100px;
}

.dm-product-swiper .swiper-wrapper {
  align-items: stretch;
}

.dm-product-swiper .swiper-slide {
  height: auto;
  display: flex;
}

.dm-product-swiper .swiper-slide .dm-product-card {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.dm-product-swiper .swiper-slide .dm-product-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.dm-product-swiper .swiper-pagination {
  bottom: 6px;
}

.dm-product-swiper .swiper-pagination-bullet {
  background: var(--dm-text-muted);
  opacity: 0.5;
}

.dm-product-swiper .swiper-pagination-bullet-active {
  background: var(--dm-red-bright);
  opacity: 1;
}

/* "+" stops at the per-order / stock limit */
.dm-stepper button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Clear Cart sits under the item list, right-aligned */
.dm-cart-clear-row {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--dm-space-2);
}
