/*
 * Katalog Görünüm Değiştirici — turgame.com
 * Tüm kurallar YALNIZCA .tg-list-view (html) altında etki eder.
 * Sınıf yokken sitede sıfır değişiklik; grid'e dönünce her şey eski haline gelir.
 */

/* ---- Toolbar'daki grid/list düğmesi ---- */
.tg-view-switch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
    vertical-align: middle;
}
.tg-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    background: #fff;
    color: #8a8a8a;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.tg-view-btn:hover {
    color: #222;
    border-color: #bdbdbd;
}
.tg-view-btn.is-active {
    color: #fff;
    background: #111;
    border-color: #111;
}
.tg-view-btn svg {
    fill: currentColor;
    display: block;
}

/* ================= LIST GÖRÜNÜMÜ ================= */

/* Grid'i iptal et: ürünler blok olarak alt alta. */
.tg-list-view ul.products {
    display: block !important;
    margin: 0 !important;
    grid-template-columns: none !important;
}
.tg-list-view ul.products::before,
.tg-list-view ul.products::after {
    display: none !important;
    content: none !important;
}

/* Her ürün tam genişlik, tek sütun. Razzi columns-2/3/4 ve mobile-* kurallarını
   ezmek için yüksek özgüllük + layout-kritik prop'larda !important. */
.tg-list-view ul.products li.product,
.tg-list-view ul.products.columns-2 li.product,
.tg-list-view ul.products.columns-3 li.product,
.tg-list-view ul.products.columns-4 li.product,
.tg-list-view ul.products.columns-5 li.product {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    clear: both !important;
    margin: 0 0 14px 0 !important;
    padding: 0 !important;
}

/* Kart içi: yatay dizilim — solda resim, sağda bilgi. */
.tg-list-view ul.products li.product .product-inner {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 18px;
    border: 1px solid #ececec;
    border-radius: 10px;
    padding: 12px 16px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
}

/* Sol: sabit genişlikli resim alanı. */
.tg-list-view ul.products li.product .product-thumbnail {
    flex: 0 0 150px;
    width: 150px;
    max-width: 150px;
    margin: 0 !important;
    position: relative;
}
.tg-list-view ul.products li.product .product-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* Hover/quick-view/wishlist buton grubu resmin üstünde küçük kalsın. */
.tg-list-view ul.products li.product .product-loop__buttons {
    position: absolute;
    top: 6px;
    right: 6px;
    left: auto;
    bottom: auto;
    flex-direction: column;
    gap: 6px;
    margin: 0;
}

/* Sağ: başlık ve fiyat tam satır; butonlar (Sepete Ekle + Hemen Al) yan yana.
   row-wrap ile: başlık %100 → kendi satırı, fiyat %100 → kendi satırı,
   iki buton auto → aynı satırı paylaşır. */
.tg-list-view ul.products li.product .product-summary {
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0; /* uzun başlıklar flex'te taşmasın */
    text-align: left !important;
    padding: 0 !important;
    display: flex !important;
    flex-flow: row wrap;
    align-items: center;
    gap: 8px 10px;
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}
.tg-list-view ul.products li.product .product-summary > * {
    flex: 0 0 100%;
    width: auto;
    margin: 0;
}
/* Butonlar tam genişlik DEĞİL → yan yana dizilir. */
/* Sepete Ekle ve Buy Now — EŞİT boyut (aynı genişlik/yükseklik), yan yana. */
.tg-list-view ul.products li.product .product-summary > .add_to_cart_button,
.tg-list-view ul.products li.product .product-summary > .tg-loop-buy-now {
    flex: 0 0 auto;
    width: auto !important;
    min-width: 150px !important;
    height: 46px !important;
    margin: 0 !important; /* temanın Sepete Ekle'ye verdiği margin-top:24px'i sıfırla → iki buton aynı hizada */
    padding: 0 18px !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
}
.tg-list-view ul.products li.product .product-summary > .added_to_cart {
    flex: 0 0 auto;
    width: auto !important;
}

/* --- Gizli erişilebilirlik metni (screen-reader-text) mobilde sayfayı sağa
   itiyordu; her zaman kırpılı/gizli kalsın. --- */
.tg-list-view ul.products li.product .screen-reader-text {
    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;
    flex-basis: auto !important;
}

/* --- Buy Now YALNIZCA list görünümünde görünür. ---
   Buton her döngüde HTML olarak basılır ama varsayılan olarak gizlidir;
   sadece list görünümü (html.tg-list-view) aktifken gösterilir. Böylece
   normal grid'de ve anasayfa/ilgili ürün döngülerinde hiç görünmez. */
.tg-loop-buy-now {
    display: none !important;
}
.tg-list-view ul.products li.product .tg-loop-buy-now {
    display: inline-flex !important;
    margin: 0;
}
.tg-list-view ul.products li.product .woocommerce-loop-product__title {
    font-size: 16px;
    line-height: 1.4;
    margin: 0;
}

/* Fiyat ve sepet butonunu satır içi/rahat hizala. */
.tg-list-view ul.products li.product .price {
    margin: 0;
    font-size: 16px;
}
.tg-list-view ul.products li.product .add_to_cart_button,
.tg-list-view ul.products li.product .button {
    width: auto;
    display: inline-flex;
    align-items: center;
}

/* ---- Mobil: resmi küçült, düzeni koru ---- */
@media (max-width: 575px) {
    .tg-list-view ul.products li.product .product-thumbnail {
        flex-basis: 100px;
        width: 100px;
        max-width: 100px;
    }
    .tg-list-view ul.products li.product .product-inner {
        gap: 12px;
        padding: 10px;
    }
    .tg-list-view ul.products li.product .woocommerce-loop-product__title {
        font-size: 14px;
    }
}

/* ≤991px: Razzi'nin `ul.products.mobile-show-atc ... .rz-loop_atc_button`
   kuralı Sepete Ekle / Choose price butonunu SİYAH (bg-dark) yapıp okunmaz
   hale getiriyordu. Aynı aralıkta ve daha yüksek özgüllükle ez → outline,
   okunur. Hem .add_to_cart_button hem .rz-loop_atc_button hedeflenir. */
@media (max-width: 991px) {
    /* HEM grid HEM list — .mobile-show-atc ile temanın (0,5,1) özgüllüğünü
       (0,5,2) ile aşarız; .tg-list-view şartı YOK, grid'de de uygulanır. */
    ul.products.mobile-show-atc li.product .product-summary .add_to_cart_button,
    ul.products.mobile-show-atc li.product .product-summary .rz-loop_atc_button {
        background: transparent !important;
        background-color: transparent !important;
        color: #111 !important;
        border: 1px solid #111 !important;
    }
}

/* ≤767px (telefon): iki buton dar summary'ye sığmayıp alt alta kayıyordu.
   flex:1 ile satırı eşit paylaşsınlar → her zaman YAN YANA, eşit boyut. */
@media (max-width: 767px) {
    .tg-list-view ul.products li.product .product-summary > .add_to_cart_button,
    .tg-list-view ul.products li.product .product-summary > .tg-loop-buy-now {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: auto !important;
        height: 44px !important;
        padding: 0 8px !important;
        font-size: 13px !important;
    }
}
