/* ============================================
   Nomagri E-Ticaret - Products Page V1 Styles
   Classic Layout with Sidebar Filters
   ============================================ */

/* ===== PAGE HEADER ===== */
.page-header {
    background-color: var(--color-primary);
    padding: var(--space-12) 0;
    text-align: center;
}

.breadcrumb {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: var(--space-4);
}

.breadcrumb a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb a:hover {
    color: var(--color-accent);
}

.page-header__title {
    font-family: var(--font-primary);
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-white);
    margin-bottom: var(--space-2);
}

.page-header__desc {
    font-size: var(--font-size-lg);
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--font-secondary);
    font-style: italic;
}

/* ===== PRODUCTS SECTION ===== */
.products-section {
    padding: var(--space-12) 0;
    background-color: var(--color-cream);
}

.products-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--space-8);
}

/* ===== SIDEBAR ===== */
.products-sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

/* ===== MOBİL FİLTRE TOGGLE BUTONU + DRAWER ===== */
/* Desktop'ta toggle + drawer header gizli (sidebar inline görünür) */
.products-filter-toggle,
.products-sidebar__drawer-header,
.products-filter-backdrop {
    display: none;
}

/* Mobil/tablet drawer (sidebar layout 1 kolona düştüğünde — 992px altı) */
@media (max-width: 992px) {
    .products-filter-toggle {
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);
        padding: 12px 22px;
        background-color: var(--color-primary);
        color: var(--color-white);
        border: none;
        border-radius: var(--radius-lg);
        font-family: var(--font-body);
        font-size: var(--font-size-base);
        font-weight: var(--font-weight-semibold);
        cursor: pointer;
        margin-bottom: var(--space-6);
        box-shadow: var(--shadow-md);
        transition: all var(--transition-fast);
        /* WCAG AA touch ≥44 — padding 12+12+font garanti eder */
        min-height: 44px;
    }

    .products-filter-toggle:hover {
        background-color: var(--color-primary-dark);
        transform: translateY(-1px);
    }

    .products-filter-toggle__count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 22px;
        height: 22px;
        padding: 0 6px;
        margin-left: 4px;
        background-color: var(--color-accent, var(--color-gold, #9E7A38));
        color: var(--color-white);
        border-radius: var(--radius-full);
        font-size: var(--font-size-xs);
        font-weight: var(--font-weight-bold);
    }

    /* Backdrop (drawer açıkken arka planı karart) */
    .products-filter-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(26, 28, 24, 0.5);
        z-index: 998;
        cursor: pointer;
    }

    /* Sidebar mobile'de slide-in drawer */
    .products-sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        width: 85%;
        max-width: 380px;
        height: 100vh;
        background-color: var(--color-white);
        box-shadow: var(--shadow-xl);
        padding: 0;
        margin: 0;
        z-index: 999;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        display: block;
        grid-template-columns: none;
        gap: 0;
    }

    .products-sidebar.is-open {
        transform: translateX(0);
    }

    /* Drawer header (sticky en üstte, tasarım dilinde) */
    .products-sidebar__drawer-header {
        position: sticky;
        top: 0;
        z-index: 1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--space-5) var(--space-6);
        background-color: var(--color-primary);
        color: var(--color-white);
    }

    .products-sidebar__drawer-title {
        font-family: var(--font-primary);
        font-size: var(--font-size-lg);
        font-weight: var(--font-weight-semibold);
        margin: 0;
    }

    .products-sidebar__drawer-close {
        /* WCAG touch target */
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: transparent;
        border: none;
        color: var(--color-white);
        cursor: pointer;
        border-radius: var(--radius-md);
        transition: background-color var(--transition-fast);
    }

    .products-sidebar__drawer-close:hover {
        background-color: rgba(255, 255, 255, 0.15);
    }

    /* Drawer içindeki filter section'lar — aralarına nefes ver, padding düzelt */
    .products-sidebar > .filter-section,
    .products-sidebar > button {
        margin-left: var(--space-5);
        margin-right: var(--space-5);
    }

    .products-sidebar > .filter-section:first-of-type {
        margin-top: var(--space-5);
    }

    .products-sidebar > button {
        margin-top: var(--space-4);
        margin-bottom: var(--space-6);
    }

    /* Body'nin scroll'u kilitlensin diye drawer açıkken — Alpine bunu ayrı yapar
       ama CSS de overflow yardımcı olur (touch'larda underlying scroll önlenir) */
}

/* iPhone SE gibi çok dar ekranlarda drawer tam ekran */
@media (max-width: 480px) {
    .products-sidebar {
        width: 100%;
        max-width: none;
    }
}

.filter-section {
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.filter-section__title {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-gray-800);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-stone);
}

.filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.filter-list li {
    margin-bottom: var(--space-3);
}

.filter-list li:last-child {
    margin-bottom: 0;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: var(--space-3);
}

.filter-checkbox input {
    display: none;
}

