/* ══════════════════════════════════════════════════════════════════════════
   WOO-CART — Sadece sepet sayfasında yüklenir (is_cart)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Sayfa başlığı ────────────────────────────────────────────────────── */
.woocommerce-cart .woo-container > h1,
.woocommerce-cart .woo-container > .page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--color-dark);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Genel tablo sıfırlama: flex kart düzenine geç ───────────────────── */
.woocommerce table.shop_table.cart {
  display: block !important;
  border: none !important;
  background: transparent !important;
  border-radius: 0 !important;
}

.woocommerce table.shop_table.cart thead {
  display: none !important;
}

.woocommerce table.shop_table.cart tbody {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
}

.woocommerce table.shop_table.cart tfoot {
  display: block !important;
}

/* ── Sepet ürün kartı ─────────────────────────────────────────────────── */
.woocommerce table.shop_table.cart tr.cart_item {
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  padding: 16px !important;
  background: var(--color-white) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: 14px !important;
  box-shadow: var(--shadow-sm) !important;
  transition: box-shadow .2s !important;
}
.woocommerce table.shop_table.cart tr.cart_item:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.08) !important;
}

.woocommerce table.shop_table.cart tr.cart_item td {
  padding: 0 !important;
  border: none !important;
  vertical-align: middle !important;
}

/* Sütun sıralaması */
.woocommerce table.shop_table.cart td.product-thumbnail { order: 1; flex-shrink: 0; }
.woocommerce table.shop_table.cart td.product-name      { order: 2; flex: 1; min-width: 0; }
.woocommerce table.shop_table.cart td.product-price     { order: 3; flex-shrink: 0; min-width: 72px; text-align: center; }
.woocommerce table.shop_table.cart td.product-quantity  { order: 4; flex-shrink: 0; }
.woocommerce table.shop_table.cart td.product-subtotal  { order: 5; flex-shrink: 0; min-width: 88px; text-align: right; }
.woocommerce table.shop_table.cart td.product-remove    { order: 6; flex-shrink: 0; }

/* ── Ürün görseli ─────────────────────────────────────────────────────── */
.woocommerce table.shop_table.cart td.product-thumbnail a { display: block; }
.woocommerce table.shop_table.cart td.product-thumbnail img {
  width: 96px !important;
  height: 96px !important;
  object-fit: cover !important;
  border-radius: 12px !important;
  border: 1px solid var(--color-border) !important;
  background: var(--color-bg) !important;
  display: block !important;
}

/* ── Ürün adı ve detaylar ─────────────────────────────────────────────── */
.woocommerce table.shop_table.cart td.product-name a {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-dark);
  line-height: 1.35;
  margin-bottom: 6px;
  text-decoration: none;
  transition: color var(--trans);
}
.woocommerce table.shop_table.cart td.product-name a:hover { color: var(--color-primary); }

.woocommerce table.shop_table.cart td.product-name .variation {
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 4px;
}
.woocommerce table.shop_table.cart td.product-name .variation dt,
.woocommerce table.shop_table.cart td.product-name .variation dd { display: inline; margin: 0; }
.woocommerce table.shop_table.cart td.product-name .variation dt::after { content: ': '; }
.woocommerce table.shop_table.cart td.product-name .variation dd::after { content: ' · '; }
.woocommerce table.shop_table.cart td.product-name .variation dd:last-child::after { content: ''; }

/* Lightbox detayları */
.woocommerce table.shop_table.cart .lightbox-cart-details { display: block; margin-top: 4px; }
.woocommerce table.shop_table.cart .lightbox-custom-details { font-size: 12px; }
.woocommerce table.shop_table.cart .lightbox-custom-details .detail-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: var(--color-muted);
  margin-bottom: 3px;
  line-height: 1.4;
}
.woocommerce table.shop_table.cart .lightbox-custom-details .detail-row strong {
  font-weight: 600;
  color: #555;
  white-space: nowrap;
  flex-shrink: 0;
}
.woocommerce table.shop_table.cart .lightbox-custom-details .detail-row img { display: none; }
.woocommerce table.shop_table.cart .lightbox-extra-details { margin-top: 4px; }
.woocommerce table.shop_table.cart .lightbox-toggle-btn {
  color: var(--color-primary) !important;
  font-size: 11px;
  cursor: pointer;
}

