/* 
================================================================
PRODUCT GRID - ABSOLUTE STABILITY OVERHAUL
================================================================
*/

/* 1. Global Typography */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700;800&display=swap');

body,
h1,
h2,
h3,
h4,
h5,
h6,
.product-title,
.woocommerce-loop-product__title,
.product_title,
.price,
.button,
.add_to_cart_button {
    font-family: 'Open Sans', sans-serif !important;
}

/* 2. Rigid Vertical Product Card Layout (Universal) */
.woocommerce ul.products li.product,
.klb-module .product,
.owl-item .product,
.product-inner,
.related .product,
#related-products .product,
.up-sells .product {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 460px !important;
    /* Fixed vertical height */
    background: #ffffff !important;
    border: 1px solid #f0f0f0 !important;
    border-radius: 8px !important;
    padding: 12px !important;
    transition: all 0.25s ease !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
    position: relative !important;
    margin-bottom: 20px !important;
    overflow: hidden !important;
}

/* Force chain expansion for flex anchoring */
.owl-item,
.owl-stage-desktop,
.owl-stage,
.product>a,
.product-inner>a,
.product-body,
.klb-product-inner {
    display: flex !important;
    flex-direction: column !important;
    flex-grow: 1 !important;
    height: 100% !important;
}

/* Hover Effect */
.woocommerce ul.products li.product:hover,
.klb-module .product:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08) !important;
    transform: translateY(-3px) !important;
}

/* 3. Vertical Image Container (Fix Clipping) */
.product-thumbnail,
.klb-product-thumbnail,
.product-media {
    height: 200px !important;
    /* Increased to prevent clipping */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 12px !important;
    background: #fff !important;
    padding: 5px !important;
}

.product-thumbnail img,
.klb-product-thumbnail img,
.product-media img {
    max-height: 100% !important;
    width: auto !important;
    object-fit: contain !important;
    display: block !important;
}

/* 4. Balanced Titles */
.product-title,
.woocommerce-loop-product__title,
.related .product h2,
.related .product h3 {
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
    font-weight: 700 !important;
    color: #333 !important;
    height: 2.8em !important;
    margin-bottom: 10px !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    text-align: left !important;
}

/* 5. Pricing & Button Anchoring */
.product-cart,
.product-price-wrapper,
.price,
.add_to_cart_button {
    margin-top: auto !important;
}

.price,
.price .amount,
.woocommerce-Price-amount {
    color: #27ae60 !important;
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    margin-bottom: 8px !important;
    display: inline-block !important;
}

.price del,
.price del * {
    color: #999 !important;
    text-decoration: line-through !important;
    font-size: 0.85rem !important;
    opacity: 0.7 !important;
}

/* Single Product Page PRICE (Large size ONLY for main product) */
.single-product .summary .price,
.single-product .summary .price *,
.single-product .summary span.price {
    font-size: 2.6rem !important;
    color: #2ecc71 !important;
    font-weight: 800 !important;
    margin-bottom: 15px !important;
    display: block !important;
}

/* Single Product Layout Fix (Traditional 50/50 Split) */
.single-product-wrapper .product-body {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    /* Force side-by-side */
    gap: 50px !important;
    margin-top: 40px !important;
    align-items: flex-start !important;
    width: 100% !important;
}

.single-product-wrapper .product-gallery-column {
    flex: 0 0 40% !important;
    max-width: 40% !important;
    width: 40% !important;
}

.single-product-wrapper .product-detail-column {
    flex: 0 0 60% !important;
    max-width: 60% !important;
    width: 60% !important;
    text-align: left !important;
    padding-left: 40px !important;
}

/* Ensure images fit nicely in their column without being huge */
.single-product .woocommerce-product-gallery {
    width: 100% !important;
    margin-bottom: 0 !important;
    max-width: 500px !important;
    /* Cap gallery width */
}

.single-product .woocommerce-product-gallery img {
    border-radius: 12px !important;
    border: 1px solid #eee !important;
}

/* Tighter single product summary */
.single-product .summary .product-title,
.single-product .summary .product_title {
    margin-bottom: 10px !important;
    font-size: 2.2rem !important;
}

.single-product .summary p.price {
    margin-top: 0 !important;
    margin-bottom: 20px !important;
}

