/* Sepet sayfası: [maxend_sepet] içindeki WooCommerce sepetini düzenler. */

/* ==========================================
   MAXEND SEPET (GARANTİLİ CSS GRID ZIRHI)
   ========================================== */

/* 1. ANA DÜZEN (Grid ile Kilitli Yerleşim) */
/* EKLENEN: Sadece sepet doluysa Grid uygula, boşsa bozma! */
#maxend-cart-container .woocommerce:not(.cart-empty-wrapper) {
    display: grid;
    grid-template-columns: 1.8fr 1fr; /* Sol: Ürünler, Sağ: Toplam */
    gap: 4rem;
    align-items: start;
    width: 100%;
    max-width: 100%;
}

/* EKLENEN: Bildirim kutuları her zaman tam satır kaplasın */
#maxend-cart-container .woocommerce-notices-wrapper {
    grid-column: 1 / -1;
    width: 100%;
    margin-bottom: 1.5rem;
}

/* Boş bildirim kutusu ızgarada bir satır ve boşluk kaplamasın. */
#maxend-cart-container .woocommerce-notices-wrapper:empty { display: none; }

/* WOOCOMMERCE GİZLİ CLEARFIX'LERİNİ YOK ET */
#maxend-cart-container .woocommerce::before, #maxend-cart-container .woocommerce::after,
#maxend-cart-container .woocommerce-cart-form::before, #maxend-cart-container .woocommerce-cart-form::after,
#maxend-cart-container .cart-collaterals::before, #maxend-cart-container .cart-collaterals::after {
    display: none; content: none;
}

#maxend-cart-container form.woocommerce-cart-form {
    width: 100%;
    margin: 0;
    padding: 0;
}

#maxend-cart-container .cart-collaterals {
    width: 100%;
    position: sticky;
    top: 120px;
    margin: 0;
    padding: 0;
}

/* 2. TABLO SIFIRLAMA VE ESTETİK */
#maxend-cart-container table.shop_table { border: none; margin: 0 0 1rem 0; width: 100%; border-collapse: collapse; border-radius: 0;}
#maxend-cart-container table.shop_table thead th { border: none; text-transform: uppercase; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; color: var(--color-stone-500); padding: 0 0 1.5rem 0; border-bottom: 2px solid var(--color-stone-100); text-align: left; }
#maxend-cart-container table.shop_table tbody td { border: none; padding: 2rem 0; vertical-align: middle; border-bottom: 1px solid var(--color-stone-50); background: transparent; text-align: left; }

/* 3. SİL BUTONU (Zarif X İkonu) */
#maxend-cart-container table.shop_table td.product-remove { width: 50px; text-align: left; padding-right: 0;}
#maxend-cart-container table.shop_table td.product-remove a.remove { display: inline-flex; justify-content: center; align-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--color-stone-500) !important; background: var(--color-stone-50); font-size: 20px; font-weight: 400; text-decoration: none; transition: all 0.3s ease; line-height: 1; border: 1px solid var(--color-stone-200); }
#maxend-cart-container table.shop_table td.product-remove a.remove:hover { color: #fff !important; background: #ef4444; border-color: #ef4444; transform: scale(1.1); }

/* 4. ÜRÜN GÖRSELİ VE İSMİ */
#maxend-cart-container table.shop_table td.product-thumbnail { width: 100px; padding-right: 1.5rem; }
#maxend-cart-container table.shop_table td.product-thumbnail img { width: 85px; min-width: 85px; height: 85px; object-fit: cover; border-radius: 16px; box-shadow: 0 10px 20px rgba(0,0,0,0.05); display: block; }
#maxend-cart-container table.shop_table td.product-name { padding-right: 1rem;}
#maxend-cart-container table.shop_table td.product-name a { font-weight: 700; color: var(--color-ink); font-size: 15px; text-decoration: none; display: block; line-height: 1.4; transition: color 0.3s; }
#maxend-cart-container table.shop_table td.product-name a:hover { color: var(--color-brand-600); }

