/* Genel Stil Değişkenleri */

/* Mobile First Approach */
:root {
    --primary-color: #e53935; /* Kırmızı */
    --secondary-color: #212121; /* Koyu Gri/Siyah */
    --white-color: #ffffff;
    --text-color: #424242;
    --light-bg: #f5f5f5;
    --border-color: #e0e0e0;

    /* SABİT SOL BOŞLUK: Kategorilerin olduğu kısmın solundaki boşluk */
    --sidebar-left-offset: 200px; 

    /* SAĞ TARAF İÇİN BOŞLUK: Ürünlerin sağındaki boşluk (bu da sol taraftaki boşluğa eşitlenmeli) */
    --products-right-offset: 200px; /* sidebar-left-offset ile aynı değerde */

    /* Sidebar'ın sabit genişliği */
    --sidebar-width: 240px;
    /* Sidebar ile ürün gridi arasındaki boşluk */
    --sidebar-gap: 20px;
    /* Ürün kartları arasındaki boşluk */
    --product-card-gap: 15px;
    /* Bir satırdaki hedef ürün sayısı */
    --target-product-columns: 4; 
    /* Ürün kartının yaklaşık minimum genişliği (4 ürüne göre ayarlanacak) */
    --min-product-card-width: 250px; /* Daha büyük kartlar için yaklaşık değer */
}

/* Sayfa Bannerı (Tüm sayfa genişliğini kaplayacak) */
.page-banner {
    background-color: var(--light-bg);
    padding: 20px 0; 
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    width: 100%; /* Tam genişliği kapla */
    box-sizing: border-box;
}

/* products-content-wrapper (Sayfanın genel içeriğini sarar, boşlukları içerideki elementler yönetir) */
.products-content-wrapper {
    padding-top: 60px;
    padding-bottom: 60px;
    padding-left: 0; /* Boşlukları artık products-main yönetecek */
    padding-right: 0; /* Boşlukları artık products-main yönetecek */
    max-width: none; /* Genişliği kısıtlama, içeridekiler yönetecek */
    width: 100%; /* Tam genişlik */
    margin: 0; /* Margin kaldırdık */
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Ana ürünler kısmı: Sidebar ve Grid için flex konteyner */
.products-main {
    display: flex;
    flex-wrap: nowrap; /* Sarmalama olmasın */
    align-items: flex-start;
    /* Sol boşluk için sidebar-left-offset kullan */
    margin-left: var(--sidebar-left-offset); 
    /* Sağ boşluk için products-right-offset kullan */
    margin-right: var(--products-right-offset);
    padding: 0;
    max-width: none; /* İçerik boşluklara göre esneyecek */
    width: auto; /* Otomatik genişlik */
    box-sizing: border-box;
}

/* Ürünler kenar çubuğu (sidebar) */
.products-sidebar {
    flex: 0 0 var(--sidebar-width); /* Sabit genişlik */
    background-color: var(--white-color);
    border-radius: 5px; 
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); 
    height: fit-content; 
    position: sticky; 
    top: 20px; 
    z-index: 10;
    order: 1; 
    box-sizing: border-box;
}

.sidebar-widget {
    margin-bottom: 20px;
}

.sidebar-widget h3 {
    font-size: 1.3em;
    color: var(--secondary-color);
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    font-weight: 600;
}

.category-list {
    list-style: none;
    padding: 0;
}

.category-list li {
    margin-bottom: 8px;
}

.category-list li a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95em;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.3s ease;
}

.category-list li a span {
    color: var(--primary-color);
    font-weight: bold;
}

.category-list li a:hover {
    color: var(--primary-color);
}

/* Fiyat Filtresi */
.price-filter .price-slider {
    position: relative;
    height: 6px;
    background: var(--light-bg);
    border-radius: 3px;
    margin-bottom: 15px;
}

.price-filter .price-slider input[type="range"] {
    position: absolute;
    width: 100%;
    height: 6px;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
}

.price-filter .price-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: grab;
    border: 2px solid var(--white-color);
    margin-top: -5px;
    pointer-events: all;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
}

.price-filter .price-inputs {
    display: flex;
    align-items: center;
    gap: 5px;
}