/* Single Product Cart Action Bar (REFINED) */
.single-product div.product form.cart {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    /* Allow wrapping for wishlist */
    align-items: center !important;
    gap: 15px !important;
    /* Add gap back for separation */
    margin-top: 15px !important;
}

.single-product div.product form.cart .quantity {
    flex: 0 0 auto !important;
    margin: 0 !important;
}

.single-product div.product form.cart .quantity input.qty {
    height: 50px !important;
    width: 60px !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    background: #f9f9f9 !important;
}

.single-product div.product form.cart .single_add_to_cart_button {
    flex: 1 !important;
    /* Make it long */
    height: 50px !important;
    border-radius: 6px !important;
    background-color: #2ecc71 !important;
    font-size: 1.1rem !important;
    font-weight: 800 !important;
    box-shadow: 0 3px 0 #27ae60 !important;
}

/* Force wishlist/compare to next line */
.single-product form.cart .yith-wcwl-add-to-wishlist,
.single-product form.cart .compare,
.single-product .ignavo-wishlist-action,
.single-product div.product form.cart div.product-action {
    display: block !important;
    flex: 0 0 100% !important;
    margin-top: 15px !important;
    border: none !important;
    background: none !important;
}

.single-product .product-action {
    display: flex !important;
    gap: 20px !important;
    width: 100% !important;
}

/* Remove "Product Added" message big gap */
.woocommerce-message,
.ignavo-product-notification {
    margin-top: 0 !important;
    margin-bottom: 10px !important;
    padding: 10px 15px !important;
}

@media (max-width: 991px) {
    .single-product-wrapper .product-body {
        flex-direction: column !important;
        flex-wrap: wrap !important;
        gap: 20px !important;
        /* Reduced from 50px */
    }

    .single-product-wrapper .product-gallery-column,
    .single-product-wrapper .product-detail-column {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        padding-left: 0 !important;
    }
}

/* 6. High-Visibility Button (FORCED) */
.product-price-button,
.product-cart-button {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
}