/* ── Fiyat etiketleri ─────────────────────────────────────────────────── */
.woocommerce table.shop_table.cart td.product-price::before {
  content: 'Birim';
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-muted);
  margin-bottom: 4px;
}
.woocommerce table.shop_table.cart td.product-subtotal::before {
  content: 'Toplam';
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-muted);
  margin-bottom: 4px;
}
.woocommerce table.shop_table.cart .product-price .woocommerce-Price-amount,
.woocommerce table.shop_table.cart .product-subtotal .woocommerce-Price-amount {
  font-weight: 700;
  color: var(--color-orange);
  font-size: 15px;
}

/* ── Miktar input ─────────────────────────────────────────────────────── */
.woocommerce table.shop_table.cart td.product-quantity .quantity { display: flex; align-items: center; gap: 0; }
.woocommerce table.shop_table.cart td.product-quantity input.qty {
  width: 52px;
  height: 38px;
  text-align: center;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-dark);
  background: var(--color-white);
  outline: none;
  -moz-appearance: textfield;
  transition: border-color var(--trans);
}
.woocommerce table.shop_table.cart td.product-quantity input.qty:focus { border-color: var(--color-primary); }
.woocommerce table.shop_table.cart td.product-quantity input.qty::-webkit-outer-spin-button,
.woocommerce table.shop_table.cart td.product-quantity input.qty::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── Sil butonu ───────────────────────────────────────────────────────── */
.woocommerce table.shop_table.cart a.remove {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  background: #fde8e8 !important;
  color: var(--color-red) !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  text-decoration: none !important;
  transition: background .18s, color .18s !important;
}
.woocommerce table.shop_table.cart a.remove:hover {
  background: var(--color-red) !important;
  color: #fff !important;
}

/* ── Alt satır: kupon + güncelle ─────────────────────────────────────── */
.woocommerce table.shop_table.cart tr:not(.cart_item) { display: block !important; }
.woocommerce table.shop_table.cart tr:not(.cart_item) td { display: block !important; padding: 0 !important; border: none !important; }

.woocommerce table.cart .actions {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 16px !important;
  background: var(--color-bg) !important;
  border-radius: 12px !important;
  border: 1px solid var(--color-border) !important;
  margin-top: 8px !important;
}
.woocommerce table.cart .actions .coupon {
  display: flex !important;
  gap: 8px !important;
  align-items: center !important;
  flex: 1 !important;
}
.woocommerce table.cart .actions .coupon input#coupon_code {
  height: 40px !important;
  padding: 0 14px !important;
  border: 1.5px solid var(--color-border) !important;
  border-radius: var(--radius-sm) !important;
  font-size: 14px !important;
  outline: none !important;
  max-width: 220px !important;
  width: 100% !important;
  transition: border-color var(--trans) !important;
}
.woocommerce table.cart .actions .coupon input#coupon_code:focus { border-color: var(--color-primary) !important; }
.woocommerce table.cart .actions .coupon button[name=apply_coupon] {
  height: 40px !important;
  padding: 0 18px !important;
  background: var(--color-primary) !important;
  color: #fff !important;
  border: none !important;
  border-radius: var(--radius-sm) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: opacity var(--trans) !important;
}
.woocommerce table.cart .actions .coupon button[name=apply_coupon]:hover { opacity: .85 !important; }
.woocommerce table.cart .actions button[name=update_cart] {
  height: 40px !important;
  padding: 0 18px !important;
  background: transparent !important;
  color: var(--color-muted) !important;
  border: 1.5px solid var(--color-border) !important;
  border-radius: var(--radius-sm) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: border-color var(--trans), color var(--trans) !important;
}
.woocommerce table.cart .actions button[name=update_cart]:hover {
  border-color: var(--color-primary) !important;
  color: var(--color-primary) !important;
}