/* --- VARYASYON META BİLGİLERİ KORUMA --- */
#maxend-cart-container table.shop_table td.product-name dl.variation { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 0 0; padding: 0; }
#maxend-cart-container table.shop_table td.product-name dl.variation dt,
#maxend-cart-container table.shop_table td.product-name dl.variation dd { display: inline-block; margin: 0; padding: 0; font-size: 12px; }
#maxend-cart-container table.shop_table td.product-name dl.variation dt { font-weight: 700; color: var(--color-stone-500); margin-right: 4px; }
#maxend-cart-container table.shop_table td.product-name dl.variation dd { font-weight: 600; color: var(--color-ink); }
#maxend-cart-container table.shop_table td.product-name dl.variation dd p { margin: 0; display: inline; }

/* 5. FİYAT VE MİKTAR (ADET) */
#maxend-cart-container table.shop_table td.product-price,
#maxend-cart-container table.shop_table td.product-subtotal {
    font-size: 16px;
}
#maxend-cart-container table.shop_table th.product-subtotal,
#maxend-cart-container table.shop_table td.product-subtotal {
    text-align: right;
}

/* --- ESKİ FİYAT (ÇİZİLİ) VE YENİ FİYAT ZIRHI --- */
#maxend-cart-container table.shop_table td.product-price del,
#maxend-cart-container table.shop_table td.product-subtotal del {
    display: block;
    color: var(--color-stone-500);
    font-size: 13px;
    font-weight: 600;
    text-decoration: line-through;
    margin-bottom: 2px;
    opacity: 0.8;
}
#maxend-cart-container table.shop_table td.product-price del .amount,
#maxend-cart-container table.shop_table td.product-subtotal del .amount {
    color: inherit;
    font-weight: inherit;
}

#maxend-cart-container table.shop_table td.product-price ins,
#maxend-cart-container table.shop_table td.product-subtotal ins,
#maxend-cart-container table.shop_table td.product-price > .woocommerce-Price-amount,
#maxend-cart-container table.shop_table td.product-subtotal > .woocommerce-Price-amount {
    display: block;
    color: var(--color-ink);
    font-weight: 700;
    text-decoration: none;
    font-size: 16px;
}
#maxend-cart-container table.shop_table td.product-price ins .amount,
#maxend-cart-container table.shop_table td.product-subtotal ins .amount {
    color: inherit;
    font-weight: inherit;
}

#maxend-cart-container .quantity { display: inline-flex; align-items: center; border-radius: 12px; border: 2px solid var(--color-stone-200); background: #fff; height: 44px; overflow: hidden; transition: border-color 0.3s;}
#maxend-cart-container .quantity:focus-within { border-color: var(--color-ink); }
#maxend-cart-container .quantity .qty { width: 60px; height: 100%; border: none; font-weight: 700; color: var(--color-ink); text-align: center; padding: 0; outline: none; box-shadow: none; appearance: textfield; -webkit-appearance: none; -moz-appearance: textfield;}
#maxend-cart-container .quantity .qty::-webkit-inner-spin-button,
#maxend-cart-container .quantity .qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* − / + around the field (assets/js/cart.js); at the stock limit + fades and a note explains why. */
#maxend-cart-container .quantity.maxend-qty .qty { width: 40px; }
#maxend-cart-container .maxend-qty-btn { flex-shrink: 0; width: 38px; height: 100%; border: 0; background: transparent; color: var(--color-ink); font-size: 18px; font-weight: 500; line-height: 1; cursor: pointer; transition: background-color 0.15s, color 0.15s; }
#maxend-cart-container .maxend-qty-btn:hover { background: var(--color-stone-100); }
#maxend-cart-container .quantity.is-max .maxend-qty-btn[data-step="1"] { color: var(--color-stone-300); cursor: default; }
#maxend-cart-container .quantity.is-max .maxend-qty-btn[data-step="1"]:hover { background: transparent; }
#maxend-cart-container .maxend-cart-max { display: block; margin-top: 6px; font-size: 12px; font-weight: 600; line-height: 1.35; color: var(--color-stone-600); }
#maxend-cart-container .maxend-cart-stock { display: block; margin-top: 6px; font-size: 12px; font-weight: 700; color: #b45309; }

