/* Foxtrot Mike — Cart (mockup 04). */

/* ========== Cart (mockup 04) ========== */
/* index.php also wraps Cart page — let .fm-cart own the measure (no double gutters) */
.fm-is-cart .fm-page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Hide WP page title ("Cart"); cart template prints "Shopping Cart" */
.fm-is-cart .fm-content-header,
.fm-is-cart .fm-page article > h1,
.fm-is-cart .fm-page .fm-content-header h1 {
  display: none !important;
}

.fm-is-cart .fm-page > article {
  margin: 0;
}

.fm-is-cart .entry-content > *:first-child {
  margin-top: 0;
}

.fm-cart {
  width: min(100% - 3rem, var(--fm-max));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.fm-cart__title {
  font-size: clamp(1.75rem, 3vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 1.75rem;
  color: var(--fm-text);
}

.fm-cart__layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
}

@media (min-width: 960px) {
  .fm-cart__layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    gap: 2.5rem 3rem;
  }
}

.fm-cart__main {
  min-width: 0;
}

.fm-cart__form {
  margin: 0;
}

.fm-cart__items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.fm-cart__item {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 5.5rem;
  gap: 1.25rem 1.5rem;
  align-items: start;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--fm-border);
}

.fm-cart__item:first-child {
  padding-top: 0;
}

.fm-cart__thumb {
  width: 160px;
  max-width: 100%;
  background: var(--fm-surface);
  border-radius: var(--fm-radius);
  border: 1px solid var(--fm-border);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fm-cart__thumb a {
  display: block;
  width: 100%;
  height: 100%;
}

.fm-cart__thumb img,
.fm-cart__thumb-img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  padding: 0;
  background: transparent;
}

.fm-cart__details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
  width: 100%;
  padding-top: 0.1rem;
}

.fm-cart__name {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--fm-text);
  max-width: 100%;
}

.fm-cart__name a {
  display: inline;
  color: var(--fm-text);
  text-decoration: none;
  word-break: normal;
  overflow-wrap: anywhere;
}

.fm-cart__name a:hover {
  color: var(--fm-accent);
}

/* Clean config lines (replaces WC dl.variation floats) */
.fm-cart__meta {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--fm-muted);
  font-weight: 400;
}

.fm-cart__meta-label {
  color: var(--fm-muted);
  margin-right: 0.25rem;
}

.fm-cart__meta-value {
  color: var(--fm-text);
  opacity: 0.9;
}

.fm-cart__meta-sku .fm-cart__meta-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  opacity: 0.75;
}

/* Kill WC default variation floats if any leak through */
.fm-cart .variation,
.fm-cart dl.variation {
  display: none !important;
}

.fm-cart__price {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fm-text);
}

.fm-cart__price .amount,
.fm-cart__price .woocommerce-Price-amount {
  color: var(--fm-text);
}

/* Qty steppers — shared look with PDP */
.fm-cart__qty .quantity {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-radius);
  background: transparent;
  overflow: hidden;
  width: fit-content;
  margin: 0.35rem 0 0 !important;
}

.fm-cart__qty .quantity .qty,
.fm-cart__qty .quantity input.qty {
  width: 2.5rem !important;
  min-width: 2.5rem;
  height: 2.4rem;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-left: 1px solid var(--fm-border) !important;
  border-right: 1px solid var(--fm-border) !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--fm-text) !important;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  -moz-appearance: textfield;
  appearance: textfield;
}

.fm-cart__qty .quantity .qty::-webkit-outer-spin-button,
.fm-cart__qty .quantity .qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.fm-cart__qty-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fm-text);
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.fm-cart__qty-btn:hover {
  background: var(--fm-surface);
  color: var(--fm-text);
}

.fm-cart__qty-btn:focus-visible {
  outline: 2px solid var(--fm-accent);
  outline-offset: -2px;
}

.fm-cart__remove {
  align-self: start;
  justify-self: end;
  padding-top: 0.2rem;
  text-align: right;
}

.fm-cart__remove-link,
.fm-cart__remove a,
.fm-cart__remove a.remove {
  display: inline-block !important;
  position: static !important;
  color: var(--fm-muted) !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  text-indent: 0 !important;
  background: none !important;
  border: 0 !important;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  line-height: 1.3 !important;
  opacity: 0.9;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.fm-cart__remove-link:hover,
.fm-cart__remove a:hover,
.fm-cart__remove a.remove:hover {
  color: var(--fm-accent) !important;
  opacity: 1;
}

/* update_cart only — WC coupon stays off the line-item form */
.fm-cart__actions {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
}

.fm-cart__actions .coupon,
.fm-cart__actions .fm-cart__coupon {
  display: none !important;
}

.fm-cart__promo {
  margin: 0 0 1.15rem;
  padding: 1.1rem 0 0;
  border-top: 1px solid var(--fm-border);
}

.fm-cart__promo-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.fm-cart__promo-row .input-text,
.fm-cart__promo-row input[type="text"] {
  flex: 1 1 auto;
  width: auto !important;
  min-width: 0;
  min-height: 2.7rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-radius-sm);
  background: var(--fm-surface);
  color: var(--fm-text);
  font: inherit;
}

.fm-cart__promo-row .input-text::placeholder,
.fm-cart__promo-row input[type="text"]::placeholder {
  color: var(--fm-muted);
}

.fm-cart__promo-row .input-text:focus,
.fm-cart__promo-row input[type="text"]:focus {
  outline: 2px solid var(--fm-accent);
  outline-offset: 1px;
  border-color: var(--fm-accent);
}