/* ── Miktar spinner ───────────────────────────────────────────────────── */
.quantity { position: relative; }

.mtg-qty-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.65);
  border-radius: 6px;
  pointer-events: none;
}
.mtg-qty-spinner::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: mtg-spin .6s linear infinite;
}
@keyframes mtg-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════════════════
   CART — POLISH LAYER
   Screenshot'ta görülen kaymaları düzeltir:
   - data-title "Ürün:" / "Miktar:" masaüstünde gizlenir
   - Kolonlar sabit genişlik + hizalı (thumb / name flex / price / qty / subtotal / remove)
   - Yüklenen fotograflar inline satır
   - Kupon + Sepeti güncelle satırı ürünlere yakın
   - Remove butonu görünür boyutta
   ══════════════════════════════════════════════════════════════════════════ */

/* WooCommerce shop_table_responsive → masaüstünde "Ürün:" ve "Miktar:" gibi
   data-title etiketleri sızıyor. Sadece kendi eklediğimiz Birim/Toplam kalsın. */
@media (min-width: 768px) {
  .woocommerce table.shop_table.cart td.product-name::before,
  .woocommerce table.shop_table.cart td.product-thumbnail::before,
  .woocommerce table.shop_table.cart td.product-quantity::before,
  .woocommerce table.shop_table.cart td.product-remove::before {
    content: none !important;
    display: none !important;
  }
}

/* Ürün adı sütunu daha rahat nefes alsın, doğru hizalansın */
.woocommerce table.shop_table.cart td.product-name {
  padding-right: 8px !important;
  align-self: center !important;
  /* WC responsive text-align:right'i ez → sola hizala */
  text-align: left !important;
}
.woocommerce table.shop_table.cart td.product-name * {
  text-align: left !important;
}
.woocommerce table.shop_table.cart td.product-name a {
  font-size: 15px !important;
  line-height: 1.4 !important;
  color: var(--color-dark) !important;
  display: block !important;
  margin-bottom: 8px !important;
}

/* "Yüklenen Fotograflar (N)" başlığı + görsel — kompakt inline */
.woocommerce table.shop_table.cart td.product-name > p {
  font-size: 12px !important;
  color: var(--color-muted) !important;
  margin: 8px 0 4px !important;
  font-weight: 400 !important;
}
.woocommerce table.shop_table.cart td.product-name > p strong {
  color: var(--color-dark) !important;
  font-weight: 700 !important;
}
.woocommerce table.shop_table.cart .uploaded-images-wrapper {
  display: block !important;
  margin: 4px 0 8px !important;
}
.woocommerce table.shop_table.cart .uploaded-images-container {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  align-items: center !important;
}
.woocommerce table.shop_table.cart .uploaded-images-container a.image-popup {
  display: inline-block !important;
  border: 1px solid var(--color-border) !important;
  border-radius: 6px !important;
  padding: 2px !important;
  background: #fff !important;
  transition: border-color .18s, transform .18s !important;
  line-height: 0 !important;
}
.woocommerce table.shop_table.cart .uploaded-images-container a.image-popup:hover {
  border-color: var(--color-primary) !important;
  transform: scale(1.05) !important;
}
.woocommerce table.shop_table.cart .uploaded-images-container a.image-popup img {
  width: 44px !important;
  height: 44px !important;
  object-fit: cover !important;
  border-radius: 4px !important;
  display: block !important;
}

/* Fiyat/Miktar/Toplam kolonları — sabit sağa hizalı */
.woocommerce table.shop_table.cart td.product-price {
  min-width: 110px !important;
  text-align: right !important;
  padding: 0 8px !important;
  border-left: 1px dashed var(--color-border) !important;
  align-self: center !important;
}
.woocommerce table.shop_table.cart td.product-quantity {
  min-width: 90px !important;
  text-align: center !important;
  padding: 0 8px !important;
  border-left: 1px dashed var(--color-border) !important;
  align-self: center !important;
}
.woocommerce table.shop_table.cart td.product-subtotal {
  min-width: 110px !important;
  text-align: right !important;
  padding: 0 8px !important;
  border-left: 1px dashed var(--color-border) !important;
  align-self: center !important;
}
.woocommerce table.shop_table.cart td.product-remove {
  padding-left: 4px !important;
  align-self: center !important;
}