/* 6. High-Specificity Flat Buttons */
.woocommerce a.button,
.woocommerce button.button,
.add_to_cart_button,
.single_add_to_cart_button,
.loop-button {
    background-color: #2ecc71 !important;
    color: #ffffff !important;
    text-transform: uppercase !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    padding: 12px 10px !important;
    border-radius: 6px !important;
    width: 100% !important;
    display: block !important;
    text-align: center !important;
    transition: all 0.2s ease !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.woocommerce a.button:hover,
.woocommerce button.button:hover {
    background-color: #27ae60 !important;
    opacity: 0.9 !important;
    transform: none !important;
}

/* STRICT RED FOR OUT OF STOCK */
.woocommerce .product.out-of-stock .button,
.woocommerce .product.out-of-stock .add_to_cart_button,
.woocommerce a.button.disabled,
.woocommerce button.button:disabled,
.woocommerce a.button[href*="STOKTA"],
.out-of-stock .button {
    background-color: #e74c3c !important;
    /* FORCED RED */
    color: #ffffff !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
}

/* 7. Strict 4-Column Layout for Related Products */
.related .products,
.up-sells .products {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    justify-content: flex-start !important;
    padding: 0 !important;
    margin: 0 !important;
}

.related .products .product,
.up-sells .products .product {
    flex: 0 0 calc(25% - 15px) !important;
    /* Exactly 4 columns */
    max-width: calc(25% - 15px) !important;
    width: calc(25% - 15px) !important;
    margin-right: 0 !important;
}

/* Mobile Adjustments (Minimalist) */
@media (max-width: 991px) {

    .related .products .product,
    .up-sells .products .product {
        flex: 0 0 calc(50% - 10px) !important;
        max-width: calc(50% - 10px) !important;
    }
}

@media (max-width: 480px) {

    .related .products .product,
    .up-sells .products .product {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* ===========================================================
   KOSAR TICARET - ÜRÜN SAYFASI PROFESYONEL LAYOUT
   SKU + Stok durumu sol tarafta, Açıklama başlığı üstte
   =========================================================== */

/* 1. SKU + Stok Durumu: yan yana, sol hizalı */
.woocommerce-product-details__short-description,
.woocommerce div.product .woocommerce-product-details__short-description {
    margin-top: 12px;
}

/* SKU ve stok wrapper'ı flex yap */
.product_meta {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 10px 20px !important;
    margin: 14px 0 18px !important;
    padding: 10px 16px !important;
    background: #f8f9fc !important;
    border-radius: 8px !important;
    border-left: 4px solid #1a73e8 !important;
}

/* SKU etiketi */
.product_meta .sku_wrapper {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 13px !important;
    color: #555 !important;
}

.product_meta .sku_wrapper::before {
    content: "🏷️";
    font-size: 14px;
}

.product_meta .sku_wrapper .sku {
    font-weight: 700 !important;
    color: #1a1a1a !important;
}

/* Stok durumu - badge stili */
.woocommerce div.product p.stock,
.woocommerce div.product .stock {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 4px 10px !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    margin: 0 !important;
}

.woocommerce div.product .stock.in-stock {
    background: #e6f4ea !important;
    color: #1e7e34 !important;
    border: 1px solid #b7dfbf !important;
}

.woocommerce div.product .stock.in-stock::before {
    content: "✔";
    font-size: 11px;
}

.woocommerce div.product .stock.out-of-stock {
    background: #fce8e6 !important;
    color: #b71c1c !important;
    border: 1px solid #f5c6c2 !important;
}

.woocommerce div.product .stock.out-of-stock::before {
    content: "✖";
    font-size: 11px;
}

/* 2. Ürün Açıklaması (Uzun Açıklama) üstüne başlık */
.woocommerce-tabs ul.tabs {
    display: flex !important;
    border-bottom: 2px solid #e0e0e0 !important;
    margin-bottom: 0 !important;
    padding-left: 0 !important;
    list-style: none !important;
    gap: 4px !important;
}

.woocommerce-tabs ul.tabs li {
    margin: 0 !important;
    padding: 0 !important;
}

.woocommerce-tabs ul.tabs li a {
    display: block !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #555 !important;
    border: 2px solid transparent !important;
    border-bottom: none !important;
    border-radius: 6px 6px 0 0 !important;
    background: #f5f5f5 !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
}

.woocommerce-tabs ul.tabs li.active a,
.woocommerce-tabs ul.tabs li a:hover {
    background: #ffffff !important;
    color: #1a73e8 !important;
    border-color: #e0e0e0 !important;
    border-bottom-color: transparent !important;
}

.woocommerce-tabs .panel {
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-top: none !important;
    border-radius: 0 6px 6px 6px !important;
    padding: 24px !important;
}

/* Açıklama paneli için başlık */
.woocommerce-tabs #tab-description::before {
    content: "📋 Ürün Açıklaması";
    display: block !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    color: #1a1a2e !important;
    margin-bottom: 16px !important;
    padding-bottom: 12px !important;
    border-bottom: 2px solid #e8eaf0 !important;
}

/* 3. MOBİL UYUM */
@media (max-width: 768px) {
    .product_meta {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 10px 12px !important;
    }

    .woocommerce-tabs ul.tabs {
        flex-wrap: wrap !important;
    }

    .woocommerce-tabs ul.tabs li a {
        padding: 8px 14px !important;
        font-size: 13px !important;
    }

    .woocommerce-tabs .panel {
        padding: 16px !important;
    }

    .woocommerce-tabs #tab-description::before {
        font-size: 16px !important;
    }
}

/* ===========================================================
   KOSAR TICARET - ÜRÜN META DUPLICATE GİZLE
   İkinci (alttaki) "Kategoriler" bloğunu gizle
   =========================================================== */

/* Ürün özeti içinde birden fazla .product_meta varsa sadece ilkini göster */
.product-detail-inner .product_meta~.product_meta,
.woocommerce-product-gallery~.summary .product_meta+.product_meta,
.single-product .summary .product_meta:last-child:not(:first-child) {
    display: none !important;
}

/* Paylaş butonlarının ALTINDA çıkan ikinci meta bloğunu hedefle */
.woocommerce div.product .product_meta.single-bottom:last-of-type {
    display: none !important;
}

/* Alternatif: product-detail-inner dışında kalan meta bloğunu gizle */
.single-product .single-bottom.product_meta+.single-bottom.product_meta {
    display: none !important;
}