.fm-cart__promo-apply {
  flex: 0 0 auto;
  padding: 0.6rem 1.05rem;
  min-height: 2.7rem;
  font-size: 0.88rem;
}

@media (max-width: 600px) {
  .fm-cart__promo-row {
    flex-direction: column;
    align-items: stretch;
  }

  .fm-cart__promo-apply {
    width: 100%;
  }
}

.fm-cart__update {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Order summary sticky card */
.fm-cart__summary {
  position: relative;
  min-width: 0;
  width: 100%;
}

@media (min-width: 960px) {
  .fm-cart__summary {
    position: sticky;
    top: 5.5rem;
  }
}

/* Harden cart against WC table styles + page content constraints */
.fm-cart table.shop_table {
  display: none !important;
}

.fm-is-cart .entry-content {
  max-width: none;
  width: 100%;
}

.fm-cart__summary-card {
  background: var(--fm-bg-elevated);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-radius);
  padding: 1.5rem 1.4rem 1.35rem;
  box-shadow: 0 8px 28px color-mix(in srgb, var(--fm-bg) 60%, transparent);
}

.fm-cart__summary-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 1.35rem;
  color: var(--fm-text);
  letter-spacing: -0.01em;
}

.fm-cart__summary-rows {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin: 0 0 1.35rem;
}

.fm-cart__summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--fm-text);
  margin: 0;
}

.fm-cart__summary-row--total {
  margin-top: 0.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--fm-border);
  font-size: 1.15rem;
  font-weight: 700;
}

.fm-cart__summary-shipping {
  color: var(--fm-success);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.fm-cart__summary-muted {
  color: var(--fm-muted);
  font-weight: 500;
  text-align: right;
}

.fm-cart__summary-amount .amount,
.fm-cart__summary-amount .woocommerce-Price-amount {
  font-weight: 600;
  color: var(--fm-text);
}

.fm-cart__summary-row--total .amount,
.fm-cart__summary-row--total .woocommerce-Price-amount {
  font-weight: 700;
}

.fm-cart__summary-row--total small,
.fm-cart__summary-row--total .includes_tax {
  display: none;
}

.fm-cart__summary-row .woocommerce-remove-coupon {
  margin-left: 0.35rem;
  color: var(--fm-muted);
  text-decoration: none;
  font-size: 0.8rem;
}

.fm-cart__summary-row .woocommerce-remove-coupon:hover {
  color: var(--fm-accent);
}

.fm-cart__summary-checkout {
  margin: 0 0 1rem;
}

.fm-cart__checkout,
.fm-cart__summary a.checkout-button,
.fm-cart__summary .checkout-button.button {
  display: flex !important;
  width: 100% !important;
  justify-content: center;
  align-items: center;
  padding: 0.95rem 1.25rem !important;
  font-size: 1.05rem !important;
  font-weight: 600 !important;
  background: var(--fm-accent) !important;
  color: var(--fm-text) !important;
  border: 0 !important;
  border-radius: var(--fm-radius-sm) !important;
  text-decoration: none !important;
  text-align: center;
}

.fm-cart__checkout:hover,
.fm-cart__summary a.checkout-button:hover {
  background: var(--fm-accent-hover) !important;
  color: var(--fm-text) !important;
}

.fm-cart__ffl-note {
  margin: 0.85rem 0 0;
  color: var(--fm-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.fm-cart__continue {
  margin: 0;
  text-align: center;
}

.fm-cart__continue a {
  color: var(--fm-muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}

.fm-cart__continue a:hover {
  color: var(--fm-text);
}

/* Empty cart */
.fm-cart--empty {
  padding-bottom: 5rem;
}

.fm-cart__empty-panel {
  max-width: 28rem;
  margin: 0.5rem 0 0;
  padding: 2rem 1.75rem;
  background: var(--fm-bg-elevated);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-radius);
}

.fm-cart__empty-lead {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--fm-text);
}

.fm-cart__empty-copy {
  margin: 0 0 1.35rem;
  color: var(--fm-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.fm-cart__empty-cta {
  margin: 0;
}

.fm-cart__empty-cta .button,
.fm-cart__empty-cta .fm-btn {
  display: inline-flex;
}

.fm-cart--empty .fm-related {
  margin-top: 2.5rem;
  max-width: none;
}

.fm-cart--empty .fm-related__grid,
.fm-cart--empty .fm-related ul.products {
  grid-template-columns: 1fr;
}

@media (min-width: 600px) {
  .fm-cart--empty .fm-related__grid,
  .fm-cart--empty .fm-related ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .fm-cart--empty .fm-related__grid,
  .fm-cart--empty .fm-related ul.products {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Cart notices wrapper measure */
.woocommerce-cart .woocommerce-notices-wrapper,
.fm-is-cart .woocommerce-notices-wrapper {
  width: min(100% - 3rem, var(--fm-max));
  margin-inline: auto;
  margin-bottom: 1rem;
}

@media (max-width: 699px) {
  .fm-cart__item {
    grid-template-columns: 100px minmax(0, 1fr);
    grid-template-areas:
      "thumb details"
      "thumb remove";
    gap: 0.75rem 1rem;
  }

  .fm-cart__thumb {
    grid-area: thumb;
  }

  .fm-cart__details {
    grid-area: details;
  }

  .fm-cart__remove {
    grid-area: remove;
    align-self: start;
    justify-self: start;
  }
}