/* Birim/Toplam etiketleri daha temiz — fiyatın ÜSTÜNDE ayrı satırda dursun.
   WC responsive `td::before { float: left }` uyguluyor; float:none ile bastırıyoruz. */
.woocommerce table.shop_table.cart td.product-price::before,
.woocommerce table.shop_table.cart td.product-subtotal::before {
  font-size: 10px !important;
  letter-spacing: .08em !important;
  color: var(--color-muted) !important;
  margin-bottom: 6px !important;
  display: block !important;
  float: none !important;
  width: 100% !important;
  text-align: right !important;
}
.woocommerce table.shop_table.cart .product-price .woocommerce-Price-amount,
.woocommerce table.shop_table.cart .product-subtotal .woocommerce-Price-amount {
  font-size: 16px !important;
  font-weight: 800 !important;
}

/* Ara toplam biraz daha yeşile çeksin (bu ana toplam gibi, dikkat çeker) */
.woocommerce table.shop_table.cart .product-subtotal .woocommerce-Price-amount {
  color: var(--color-primary) !important;
}

/* Remove butonu görünür ve tıklanabilir boyutta */
.woocommerce table.shop_table.cart a.remove {
  width: 36px !important;
  height: 36px !important;
  font-size: 20px !important;
}

/* ── Miktar +/- Spinner (JS inject) ─────────────────────────────────────── */
/* NOT: Bu bloktaki selector'lar `td.product-quantity` prefix'i ile önceki
   satır 160'taki eski kurallardan daha spesifik olmalı — aksi halde
   eski `border: 1.5px solid` input üzerinde kalır, buton görünmez. */
.woocommerce table.shop_table.cart td.product-quantity .quantity {
  display: inline-flex !important;
  align-items: stretch !important;
  border: 1.5px solid var(--color-border) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden !important;
  background: #fff !important;
  height: 38px !important;
  gap: 0 !important;
  width: auto !important;
}
.woocommerce table.shop_table.cart td.product-quantity .quantity .mtg-qty-btn {
  width: 32px !important;
  min-width: 32px !important;
  height: 100% !important;
  border: none !important;
  background: transparent !important;
  color: var(--color-primary) !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  line-height: 1 !important;
  transition: background .15s !important;
  user-select: none !important;
  flex-shrink: 0 !important;
}
.woocommerce table.shop_table.cart td.product-quantity .quantity .mtg-qty-btn:hover {
  background: var(--color-bg) !important;
}
.woocommerce table.shop_table.cart td.product-quantity .quantity .mtg-qty-btn:disabled {
  color: var(--color-border) !important;
  cursor: not-allowed !important;
}
/* Eski satır 160'taki border/width/height'i EZ — input yalın olsun */
.woocommerce table.shop_table.cart td.product-quantity input.qty {
  width: 44px !important;
  height: 100% !important;
  border: none !important;
  border-left: 1px solid var(--color-border) !important;
  border-right: 1px solid var(--color-border) !important;
  border-radius: 0 !important;
  text-align: center !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  padding: 0 !important;
  background: transparent !important;
  color: var(--color-dark) !important;
  -moz-appearance: textfield !important;
  outline: none !important;
  box-shadow: none !important;
  flex-shrink: 0 !important;
}
.woocommerce table.shop_table.cart td.product-quantity input.qty:focus {
  border-color: var(--color-primary) !important;
}
.woocommerce table.shop_table.cart td.product-quantity input.qty::-webkit-outer-spin-button,
.woocommerce table.shop_table.cart td.product-quantity input.qty::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

