/* ============================================================
   CART PAGE STYLES
   segma-commerce-theme/assets/css/cart.css
   ============================================================ */

.segma-cart-page {
  padding: 28px 0 60px;
}

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 20px;
  color: var(--clr-text-muted);
  font-size: 16px;
}

/* Layout */
.cart-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

/* ── CART TABLE ──────────────────────────────────────────────── */
.cart-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--clr-white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.cart-table thead tr {
  background: #f8f8f8;
  border-bottom: 1px solid var(--clr-border);
}

.cart-table th {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--clr-text-muted);
  text-align: right;
}

.cart-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--clr-border);
  vertical-align: middle;
  font-size: 13px;
}

.cart-table tbody tr:last-child td { border-bottom: none; }

/* Product cell */
.cart-item-product {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-item-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--clr-border);
  flex-shrink: 0;
}

.cart-item-name {
  font-weight: 600;
  color: var(--clr-text);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 220px;
}

.cart-item-name:hover { color: var(--clr-primary); }

/* Price */
.cart-item-price,
.cart-item-total {
  font-weight: 600;
  color: var(--clr-text);
}

.cart-item-total { color: var(--clr-primary); font-weight: 700; }

/* Quantity controls */
.qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: fit-content;
}

.qty-btn {
  background: #f5f5f5;
  border: none;
  width: 30px;
  height: 30px;
  font-size: 16px;
  cursor: pointer;
  color: var(--clr-text);
  transition: background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.qty-btn:hover { background: var(--clr-primary); color: #fff; }

.qty-val {
  width: 32px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  border-inline: 1.5px solid var(--clr-border);
  background: #fff;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Remove button */
.remove-item-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #ccc;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  display: flex;
  align-items: center;
}

.remove-item-btn:hover {
  color: var(--clr-flash);
  background: var(--shadow-flash-soft);
}

/* ── CART TOTALS ─────────────────────────────────────────────── */
.cart-totals {
  background: var(--clr-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 20px;
  position: sticky;
  top: calc(var(--topbar-h) + var(--header-h) + 12px);
}

.cart-totals__title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--clr-border);
  color: var(--clr-text);
}

.cart-totals__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
  color: var(--clr-text-muted);
  border-bottom: 1px dashed var(--clr-border);
}

.cart-totals__total {
  border-bottom: none;
  font-size: 16px;
  font-weight: 700;
  color: var(--clr-text);
  padding-top: 12px;
  margin-top: 4px;
}

.cart-totals__total span:last-child {
  color: var(--clr-primary);
  font-size: 18px;
}

.cart-checkout-btn {
  margin-top: 16px;
  font-size: 15px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* Gentle pulse glow — attracts attention, not annoying */
@keyframes checkoutPulse {
  0%, 100% {
    box-shadow: 0 4px 14px var(--shadow-primary-strong);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 6px 24px var(--shadow-primary-pulse);
    transform: scale(1.02);
  }
}

.cart-checkout-pulse {
  animation: checkoutPulse 2.2s ease-in-out infinite;
}

.cart-checkout-pulse:hover {
  animation-play-state: paused; /* pause on hover for comfortable click */
  transform: scale(1.02);
}

.cart-checkout-arrow,
.cart-continue-arrow {
  flex-shrink: 0;
  line-height: 1;
}

.cart-continue-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: row-reverse;
  gap: 6px;
  text-align: center;
  margin-top: 12px;
  font-size: 13px;
  color: var(--clr-text-muted);
  transition: color var(--transition);
}

.cart-continue-link:hover { color: var(--clr-primary); }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .cart-layout {
    grid-template-columns: 1fr;
  }

  .cart-totals { position: static; }

  .cart-table th:nth-child(2),
  .cart-table td:nth-child(2) {
    display: none; /* hide unit price on mobile */
  }

  .cart-item-name { max-width: 140px; }

  .cart-item-product { gap: 8px; }
  .cart-item-img { width: 48px; height: 48px; }
}

@media (max-width: 600px) {
  .segma-cart-page {
    padding-top: 18px;
    overflow-x: hidden;
  }

  .cart-items-wrap,
  .cart-table,
  .cart-table tbody,
  .cart-table tr,
  .cart-table td {
    width: 100%;
  }

  .cart-table {
    display: block;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }

  .cart-table thead {
    display: none;
  }

  .cart-table tbody {
    display: grid;
    gap: 12px;
  }

  .cart-table .cart-item-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "product remove"
      "price price"
      "qty qty"
      "total total";
    gap: 10px 12px;
    padding: 12px;
    background: var(--clr-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
  }

  .cart-table td {
    padding: 0;
    border-bottom: 0;
  }

  .cart-item-product {
    grid-area: product;
    min-width: 0;
  }

  .cart-item-img {
    width: 56px;
    height: 56px;
  }

  .cart-item-name {
    max-width: none;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .cart-table td.cart-item-price,
  .cart-item-qty,
  .cart-item-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
  }

  .cart-item-price { grid-area: price; }
  .cart-item-qty { grid-area: qty; }
  .cart-item-total { grid-area: total; }

  .cart-item-price::before,
  .cart-item-qty::before,
  .cart-item-total::before {
    content: attr(data-label);
    color: var(--clr-text-muted);
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
  }

  .cart-item-total {
    color: var(--clr-primary);
    white-space: normal;
  }

  .cart-item-remove {
    grid-area: remove;
    justify-self: end;
    align-self: start;
    width: auto;
  }

  .qty-control {
    flex-shrink: 0;
  }

  .cart-totals {
    width: 100%;
    padding: 16px;
  }

  .cart-totals__row {
    gap: 12px;
  }

  .cart-totals__row span:last-child {
    min-width: 0;
    text-align: end;
    overflow-wrap: anywhere;
  }

  .cart-checkout-btn {
    width: 100%;
    min-height: 46px;
    flex-wrap: nowrap;
  }

  .cart-continue-link {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .cart-table .cart-item-row {
    padding: 10px;
    gap: 9px;
  }

  .qty-btn {
    width: 28px;
    height: 28px;
  }

  .qty-val {
    width: 30px;
    height: 28px;
  }
}


/* Shopingo French/LTR overrides */
body.segma-preset-shopingo .segma-cart-page,
body.segma-preset-shopingo .cart-layout,
body.segma-preset-shopingo .cart-table { direction: ltr; text-align: left; }
body.segma-preset-shopingo .cart-continue-link {
  flex-direction: row;
  justify-content: flex-start;
  text-align: left;
}
