/* ==========================================================================
   Sepet sayfası (checkout/cart_list.twig)
   checkout-express.css'teki .cx-* bileşenlerini kullanır; token'lar burada
   #checkout-cart için tanımlanır. Renkler tema token'larından (--hs-brand*).
   ========================================================================== */

#checkout-cart {
  --cx-brand:   var(--hs-brand, #5b832e);
  --cx-brand-h: var(--hs-brand-hover, #4d6f27);
  --cx-btn:     var(--hs-brand-btn, var(--cx-brand));
  --cx-soft:    var(--hs-brand-soft, #f1f4ed);
  --cx-ring:    var(--hs-brand-ring, rgba(91,131,46,.28));
  --cx-text:    #1b2733;
  --cx-muted:   #5f6b7a;
  --cx-border:  #dfe3e8;
  --cx-border-s:#c6cdd5;
  --cx-danger:  #c0392b;
  --cx-radius:  12px;

  color: var(--cx-text);
  max-width: 980px;
  padding-top: 1rem;
  padding-bottom: 2.5rem;
}

#shopping-cart { transition: opacity .15s; }
#shopping-cart.is-loading { opacity: .6; pointer-events: none; }

/* Mobilde özet ürünlerin altında kalsın (ödeme sayfasında üstteydi). */
#checkout-cart .cx-side { display: block; order: 2; }
#checkout-cart .cx-main { order: 1; }

/* ---------- Başlık ---------- */
.cart-x-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: .25rem 1rem; margin-bottom: .75rem;
}
.cart-x-head h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.cart-x-head h1 span { font-size: .85rem; font-weight: 500; color: var(--cx-muted); margin-left: .25rem; }
.cart-x-continue { font-size: .82rem; font-weight: 600; color: var(--cx-brand-h); }

/* ---------- Ücretsiz kargo şeridi ---------- */
.cart-x-free {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .35rem .55rem;
  padding: .6rem .85rem; margin-bottom: .75rem;
  background: var(--cx-soft); border-radius: 10px;
  font-size: .82rem; color: var(--cx-brand-h);
}
.cart-x-free svg { width: 18px; height: 18px; }
.cart-x-free .cx-freeship-bar { grid-column: 1 / -1; margin: 0; background: rgba(0,0,0,.07); }
.cart-x-free.is-won { font-weight: 600; }

/* ---------- Ürün satırları ---------- */
.cart-x-items {
  list-style: none; margin: 0; padding: 0 1rem;
  background: #fff; border: 1px solid var(--cx-border); border-radius: var(--cx-radius);
}
.cart-x-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto auto 28px;
  grid-template-areas: "img info qty total remove";
  align-items: center; gap: .85rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--cx-border);
  transition: opacity .15s;
}
.cart-x-item:last-child { border-bottom: 0; }
.cart-x-item.is-saving, .cart-x-item.is-removing { opacity: .45; }

.cart-x-img { grid-area: img; display: block; width: 72px; height: 72px; }
.cart-x-img img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--cx-border); }

.cart-x-info { grid-area: info; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.cart-x-name { color: var(--cx-text); font-weight: 600; font-size: .92rem; line-height: 1.3; text-decoration: none; }
.cart-x-name:hover { color: var(--cx-brand-h); }
.cart-x-info small { color: var(--cx-muted); font-size: .76rem; }
.cart-x-info .cart-x-warn { color: var(--cx-danger); font-weight: 600; }

.cart-x-qty {
  grid-area: qty;
  display: inline-flex; align-items: center;
  border: 1px solid var(--cx-border-s); border-radius: 9px; overflow: hidden;
  margin: 0;
}
.cart-x-step {
  display: grid; place-items: center;
  width: 32px; height: 34px; padding: 0;
  background: #fff; border: 0; color: var(--cx-text); cursor: pointer;
}
.cart-x-step svg { width: 14px; height: 14px; }
.cart-x-step:hover:not(:disabled) { background: var(--cx-soft); color: var(--cx-brand-h); }
.cart-x-step:disabled { color: #b5bdc6; cursor: not-allowed; }
.cart-x-qty-input {
  width: 38px; height: 34px; padding: 0;
  border: 0; border-left: 1px solid var(--cx-border); border-right: 1px solid var(--cx-border);
  text-align: center; font-size: 15px; font-weight: 600; color: var(--cx-text);
  -moz-appearance: textfield;
}
.cart-x-qty-input:focus { outline: none; background: var(--cx-soft); }

.cart-x-total { grid-area: total; min-width: 84px; text-align: right; font-size: .95rem; white-space: nowrap; }

.cart-x-remove {
  grid-area: remove;
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 8px;
  color: #9aa4b0;
}
.cart-x-remove svg { width: 17px; height: 17px; }
.cart-x-remove:hover { color: var(--cx-danger); background: #fdf3f2; }

/* Mobil: görsel | bilgi + kaldır, altta miktar ve tutar */
@media (max-width: 575.98px) {
  .cart-x-items { padding: 0 .85rem; }
  .cart-x-item {
    grid-template-columns: 64px minmax(0, 1fr) 28px;
    grid-template-areas:
      "img info remove"
      "img qty total";
    gap: .5rem .75rem;
  }
  .cart-x-img, .cart-x-img img { width: 64px; height: 64px; }
  .cart-x-img { align-self: start; }
  .cart-x-qty { justify-self: start; }
  .cart-x-total { grid-column: 2 / 4; justify-self: end; min-width: 0; }
  .cart-x-remove { align-self: start; }
}

/* ---------- İndirim kodu vb. modüller ---------- */
.cart-x-modules { margin-top: .75rem; }
.cart-x-modules summary {
  cursor: pointer; color: var(--cx-brand-h); font-weight: 600; font-size: .85rem;
  list-style: none; display: inline-flex; gap: .35rem;
}
.cart-x-modules summary::-webkit-details-marker { display: none; }
.cart-x-modules summary::before { content: '+'; }
.cart-x-modules[open] summary::before { content: '−'; }
.cart-x-modules .accordion { margin-top: .6rem; }

/* ---------- Özet ---------- */
.cart-x-summary {
  background: #fff; border: 1px solid var(--cx-border); border-radius: var(--cx-radius);
  padding: 1rem;
}
.cart-x-summary h2 { font-size: .95rem; font-weight: 700; margin: 0 0 .25rem; }
.cart-x-summary .cx-totals { margin-top: .25rem; border-top: 0; padding-top: 0; }
#checkout-cart a.cx-pay { text-decoration: none; }
#checkout-cart a.cx-pay:hover { color: #fff; }

.cart-x-pay {
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  margin-top: .75rem; font-size: .74rem; color: var(--cx-muted);
}
.cart-x-pay .hs-cards img { width: 36px; height: 24px; }

/* ---------- Boş sepet ---------- */
.cart-x-empty {
  max-width: 420px; margin: 2.5rem auto 3rem; text-align: center;
}
.cart-x-empty svg { width: 56px; height: 56px; color: var(--cx-brand); opacity: .8; }
.cart-x-empty h1 { font-size: 1.35rem; font-weight: 700; margin: .75rem 0 .35rem; }
.cart-x-empty p { color: var(--cx-muted); font-size: .9rem; margin: 0 0 1rem; }
.cart-x-empty .cx-pay { display: inline-flex; width: auto; padding: 0 1.75rem; text-decoration: none; }
.cart-x-empty .cx-pay:hover { color: #fff; }

.cart-x .cx-alert.is-info { background: #f1f6fb; border-color: #c9dbee; color: #1f4b77; }

@media (max-width: 991.98px) {
  #checkout-cart { padding-bottom: 6rem; }
}
