/**
 * Shop Styles
 * Shop layout, sidebar filters, product grid
 */

/* Shop Layout */
.shop-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: var(--spacing-xl);
    padding: var(--spacing-xl) 0;
}

/* Sidebar Filters */
.shop-sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.filter-group {
    margin-bottom: 0;
}

.filter-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: var(--spacing-sm);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid var(--color-border-light);
    transition: var(--transition);
}

.filter-title:hover {
    color: var(--color-accent-dark);
    border-bottom-color: var(--color-accent);
}

.filter-toggle {
    font-size: 18px;
    font-weight: 300;
}

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

.filter-list li {
    margin-bottom: var(--spacing-xs);
}

.filter-list a {
    font-size: 13px;
    display: block;
    padding: 4px 0;
}

.filter-list a:hover {
    background: var(--color-hover);
}

/* Products Grid */
.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    gap: var(--spacing-md);
}

.products-title {
    font-size: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0;
    position: relative;
    padding-bottom: var(--spacing-xs);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.products-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--color-accent), transparent);
}

/* Product Count Badge */
.products-count {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: var(--color-accent);
    color: var(--color-bg);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    border-radius: 2px;
    box-shadow: var(--shadow-sm);
}

.products-sort {
    display: flex;
    gap: var(--spacing-xs);
    font-size: 12px;
    align-items: center;
}

.products-sort span {
    margin-right: var(--spacing-xs);
}

.products-sort a {
    padding: 2px 4px;
    color: var(--color-text);
}

.products-sort a:hover {
    opacity: 1;
}

.products {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md) var(--spacing-sm);
    list-style: none;
    padding: 0;
    margin: 0;
}

.product {
    position: relative;
}

.product-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.product-link:focus,
.product-link:focus-visible {
    outline: none !important;
}

.product-image {
    position: relative;
    overflow: hidden;
    margin-bottom: var(--spacing-sm);
    aspect-ratio: 3/4;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.product-link:hover .product-image {
    box-shadow: var(--shadow-md);
    border-color: var(--color-accent);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), filter 0.3s ease;
}

.product-link:hover .product-image img {
    transform: scale(1.05);
    filter: brightness(1.05) contrast(1.05);
}

.product-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.05) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-link:hover .product-image::after {
    opacity: 1;
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.product-title {
    font-size: 12px;
    font-weight: 400;
    line-height: 1.6;
    margin: 0;
    color: var(--color-text);
    transition: color 0.3s ease;
}

.product-link:hover .product-title {
    color: var(--color-accent-dark);
}

.product-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    font-size: 12px;
    margin-top: 4px;
}

.product-price {
    font-weight: 400;
}

.product-price .woocommerce-Price-amount {
    font-weight: 400;
}

.product-size {
    color: var(--color-text-light);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
    display: block;
}

/* Sale Badge */
.onsale,
.product .onsale {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    background: var(--color-text);
    color: var(--color-bg);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 6px 12px;
    z-index: 10;
    border: none;
    border-radius: 0;
    min-width: auto;
    min-height: auto;
    line-height: 1;
}

/* Sale Prices */
.product-price del,
.price del {
    color: var(--color-text-light);
    font-size: 0.9em;
    text-decoration: line-through;
    margin-right: 6px;
    opacity: 0.7;
}

.product-price ins,
.price ins {
    color: var(--color-text);
    font-weight: 500;
    text-decoration: none;
    background: none;
}

/* Price and Size Layout */
.product-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Catalog Add to Cart Button */
.add_to_cart_button {
    display: inline-block;
    margin-top: 8px;
    font-size: 10px;
    text-transform: uppercase;
    text-decoration: underline;
    color: #000;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.add_to_cart_button:hover {
    color: #666;
    text-decoration: none;
}

.add_to_cart_button.loading {
    opacity: 0.5;
    cursor: wait;
}

.add_to_cart_button.added {
    display: none;
}

.added_to_cart {
    display: inline-block;
    margin-top: 8px;
    font-size: 10px;
    text-transform: uppercase;
    color: #000;
    font-weight: 600;
}

/* Mobile Filter Elements (Hidden on Desktop) */
.mobile-filter-toggle,
.mobile-filter-header,
.mobile-sort-group {
    display: none;
}

/* Responsive Shop */
@media (max-width: 1024px) {
    .shop-container {
        grid-template-columns: 1fr;
        padding-top: 50px; /* Add space so content starts below filter button */
    }
    
    /* Hide desktop sort in header */
    .products-sort {
        display: none;
    }

    /* Show mobile sort group inside sidebar */
    .mobile-sort-group {
        display: block;
        margin-bottom: 30px;
        border-bottom: 1px solid var(--color-border);
        padding-bottom: 15px;
    }

    /* Mobile Filter Toggle Button */
    .mobile-filter-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 15px 0;
        background: var(--color-bg);
        border: none;
        border-bottom: 1px solid var(--color-border);
        font-family: var(--font-primary);
        color: #000;
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 1px;
        cursor: pointer;
        margin-bottom: 20px;
        position: sticky;
        top: 60px; /* Below fixed header (50px + buffer) */
        z-index: 80;
        outline: none;
    }

    /* Sidebar as Overlay */
    .shop-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: var(--color-bg);
        z-index: 200; /* Higher than header */
        padding: 20px;
        overflow-y: auto;
        
        /* Hidden state */
        opacity: 0;
        pointer-events: none;
        transform: translateY(20px);
        transition: all 0.3s ease;
        
        /* Remove border/margin from old styles */
        border-bottom: none;
        margin-bottom: 0;
    }

    /* Open State */
    body.filters-open .shop-sidebar {
        opacity: 1;
        pointer-events: all;
        transform: translateY(0);
    }
    
    body.filters-open {
        overflow: hidden;
    }

    /* Mobile Filter Header inside Sidebar */
    .mobile-filter-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 30px;
        padding-bottom: 15px;
        border-bottom: 1px solid var(--color-border);
    }

    .mobile-filter-header .title {
        font-size: 16px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .mobile-filter-close {
        background: none;
        border: none;
        font-family: var(--font-primary);
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 1px;
        cursor: pointer;
        padding: 5px;
    }
    
    /* Filter items larger for mobile touch */
    .filter-title {
        padding: 15px 0;
        font-size: 14px;
    }
    
    .filter-list a {
        padding: 10px 0;
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .products {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
}

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