/* Category Page Styles */

.category-page {
    padding: 2rem 0;
    min-height: 100vh;
}

.category-page .container {
    max-width: 100%;
    padding: 0 3rem;
    box-sizing: border-box;
}

.category-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: #1e293b;
    text-align: center;
    padding: 0 1rem;
}

/* Dark Mode Styles */
html.dark .category-title {
    color: #ffffff;
}

#products-container {
    margin: 3rem 0;
    width: 100%;
    box-sizing: border-box;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    justify-items: stretch;
    padding: 0;
    width: 100%;
}

.products-grid > div {
    display: flex;
    justify-content: center;
}

.products-grid .product-card {
    width: 100%;
    max-width: 326px;
}

/* Tablet: 3 products per row */
@media (max-width: 1200px) {
    .category-page .container {
        padding: 0 2rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile: 2 products per row */
@media (max-width: 768px) {
    .category-page .container {
        padding: 0 1rem;
    }
    
    #products-container {
        margin: 1rem 0;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.25rem;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .category-page .container {
        padding: 0 0.5rem;
    }
    
    #products-container {
        margin: 0.5rem 0;
    }
}

.category-product-card {
    width: 100%;
    position: relative;
}

.product-card-wrapper {
    width: 100%;
    background-color: #ffffff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

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

/* Image Container */
.product-image-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    margin: 0;
    padding: 3px;
    position: relative;
    overflow: hidden;
    background-color: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image {
    width: 320px;
    height: 320px;
    max-width: calc(100% - 6px);
    max-height: calc(100% - 6px);
    display: block;
    object-fit: cover;
    background-color: #f9fafb;
}

.product-image[src*="No Image"],
.product-image[src*="data:image/svg+xml"] {
    object-fit: contain;
}
    transition: opacity 0.3s;
}

/* Product Details */
.product-details {
    padding: 5px;
    border-top: 1px solid #eeeeee;
    text-align: left;
}

.color-name {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    font-weight: bold;
}

/* Color Variants */
.color-variants {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.color-variant-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    background: none;
    position: relative;
    transition: all 0.2s;
    outline: none;
}

.color-variant-btn:hover {
    transform: scale(1.1);
}

.color-variant-btn.active {
    border-color: #000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.color-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
}

.product-name {
    font-size: 22px;
    font-weight: bold;
    color: #000000;
    margin: 5px;
    text-transform: none !important;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

html[dir="rtl"] .product-name {
    text-align: right !important;
}

html[dir="ltr"] .product-name {
    text-align: left !important;
}

.product-short-description {
    font-size: 14px;
    color: #666;
    margin: 10px 0;
    line-height: 1.5;
}

.product-short-description ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.product-short-description li {
    padding: 4px 0;
    position: relative;
    padding-left: 20px;
}

.product-short-description li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #666;
}

[dir="rtl"] .product-short-description li {
    padding-left: 0;
    padding-right: 20px;
}

[dir="rtl"] .product-short-description li:before {
    left: auto;
    right: 0;
}

/* Price */
.product-price {
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
    gap: 8px;
    margin: 5px;
}

.current-price {
    font-size: 16px;
    font-weight: bold;
    color: #999;
}

.old-price {
    font-size: 16px;
    color: #999;
    text-decoration: line-through;
    font-weight: normal;
}

/* Buy Now Button */
.buy-now-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    background-color: #000;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 16px;
    transition: background-color 0.2s;
    margin-top: 15px;
}

.buy-now-btn:hover {
    background-color: #333;
    color: #fff;
    text-decoration: none;
}

.buy-now-btn svg {
    width: 20px;
    height: 20px;
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 2rem;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #000;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-more-products {
    text-align: center;
    padding: 2rem;
    color: #999;
}

/* Responsive */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 0 0.5rem;
    }
    
    .category-product-card,
    .product-card-wrapper {
        width: 100%;
        max-width: 100%;
    }
    
    .product-image-container {
        width: 100%;
        aspect-ratio: 1 / 1;
    }
    
    .product-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .category-title {
        font-size: 1.5rem;
        padding: 0 1rem;
    }
    
    /* Hide short description on mobile */
    .product-short-description {
        display: none;
    }
    
    /* Adjust font sizes for mobile */
    .product-name {
        font-size: 18px;
    }
    
    .current-price {
        font-size: 14px;
    }
    
    .old-price {
        font-size: 12px;
    }
    
    .buy-now-btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .product-details {
        padding: 5px;
    }
}


/* Product Variant Styles for Category Cards */
.variant-name {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.product-variants {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.variant-btn {
    padding: 6px 12px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.variant-btn:hover {
    background: #e0e0e0;
    border-color: #bbb;
}

.variant-btn.active {
    background: #0066cc;
    color: white;
    border-color: #0066cc;
}

/* Simple variant tags for search/list view */
.product-variants-simple {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.variant-tag {
    font-size: 11px;
    padding: 3px 8px;
    background: #f0f0f0;
    border-radius: 4px;
    color: #666;
}

/* Dark mode support */
html.dark .variant-name {
    color: #cbd5e0;
}

html.dark .variant-btn {
    background: #2d3748;
    border-color: #4a5568;
    color: #f8fafc;
}

html.dark .variant-btn:hover {
    background: #374151;
    border-color: #6b7280;
}

html.dark .variant-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
}

html.dark .variant-tag {
    background: #2d3748;
    color: #cbd5e0;
}