.price-filter input[type="text"] {
    width: 100px;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    text-align: center;
    color: var(--text-color);
    font-size: 0.9em;
    background-color: var(--light-bg);
}

.price-filter span {
    color: var(--text-color);
    font-size: 0.9em;
}

.price-filter .filter-price-btn {
    background-color: var(--primary-color);
    color: var(--white-color);
    border: none;
    padding: 6px 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-weight: 500;
    font-size: 0.9em;
}

.price-filter .filter-price-btn:hover {
    background-color: var(--secondary-color);
}

/* Marka Filtresi */
.brand-filter .filter-item {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.brand-filter input[type="checkbox"] {
    margin-right: 8px;
    accent-color: var(--primary-color);
    transform: scale(1);
}

.brand-filter label {
    color: var(--text-color);
    font-size: 0.95em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
}

.brand-filter label span {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 0.8em;
}

/* Ürün Gridini ve Sayfalamayı saran wrapper (Main content area) */
.products-grid-wrapper {
    flex: 1; /* Kalan tüm alanı kapla */
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-left: var(--sidebar-gap); /* Sidebar ile arasına boşluk */
    padding-right: 0; /* Sağ padding'i yok */
    order: 2; /* Sidebar'dan sonra gelsin */
    box-sizing: border-box;
    width: auto; /* Esnekliği koru */
}

/* Ürün araç çubuğu (toolbar) */
.products-toolbar {
    display: none; 
}

/* Ürün Grid Alanı (4 ürün yan yana zorlandı) */
.products-grid {
    display: grid;
    grid-template-columns: repeat(var(--target-product-columns), 1fr); 
    gap: var(--product-card-gap);
    transition: all 0.3s ease;
    width: 100%; /* Üst elementi kapla */
    box-sizing: border-box;
}

/* Ürün Kartı */
.product-card {
    background-color: var(--white-color);
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--primary-color);
    color: var(--white-color);
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.7em;
    font-weight: bold;
    z-index: 2;
}

.product-image {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 1/1; 
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--light-bg);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    display: block;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-actions {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    opacity: 0;
    transform: translateX(15px);
    transition: all 0.3s ease;
    z-index: 2;
}

.product-card:hover .product-actions {
    opacity: 1;
    transform: translateX(0);
}

.product-actions button {
    background-color: var(--white-color);
    color: var(--secondary-color);
    border: 1px solid var(--border-color);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 0.9em;
    cursor: pointer;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-actions button:hover {
    background-color: var(--primary-color);
    color: var(--white-color);
    border-color: var(--primary-color);
}

.product-actions button.add-wishlist.added {
    color: var(--primary-color);
}

.product-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-title {
    font-size: 1em;
    color: var(--secondary-color);
    margin-bottom: 8px;
    font-weight: 600;
    min-height: 40px;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
}

.current-price {
    font-size: 1.2em;
    color: var(--primary-color);
    font-weight: bold;
}

.old-price {
    font-size: 0.9em;
    color: var(--text-color);
    text-decoration: line-through;
}

.product-buttons .contact-btn {
    display: block;
    width: 100%;
    background-color: var(--secondary-color);
    color: var(--white-color);
    padding: 8px 10px;
    border-radius: 3px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease;
    text-align: center;
    font-size: 0.9em;
}

.product-buttons .contact-btn:hover {
    background-color: var(--primary-color);
}

.product-buttons .contact-btn i {
    margin-right: 5px;
}

/* Sayfalama */
.pagination {
    display: flex;
    justify-content: flex-end; /* Sağ tarafa yasla */
    align-items: center;
    margin-top: 30px;
    padding-right: 0; 
    gap: 8px;
    /* products-main ile aynı sol ve sağ boşluklara sahip olacak */
    margin-left: calc(var(--sidebar-width) + var(--sidebar-gap)); 
    margin-right: 0; /* products-grid-wrapper'ın sağına yapışacak */
    width: auto; /* İçeriğe göre genişle */
    box-sizing: border-box;
    /* max-width'i sidebar ve boşluklar çıkarılarak hesapla */
    max-width: calc(100% - var(--sidebar-width) - var(--sidebar-gap));
}

.pagination a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    background-color: var(--white-color);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.8em;
}

