/* Shop Page Styles - Optimized and Improved */

/* Shop Section */
.shop-section {
    padding: 40px 0 80px 0;
    background-color: var(--bg-color);
}

.shop-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
}

/* Shop Sidebar - Optimized for left positioning */
.shop-sidebar {
    background-color: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
    height: fit-content;
    position: sticky;
    top: 20px;
    border: 1px solid rgba(13, 51, 39, 0.08);
    width: 100%;
    max-width: 250px;
}

.filter-section {
    margin-bottom: 25px;
}

.filter-section:last-of-type {
    margin-bottom: 30px;
}

.filter-section h3 {
    font-family: var(--heading-font);
    font-size: 18px;
    color: var(--primary-color);
    margin-bottom: 15px;
    font-weight: 600;
    letter-spacing: -0.2px;
    border-bottom: 2px solid rgba(13, 51, 39, 0.1);
    padding-bottom: 8px;
}

.filter-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    font-family: var(--body-font);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    background-color: var(--light-bg);
    cursor: pointer;
}

.filter-select:focus, .filter-select:hover {
    outline: none;
    border-color: var(--secondary-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(176, 136, 64, 0.1);
}

/* Filter Actions - New container for buttons */
.filter-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(13, 51, 39, 0.1);
}

#apply-filters, #clear-filters {
    width: 100%;
    padding: 12px 20px;
    border-radius: 8px;
    font-family: var(--body-font);
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

#apply-filters {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1a4d3a 100%);
    color: var(--light-color);
    box-shadow: 0 4px 15px rgba(13, 51, 39, 0.3);
}

#apply-filters:hover {
    background: linear-gradient(135deg, var(--accent-color) 0%, #7e2a3e 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 51, 39, 0.4);
}

#clear-filters {
    background-color: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
}

#clear-filters:hover {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

/* Shop Products - Improved grid system */
.shop-products {
    width: 100%;
    overflow: hidden;
}

.shop-products .products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    padding: 10px;
    margin: 0;
    width: 100%;
}

/* Product Card - Improved layout with hover animation */
.product-card {
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 380px;
    width: 100%;
    transform: scale(1);
    position: relative;
    z-index: 1;
}

.product-card:hover {
    transform: scale(1.05) translateY(-8px);
    box-shadow: 0 15px 35px rgba(13, 51, 39, 0.15), 0 5px 15px rgba(0, 0, 0, 0.1);
    z-index: 10;
    border: 2px solid var(--secondary-color);
}

.product-card:hover .product-image {
    transform: scale(1.02);
}

.product-card:hover .product-info {
    background: linear-gradient(135deg, #fff 0%, #fafafa 100%);
}

.product-card:hover .add-to-cart:not(.disabled) {
    background: linear-gradient(135deg, var(--accent-color) 0%, #7e2a3e 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.product-card:hover .current-price {
    color: var(--secondary-color);
    text-shadow: 0 1px 3px rgba(212, 175, 55, 0.3);
}

.product-card:hover .product-category {
    color: var(--primary-color);
    font-weight: 500;
}

.product-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-image {
    height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f8f8 0%, #f0f0f0 100%);
    position: relative;
    transition: all 0.4s ease;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.product-card:hover .product-image img {
    transform: scale(1.08);
    filter: brightness(1.05) contrast(1.02);
}

.out-of-stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--accent-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(126, 42, 62, 0.7);
    }
    70% { 
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(126, 42, 62, 0);
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(126, 42, 62, 0);
    }
}

.product-card:hover .out-of-stock-badge {
    transform: scale(1.1);
    animation-play-state: paused;
}

/* Product Info - Flexible layout for consistent alignment */
.product-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
    transition: all 0.3s ease;
    position: relative;
}

.product-info h3 {
    font-family: var(--heading-font);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary-color);
    line-height: 1.3;
    min-height: 50px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.product-info h3 a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.product-info h3 a:hover,
.product-card:hover .product-info h3 a {
    color: var(--accent-color);
    text-shadow: 0 1px 3px rgba(126, 42, 62, 0.2);
}

.product-category {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
    font-weight: 400;
    transition: all 0.3s ease;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    min-height: 30px;
}

.current-price {
    font-weight: 600;
    font-size: 20px;
    color: var(--accent-color);
    transition: all 0.3s ease;
}

.original-price {
    font-size: 16px;
    text-decoration: line-through;
    color: #999;
    transition: all 0.3s ease;
}