/* Saving in the background: only the prices that will change fade; the cart stays usable. */
#maxend-cart-container tr.cart_item td.product-subtotal,
#maxend-cart-container .cart_totals { transition: opacity 0.2s; }
#maxend-cart-container tr.cart_item.is-updating td.product-subtotal,
#maxend-cart-container .cart_totals.is-updating { opacity: 0.45; }

/* ==========================================
   6. İPTAL EDİLEN ESKİ KUPON VE GÜNCELLE ALANI
   ========================================== */
#maxend-cart-container table.shop_table tbody td.actions {
    padding: 0;
    border: none;
    height: 0;
    visibility: hidden;
    overflow: hidden;
    display: block;
}
#maxend-cart-container .coupon { display: none; }
#maxend-cart-container button[name="update_cart"] { display: none; }

/* ==========================================
   7. SAĞ TARAF: SEPET TOPLAMLARI KUTUSU
   ========================================== */
#maxend-cart-container .cart-collaterals .cart_totals { width: 100%; float: none; background: var(--color-stone-50); padding: 2.5rem; border-radius: 2rem; border: 1px solid var(--color-stone-100); }
#maxend-cart-container .cart_totals h2 { display: block; font-family: var(--font-display); font-size: 24px; font-weight: 500; color: var(--color-ink); margin: 0 0 1.5rem 0; padding-bottom: 1rem; border-bottom: 2px solid var(--color-stone-200); }

#maxend-cart-container .cart_totals table.shop_table { border: none; margin: 0 0 2rem 0; width: 100%; }
#maxend-cart-container .cart_totals table.shop_table th, #maxend-cart-container .cart_totals table.shop_table td { padding: 1.25rem 0; border-bottom: 1px solid var(--color-stone-200); background: transparent; }
#maxend-cart-container .cart_totals table.shop_table th { white-space: nowrap; font-weight: 600; color: var(--color-stone-600); text-align: left; font-size: 14px; }
#maxend-cart-container .cart_totals table.shop_table td { text-align: right; font-weight: 700; color: var(--color-ink); font-size: 15px; }

#maxend-cart-container .cart_totals table.shop_table tr.order-total th, #maxend-cart-container .cart_totals table.shop_table tr.order-total td { padding-top: 1.5rem; border-bottom: none; font-size: 18px; color: var(--color-ink); }
#maxend-cart-container .cart_totals table.shop_table tr.order-total td strong { color: var(--color-brand-600); font-size: 24px; font-weight: 700; }

#maxend-cart-container .cart_totals table.shop_table tr.maxend-savings-row th,
#maxend-cart-container .cart_totals table.shop_table tr.maxend-savings-row td { color: #15803d; }

/* Sepet tablosunun altındaki "Alışverişe Devam Et" bağlantısı. */
#maxend-cart-container .maxend-continue-shopping { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 0.5rem; font-size: 13px; font-weight: 700; color: var(--color-stone-600); text-decoration: none; border-bottom: 1px solid var(--color-stone-300); padding-bottom: 2px; transition: color 0.3s, border-color 0.3s; }
#maxend-cart-container .maxend-continue-shopping:hover { color: var(--color-brand-600); border-color: var(--color-brand-600); }

/* 8. ÖDEME SAYFASINA GİT BUTONU */
#maxend-cart-container .wc-proceed-to-checkout { padding: 0; margin: 0; }
#maxend-cart-container .checkout-button { width: 100%; height: 60px; background: var(--color-brand-600); color: #fff; border-radius: 9999px; font-size: 16px; font-weight: 700; box-shadow: 0 10px 20px -5px rgba(156, 100, 44, 0.3); display: flex; align-items: center; justify-content: center; transition: all 0.4s ease; text-decoration: none; border: none;}
#maxend-cart-container .checkout-button:hover { background: var(--color-ink); transform: translateY(-3px); box-shadow: 0 15px 25px -5px rgba(28, 25, 23, 0.4); }