.filter-checkbox__mark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.filter-checkbox input:checked + .filter-checkbox__mark {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.filter-checkbox input:checked + .filter-checkbox__mark::after {
    content: '✓';
    color: var(--color-white);
    font-size: 12px;
    font-weight: bold;
}

.filter-checkbox__label {
    font-size: var(--font-size-sm);
    color: var(--color-gray-700);
    flex: 1;
}

.filter-checkbox__count {
    font-size: var(--font-size-xs);
    color: var(--color-gray-400);
}

.filter-checkbox:hover .filter-checkbox__mark {
    border-color: var(--color-primary);
}

/* Price Range */
.price-range__inputs {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.price-range__inputs input {
    flex: 1;
}

.price-range__inputs span {
    color: var(--color-gray-400);
}

/* ===== MAIN CONTENT ===== */
.products-main {
    min-width: 0;
}

/* Toolbar */
.products-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--color-white);
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
}

.products-toolbar__count {
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
}

.products-toolbar__right {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.products-toolbar__sort {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.products-toolbar__sort label {
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
}

.products-toolbar__view {
    display: flex;
    gap: var(--space-1);
    padding-left: var(--space-4);
    border-left: 1px solid var(--color-stone);
}

.products-toolbar__view-btn {
    /* WCAG AA touch target ≥44×44 */
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--color-gray-400);
    transition: all var(--transition-fast);
}

.products-toolbar__view-btn:hover,
.products-toolbar__view-btn.active {
    background-color: var(--color-primary);
    color: var(--color-white);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
}

/* Product Card */
.product-card {
    background-color: var(--color-white);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: transform var(--transition-medium), box-shadow var(--transition-medium);
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.product-card__badges {
    position: absolute;
    top: var(--space-4);
    left: var(--space-4);
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.product-card__image {
    position: relative;
    height: 260px;
    overflow: hidden;
}

.product-card__image a {
    display: block;
    height: 100%;
}

.product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.product-card:hover .product-card__image img {
    transform: scale(1.08);
}

.product-card__actions {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

/* Hover-gated görünüm sadece desktop'ta — dokunmatik cihazlarda hover yok,
   bu yüzden butonlar her zaman görünür olmalı (favori + hızlı görünüm). */
@media (hover: hover) and (pointer: fine) {
    .product-card__actions {
        opacity: 0;
        transform: translateX(10px);
        transition: all var(--transition-medium);
    }

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

.product-card__action {
    /* WCAG AA touch target ≥44×44 (mobilde her zaman görünür, U1 ile bağlantılı) */
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background-color: var(--color-white);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.product-card__action:hover {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.product-card__content {
    padding: var(--space-5);
}

.product-card__category {
    font-size: var(--font-size-xs);
    color: var(--color-accent-dark);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    font-weight: var(--font-weight-medium);
}

.product-card__title {
    font-family: var(--font-primary);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin: var(--space-2) 0;
}

.product-card__title a {
    color: var(--color-gray-800);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.product-card__title a:hover {
    color: var(--color-primary);
}

.product-card__rating {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.product-card__rating .stars {
    color: var(--color-accent);
    font-size: var(--font-size-sm);
    letter-spacing: 1px;
}

.product-card__rating .count {
    font-size: var(--font-size-xs);
    color: var(--color-gray-400);
}

.product-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-stone);
}

.product-card__price {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.product-card__price-old {
    font-size: var(--font-size-sm);
    color: var(--color-gray-400);
    text-decoration: line-through;
}

.product-card__price-current {
    font-family: var(--font-primary);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-12);
}

.pagination__btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
    color: var(--color-gray-600);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.pagination__btn:hover:not(.disabled) {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.pagination__btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination__pages {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.pagination__page {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
    color: var(--color-gray-600);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-fast);
}

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

.pagination__dots {
    padding: 0 var(--space-2);
    color: var(--color-gray-400);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    /* Layout 1 kolona düşer; sidebar artık drawer (yukarıdaki bloka bkz). */
    .products-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .products-toolbar {
        flex-direction: column;
        gap: var(--space-4);
        align-items: flex-start;
    }

    .products-toolbar__right {
        width: 100%;
        justify-content: space-between;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }

    .product-card__image {
        height: 200px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    /* Tek kolon mobilde card width ~343px → height: 200px ile yatay kırpılan
       dikey ürün görselleri sola/üste sıkışmış görünüyordu. Kare oran düzeltir. */
    .product-card__image {
        height: auto;
        aspect-ratio: 1 / 1;
    }

    .products-toolbar__sort {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-1);
    }
}

/* ===== LIST VIEW ===== */
.products-grid--list {
    grid-template-columns: 1fr !important;
    gap: var(--space-4);
}

.product-card--list {
    display: grid;
    grid-template-columns: 280px 1fr;
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.product-card--list .product-card__image {
    height: 100%;
    min-height: 220px;
}

.product-card--list .product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card--list .product-card__content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--space-6);
}

.product-card--list .product-card__title {
    font-size: var(--font-size-xl);
}

.product-card__desc {
    font-size: var(--font-size-sm);
    color: var(--color-gray-500);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--space-4);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card--list .product-card__footer {
    margin-top: auto;
}

.product-card--list:hover {
    transform: translateY(-4px);
}

/* List view responsive */
@media (max-width: 768px) {
    .product-card--list {
        grid-template-columns: 1fr;
    }

    .product-card--list .product-card__image {
        min-height: 200px;
        height: 200px;
    }
}