.pagination a.active,
.pagination a:hover {
    background-color: var(--primary-color);
    color: var(--white-color);
    border-color: var(--primary-color);
}

.pagination a.prev,
.pagination a.next {
    border-radius: 3px;
}


/* Responsive Düzenlemeler */
/* Geniş ekranlar (min-width: 993px - daha büyük ekranlarda eşit boşluk ve 4 sütun) */
@media (min-width: 993px) {
    /* products-main'in genel sayfa boşluklarını koru */
    .products-main {
        width: auto; /* Otomatik genişlik */
    }
    .products-grid {
        grid-template-columns: repeat(var(--target-product-columns), 1fr); 
    }
}

/* Tablet ve daha küçük ekranlar (max-width: 992px) */
@media (max-width: 992px) {
    .products-content-wrapper {
        padding-left: var(--products-right-offset); /* Mobil için de aynı boşluğu koru */
        padding-right: var(--products-right-offset); /* Mobil için de aynı boşluğu koru */
        width: 100%;
    }

    .products-main {
        flex-direction: column; /* Dikey sıralama */
        width: 100%;
        margin-left: 0; /* Mobil görünümde sol boşluğu sıfırla */
        margin-right: 0; /* Mobil görünümde sağ boşluğu sıfırla */
        max-width: 100%; 
    }

    .products-sidebar {
        position: static; /* Sabit konumdan çıkar */
        width: 100%; /* Tam genişliği kapla */
        margin-bottom: 20px; /* Ürünlere doğru boşluk bırak */
    }

    .products-grid-wrapper {
        padding-left: 0; /* Sidebar ile aradaki boşluğu kaldır */
        width: 100%; /* Tam genişliği kapla */
    }

    .pagination {
        justify-content: center; /* Ortala */
        width: 100%; /* Tam genişliği kapla */
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); 
        gap: 10px;
    }
}

/* Çok küçük mobil cihazlar (768px altı) */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); 
        gap: 8px;
    }

    .products-content-wrapper {
        padding-left: 15px; /* Daha küçük mobil cihazlarda padding azaltılabilir */
        padding-right: 15px;
    }
}

/* Çok çok küçük mobil cihazlar (480px altı) */
@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); 
        gap: 5px;
    }

    .products-content-wrapper {
        padding-left: 10px; /* En küçük mobil cihazlarda padding daha da azaltılabilir */
        padding-right: 10px;
    }
    
    .page-banner {
        padding: 15px 0;
    }
    
    .page-banner h1 {
        font-size: 1.5em;
    }
    
    .page-banner p {
        font-size: 0.9em;
    }
    
    .products-sidebar {
        padding: 15px;
    }
    
    .sidebar-widget h3 {
        font-size: 1.1em;
    }
    
    .category-list li a {
        font-size: 0.9em;
        padding: 8px 0;
    }
    
    .product-card {
        padding: 10px;
    }
    
    .product-title {
        font-size: 0.9em;
        min-height: 40px;
    }
    
    .current-price {
        font-size: 1.1em;
    }
    
    .btn-add-to-cart {
        padding: 8px 12px;
        font-size: 0.8em;
    }
    
    .contact-btn {
        padding: 6px 10px;
        font-size: 0.8em;
    }
}

/* Extra Small Devices */
@media (max-width: 360px) {
    .products-content-wrapper {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .page-banner h1 {
        font-size: 1.3em;
    }
    
    .page-banner p {
        font-size: 0.8em;
    }
    
    .products-sidebar {
        padding: 12px;
    }
    
    .sidebar-widget h3 {
        font-size: 1em;
    }
    
    .category-list li a {
        font-size: 0.8em;
        padding: 6px 0;
    }
    
    .product-card {
        padding: 8px;
    }
    
    .product-title {
        font-size: 0.8em;
        min-height: 35px;
    }
    
    .current-price {
        font-size: 1em;
    }
    
    .btn-add-to-cart {
        padding: 6px 10px;
        font-size: 0.75em;
    }
    
    .contact-btn {
        padding: 5px 8px;
        font-size: 0.75em;
    }
    
    .pagination a {
        padding: 6px 10px;
        font-size: 0.8em;
    }
}