/* ==========================================
   YENİ KUPON ALANI (Sağ Tarafta Checkout Altı)
   ========================================== */
.maxend-custom-coupon-box { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 2px dashed var(--color-stone-200); display: flex; flex-direction: column; gap: 10px;}
.maxend-custom-coupon-box label { font-size: 13px; font-weight: 600; color: var(--color-stone-700); }
.maxend-custom-coupon-flex { display: flex; gap: 8px; }
.maxend-custom-coupon-flex input { flex-grow: 1; min-width: 0; height: 48px; border: 2px solid var(--color-stone-200); border-radius: 10px; padding: 0 1rem; font-size: 14px; font-weight: 700; color: var(--color-ink); outline: none; transition: border-color 0.3s; background: #fff;}
.maxend-custom-coupon-flex input:focus { border-color: var(--color-ink); }
.maxend-custom-coupon-flex button { height: 48px; padding: 0 1.5rem; background: var(--color-ink); color: #fff; font-size: 14px; font-weight: 700; border-radius: 10px; border: none; cursor: pointer; transition: all 0.3s; }
.maxend-custom-coupon-flex button:hover { background: var(--color-brand-600); }

/* ==========================================
   MOBİL UYUM (Lüks Kart Düzeni)
   ========================================== */
@media (max-width: 1024px) {
    #maxend-cart-container .woocommerce:not(.cart-empty-wrapper) { grid-template-columns: minmax(0, 1fr); gap: 3rem; }
    #maxend-cart-container form.woocommerce-cart-form { width: 100%; }
    #maxend-cart-container .cart-collaterals { width: 100%; position: static; margin-top: 0; }
}

/* Telefon: her ürün kompakt bir kart. Solda görsel; sağda ad, birim fiyat; altta adet ve ara toplam. */
@media (max-width: 768px) {
    #maxend-cart-container table.shop_table_responsive thead { display: none; }
    #maxend-cart-container table.shop_table_responsive tbody tr.cart_item {
        display: grid;
        grid-template-columns: 84px minmax(0, 1fr) auto;
        grid-template-areas:
            "thumb name name"
            "thumb price price"
            "thumb qty subtotal";
        column-gap: 1rem;
        row-gap: 0.4rem;
        align-items: center;
        position: relative;
        margin-bottom: 1rem;
        padding: 1rem;
        border: 1px solid var(--color-stone-200);
        border-radius: 1.25rem;
        background: #fff;
    }

    /* WooCommerce duyarlı hücrelere text-align: right !important veriyor. */
    #maxend-cart-container table.shop_table_responsive tbody tr.cart_item td {
        display: block;
        padding: 0;
        border: 0;
        text-align: left !important;
    }
    #maxend-cart-container table.shop_table_responsive tbody tr.cart_item td::before { content: none; display: none; }

    #maxend-cart-container table.shop_table_responsive td.product-thumbnail { grid-area: thumb; align-self: start; width: auto; padding: 0; }
    #maxend-cart-container table.shop_table_responsive td.product-thumbnail img { width: 84px; min-width: 84px; height: 84px; margin: 0; border-radius: 14px; }

    #maxend-cart-container table.shop_table_responsive tbody tr.cart_item td.product-name { grid-area: name; padding-right: 2.75rem; }
    #maxend-cart-container table.shop_table_responsive td.product-name a { font-size: 14px; }

    #maxend-cart-container table.shop_table_responsive td.product-price { grid-area: price; }
    #maxend-cart-container table.shop_table_responsive td.product-price del,
    #maxend-cart-container table.shop_table_responsive td.product-price ins,
    #maxend-cart-container table.shop_table_responsive td.product-price > .woocommerce-Price-amount { display: inline; margin: 0 0.35rem 0 0; font-size: 13px; }

    #maxend-cart-container table.shop_table_responsive td.product-quantity { grid-area: qty; }
    #maxend-cart-container table.shop_table_responsive td.product-quantity .quantity { height: 38px; }
    #maxend-cart-container table.shop_table_responsive td.product-quantity .qty { width: 48px; }
    #maxend-cart-container table.shop_table_responsive td.product-quantity .quantity.maxend-qty .qty { width: 32px; }
    #maxend-cart-container table.shop_table_responsive td.product-quantity .maxend-qty-btn { width: 32px; }

    #maxend-cart-container table.shop_table_responsive td.product-subtotal { grid-area: subtotal; text-align: right !important; }
    #maxend-cart-container table.shop_table_responsive td.product-subtotal del { font-size: 12px; }
    #maxend-cart-container table.shop_table_responsive td.product-subtotal ins,
    #maxend-cart-container table.shop_table_responsive td.product-subtotal > .woocommerce-Price-amount { font-size: 15px; }

    #maxend-cart-container table.shop_table_responsive td.product-remove { position: absolute; top: 0.75rem; right: 0.75rem; width: auto; }
    #maxend-cart-container table.shop_table_responsive td.product-remove a.remove { width: 36px; height: 36px; font-size: 20px; }

    #maxend-cart-container .cart-collaterals .cart_totals { padding: 1.5rem; border-radius: 1.5rem; }
}