/* WC'nin AJAX loading/processing sırasında verdiği sarı background'ı bastır */
.woocommerce table.shop_table.cart td.product-quantity input.qty[disabled] {
  background: transparent !important;
  color: var(--color-muted) !important;
}

/* ── woocommerce-message: WC'nin ::before ikonu absolute → yazıya sol boşluk ── */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
  position: relative !important;
  padding-left: 48px !important;
}
.woocommerce-message::before,
.woocommerce-info::before,
.woocommerce-error::before {
  position: absolute !important;
  top: 50% !important;
  left: 16px !important;
  transform: translateY(-50%) !important;
  margin: 0 !important;
}

/* Aksiyon satırı ürünlere YAKIN — gereksiz üst boşluk kaldır */
.woocommerce table.shop_table.cart tr:not(.cart_item) {
  margin-top: 4px !important;
}
.woocommerce table.cart .actions {
  margin-top: 4px !important;
  padding: 14px 16px !important;
}

/* "Sepeti güncelle" butonu — AJAX ile güncelleme yapıldığından görünmüyor.
   JS (woo-cart.js) programlı olarak `.click()` ile submit'i tetikleyebilmesi için
   DOM'da kalmalı; sadece görsel olarak saklanır. */
.woocommerce table.cart .actions button[name=update_cart] {
  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;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Kupon input daha geniş görünür */
.woocommerce table.cart .actions .coupon input#coupon_code {
  max-width: none !important;
  min-width: 200px !important;
  flex: 1 !important;
  background: #fff !important;
}

/* Kart satırlarına biraz nefes ver */
.woocommerce table.shop_table.cart tbody {
  gap: 10px !important;
}

/* ── Mobil ────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .woocommerce table.shop_table.cart tr.cart_item {
    flex-wrap: wrap !important;
    gap: 12px !important;
    padding: 12px !important;
  }
  .woocommerce table.shop_table.cart td.product-thumbnail img {
    width: 72px !important;
    height: 72px !important;
  }
  .woocommerce table.shop_table.cart td.product-name  { order: 2; flex: 1; min-width: 0; }
  .woocommerce table.shop_table.cart td.product-price { display: none !important; }
  .woocommerce table.shop_table.cart td.product-quantity {
    order: 3;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px !important;
  }
  /* "Miktar" etiketi +/- butonlarının ÜSTÜNDE ayrı satırda dursun */
  .woocommerce table.shop_table.cart td.product-quantity::before {
    content: attr(data-title) !important;
    display: block !important;
    float: none !important;
    width: auto !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: .06em !important;
    color: var(--color-muted) !important;
    margin: 0 !important;
    text-align: left !important;
  }
  .woocommerce table.shop_table.cart td.product-subtotal {
    order: 4;
    min-width: 0 !important;
    text-align: left !important;
  }
  .woocommerce table.shop_table.cart td.product-subtotal::before { display: none !important; }
  .woocommerce table.shop_table.cart td.product-remove { order: 5; }

  .woocommerce table.cart .actions {
    flex-wrap: wrap !important;
  }
  .woocommerce table.cart .actions .coupon { flex: 1 1 100% !important; }

  /* Mobilde dikey ayırıcı çizgiyi kaldır (yatay flex yok) */
  .woocommerce table.shop_table.cart td.product-quantity,
  .woocommerce table.shop_table.cart td.product-subtotal,
  .woocommerce table.shop_table.cart td.product-price {
    border-left: none !important;
    padding: 0 !important;
    min-width: 0 !important;
  }

  /* Yüklenen fotoğraflar mobilde de kompakt */
  .woocommerce table.shop_table.cart .uploaded-images-container a.image-popup img {
    width: 40px !important;
    height: 40px !important;
  }

  /* Kupon input yeniden max-width'a dönsün */
  .woocommerce table.cart .actions .coupon input#coupon_code {
    min-width: 0 !important;
  }

  /* Sepeti güncelle mobilde tam genişlik */
  .woocommerce table.cart .actions button[name=update_cart] {
    width: 100% !important;
  }
}
