/* ==========================================================================
   PetDashAU - High-CRO Cart Styling (public/assets/cart.css)
   ========================================================================== */

:root {
  --pine: #121E2E;
  --pine-dark: #0B141F;
  --sand: #F7F8FA;
  --paper: #FFFFFF;
  --clay: #F07822;
  --clay-dark: #D5651A;
  --sage: #2F8F5B;
  --sage-light: #FDEEE2;
  --ink: #121E2E;
  --ink-soft: #5B6472;
  --line: #E4E7EC;
}

/* Page Layout */
.cart-wrap,.cart-upsell-wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 30px 24px 80px;
}

.cart-layout {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 40px;
  align-items: start;
}

/* Alerts / Flash Messages */
.cart-alert {
  padding: 14px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 24px;
}
.cart-alert-success {
  background: #E4F0E9;
  color: #1F7A4C;
  border: 1px solid #C2E2D0;
}
.cart-alert-error {
  background: #FBEADD;
  color: var(--clay-dark);
  border: 1px solid #F5C9AC;
}

/* Left Column: Line Items */
.cart-header-title {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--pine);
  margin: 0 0 6px 0;
}
.cart-header-sub {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 24px 0;
}

.cart-item-card {
  display: flex;
  gap: 20px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}
.cart-item-img {
  width: 90px;
  height: 90px;
  background: var(--sand);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.cart-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cart-item-img svg {
  width: 36px;
  height: 36px;
  color: var(--ink-soft);
  opacity: 0.5;
}

.cart-item-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.cart-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.cart-item-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--pine);
  margin: 0 0 4px 0;
  text-decoration: none;
}
.cart-item-variant{
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 0 0 6px 0;
}
.cart-item-price-each {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0;
}
.cart-item-price-each s {
  color: #A0A5AF;
  margin-right: 4px;
}
.cart-item-promo-badge {
  color: var(--clay);
  font-weight: 600;
}
.cart-item-total {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--pine);
  white-space: nowrap;
}

/* Controls: Stepper & Delete */
.cart-item-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
}
.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}
.qty-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  font-size: 16px;
  color: var(--pine);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.qty-btn:hover {
  background: var(--sand);
}
.qty-input {
  width: 36px;
  border: none;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--pine);
  padding: 4px 0;
  background: transparent;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.btn-item-remove {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}
.btn-item-remove:hover {
  color: #BA3333;
}

/* Subscription Box */
.sub-inline-card {
  margin-top: 14px;
  background: var(--sand);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 13px;
}
.sub-summary-toggle {
  cursor: pointer;
  font-weight: 600;
  color: var(--pine);
}
.sub-summary-toggle span {
  color: var(--sage);
}
.sub-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.sub-select {
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink);
  background: var(--paper);
}
.btn-sub {
  background: var(--pine);
  color: var(--paper);
  border: none;
  padding: 7px 14px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-sub:hover {
  background: var(--pine-dark);
}

/* Right Column: Order Summary */
.cart-summary {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  position: sticky;
  top: 90px;
  box-shadow: 0 4px 16px rgba(18, 30, 46, 0.04);
}
.cart-summary h3 {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  color: var(--pine);
  margin: 0 0 16px 0;
}

/* Free Shipping Meter */
.ship-meter {
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.ship-meter-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--pine);
  margin-bottom: 8px;
}
.ship-meter-bar {
  height: 6px;
  background: var(--sand);
  border-radius: 4px;
  overflow: hidden;
}
.ship-meter-fill {
  height: 100%;
  background: var(--sage);
  transition: width 0.3s ease;
}

/* Promo Code Box */
.promo-wrap {
  margin-bottom: 18px;
}
.promo-applied {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #EAF4EE;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: #1F7A4C;
}
.promo-form {
  display: flex;
  gap: 8px;
}
.promo-input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  font-size: 13px;
  text-transform: uppercase;
}
.promo-btn {
  background: var(--sand);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--pine);
  cursor: pointer;
}

/* Rows */
.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 8px 0;
  color: var(--ink-soft);
}
.summary-row.discount {
  color: var(--sage);
  font-weight: 600;
}
.summary-row.total {
  font-size: 18px;
  font-weight: 700;
  color: var(--pine);
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 6px;
}

.btn-checkout {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--clay);
  color: #FFFFFF;
  padding: 14px 0;
  border-radius: 4px;
  font-size: 15.5px;
  font-weight: 600;
  text-decoration: none;
  margin-top: 20px;
  transition: background 0.15s ease;
}
.btn-checkout:hover {
  background: var(--clay-dark);
}

.trust-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 14px;
}

/* Responsive */
@media (max-width: 900px) {
  .cart-layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .cart-item-img {
    width: 72px;
    height: 72px;
  }
}

@media (max-width: 640px) {
  .cart-wrap, .cart-upsell-wrap { padding: 20px 16px 56px; }
}

@media (max-width: 480px) {
  /* At true phone width, a 90/72px image plus side-by-side price/total
     text left barely 200px for everything else — genuinely cramped,
     not just "could be tighter". Stacking vertically gives every
     element real breathing room instead. */
  .cart-item-card {
    flex-direction: column;
    gap: 14px;
  }
  .cart-item-img {
    width: 100%;
    height: 160px;
  }
  .cart-item-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .cart-item-total {
    font-size: 15px;
  }
  .cart-item-controls {
    flex-wrap: wrap;
    gap: 12px;
  }
  .sub-inline-card {
    padding: 12px;
  }
}