/* Kargo satırı ve hazırlanma süresi (Maxend_WooCommerce::free_shipping_row(), lead_time_row()). */
#maxend-cart-container .cart_totals table.shop_table tr.maxend-shipping-row td { color: #15803d; }
#maxend-cart-container .cart_totals table.shop_table tr.maxend-lead-time td { padding: 0 0 0.5rem; border-bottom: none; text-align: left; font-size: 13px; font-weight: 500; line-height: 1.5; color: var(--color-stone-600); }
#maxend-cart-container .cart_totals table.shop_table tr.maxend-lead-time td::before { content: none; display: none; }
#maxend-cart-container .maxend-lead-time__text { display: flex; gap: 0.5rem; align-items: flex-start; }
/* WooCommerce's responsive table right-aligns every cell with !important on phones. */
#maxend-cart-container .cart_totals table.shop_table_responsive tr.maxend-lead-time td { text-align: left !important; }
#maxend-cart-container .cart_totals table.shop_table tr.maxend-lead-time svg { margin-top: 2px; color: var(--color-brand-700); }

/* Ücretsiz kargoya kalan tutar (Maxend_WooCommerce::free_shipping_progress()). */
#maxend-cart-container .cart_totals table.shop_table tr.woocommerce-shipping-totals:has(+ tr.maxend-free-shipping) > * { border-bottom: none; }
#maxend-cart-container .cart_totals table.shop_table tr.maxend-free-shipping td { padding: 0 0 1.25rem; text-align: left; font-size: 13px; font-weight: 500; line-height: 1.5; color: var(--color-stone-700); }
#maxend-cart-container .cart_totals table.shop_table tr.maxend-free-shipping td::before { content: none; display: none; }
#maxend-cart-container .cart_totals table.shop_table_responsive tr.maxend-free-shipping td { text-align: left !important; }
#maxend-cart-container .maxend-free-shipping strong { color: var(--color-ink); }
#maxend-cart-container .maxend-free-shipping__bar { display: block; width: 100%; height: 6px; margin-top: 0.5rem; border: 0; border-radius: 999px; overflow: hidden; background: var(--color-stone-200); -webkit-appearance: none; appearance: none; }
#maxend-cart-container .maxend-free-shipping__bar::-webkit-progress-bar { background: var(--color-stone-200); }
#maxend-cart-container .maxend-free-shipping__bar::-webkit-progress-value { background: var(--color-brand-500); border-radius: 999px; }
#maxend-cart-container .maxend-free-shipping__bar::-moz-progress-bar { background: var(--color-brand-500); border-radius: 999px; }
/* Tek fiyat: WooCommerce'in "Gönderim hedefi" satırı gereksiz (şablonda filtresi yok). */
#maxend-cart-container .cart_totals .woocommerce-shipping-destination { display: none; }
#maxend-cart-container .maxend-shipping-free { color: #15803d; }