/* Add to Cart Button - Always aligned with enhanced animations */
.add-to-cart {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: var(--light-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--body-font);
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    margin-top: auto;
    position: relative;
    overflow: hidden;
}

.add-to-cart::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.add-to-cart:hover:not(.disabled)::before {
    left: 100%;
}

.add-to-cart:hover:not(.disabled) {
    background: linear-gradient(135deg, var(--accent-color) 0%, #7e2a3e 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(126, 42, 62, 0.3);
    letter-spacing: 1px;
}

.add-to-cart.disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
}

.add-to-cart.disabled::before {
    display: none;
}

/* Products Header */
.products-header {
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(13, 51, 39, 0.1);
    padding-bottom: 15px;
}

.products-header h1 {
    font-family: var(--heading-font);
    font-size: 32px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.products-header p {
    color: #666;
    font-size: 16px;
    font-weight: 300;
    line-height: 1.4;
}

/* Loading and Error States */
.loading, .no-products, .error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: #666;
    font-weight: 500;
}

.loading {
    color: var(--primary-color);
}

.error {
    color: var(--accent-color);
}

/* Pagination */
.pagination {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid var(--primary-color);
    background-color: transparent;
    color: var(--primary-color);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.pagination button:hover {
    background-color: var(--primary-color);
    color: white;
}

.pagination button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f5f5f5;
    color: #999;
    border-color: #ddd;
}

/* Responsive Design */
@media (min-width: 1600px) {
    .shop-layout {
        max-width: 1600px;
    }
    
    .shop-products .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 30px;
    }
    
    .product-card {
        min-height: 400px;
    }
    
    .product-image {
        height: 220px;
    }
}

@media (max-width: 1400px) {
    .shop-products .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 1200px) {
    .shop-layout {
        grid-template-columns: 220px 1fr;
        gap: 25px;
    }
    
    .shop-sidebar {
        max-width: 220px;
        padding: 20px;
    }
    
    .shop-products .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 18px;
    }
    
    .product-card {
        min-height: 350px;
    }
    
    .product-image {
        height: 180px;
    }
}

@media (max-width: 1024px) {
    .shop-layout {
        grid-template-columns: 200px 1fr;
        gap: 20px;
    }
    
    .shop-sidebar {
        padding: 20px;
        max-width: 200px;
    }
    
    .shop-products .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }
    
    .product-card {
        min-height: 320px;
    }
    
    .product-image {
        height: 160px;
    }
    
    .product-info {
        padding: 15px;
    }
    
    .product-info h3 {
        font-size: 15px;
        min-height: 40px;
    }
    
    .current-price {
        font-size: 16px;
    }
}

@media (max-width: 900px) {
    .shop-layout {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .shop-sidebar {
        order: 1;
        position: static;
        max-width: 100%;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 15px;
        padding: 20px;
    }
    
    .filter-actions {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
        margin-top: 15px;
    }
    
    .shop-products {
        order: 2;
    }

    .shop-products .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
        padding: 8px;
    }
}

@media (max-width: 768px) {
    .shop-section {
        padding: 30px 0 60px 0;
    }

    .products-header h1 {
        font-size: 28px;
    }

    .products-header p {
        font-size: 14px;
    }

    .shop-sidebar {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 20px;
    }
    
    .filter-actions {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .shop-products .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
        padding: 5px;
    }
    
    .product-card {
        min-height: 300px;
    }
    
    .product-card:hover {
        transform: scale(1.03) translateY(-4px);
    }
    
    .product-image {
        height: 140px;
    }
    
    .product-info {
        padding: 12px;
    }
    
    .product-info h3 {
        font-size: 14px;
        min-height: 35px;
    }
    
    .add-to-cart {
        padding: 8px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .shop-section {
        padding: 20px 0 40px 0;
    }
    
    .products-header h1 {
        font-size: 24px;
    }

    .shop-sidebar {
        padding: 15px;
    }

    .shop-products .products-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        padding: 5px;
    }
    
    .product-card {
        min-height: 280px;
    }
    
    .product-card:hover {
        transform: scale(1.02) translateY(-3px);
    }
    
    .product-image {
        height: 120px;
    }
    
    .product-info {
        padding: 10px;
    }
    
    .product-info h3 {
        font-size: 13px;
        min-height: 32px;
    }
    
    .current-price {
        font-size: 14px;
    }
    
    .original-price {
        font-size: 12px;
    }
    
    .add-to-cart {
        padding: 6px;
        font-size: 11px;
    }
}