/* Archive Product Page Styles */
.archive-product-page {
    font-family: 'Roboto', sans-serif;
    background-color: #f8f9fa;
}

.archive-container {
    max-width: 1328px;
    margin: 0 auto;
    padding: 1.5rem;
}

.archive-main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 768px) {
    .archive-main-content {
        flex-direction: row;
    }
}

/* Sidebar Styles */
.archive-sidebar {
    width: 100%;
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    height: fit-content;
}


@media (min-width: 768px) {
    .archive-sidebar {
        width: 25%;
    }
}

.sidebar-title {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 1rem;
    border-bottom: 2px solid #ef4444;
    padding-bottom: 0.5rem;
}

.filter-section {
    margin-bottom: 1.5rem;
}

.filter-title {
    font-weight: 600;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.filter-list {
    list-style: none;
    padding: 0;
}

.filter-list li {
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.filter-link {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s ease;
    padding: 5px 0;
    display: inline-block;
}

.filter-link:hover {
    color: #ef4444;
}

.price-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.price-input {
    width: 50%;
    padding: 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
}

.filter-button {
    width: 100%;
    background: #ef4444;
    color: white;
    padding: 1.5rem;
    border-radius: 0.675rem;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 1.5rem;
}

.filter-button:hover {
    background: #dc2626;
}

/* Products Section Styles */
.archive-products-section {
    width: 100%;
}

@media (min-width: 768px) {
    .archive-products-section {
        width: 75%;
    }
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1f2937;
}

.products-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}


.results-count {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.woocommerce-ordering {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sorting-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sorting-label {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    white-space: nowrap;
}

.woocommerce-ordering select {
    border-radius: 6px;
    border: 1px solid #d1d5db;
    padding: 8px 12px;
    font-size: 14px;
    background: white;
    color: #374151;
    min-width: 180px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.woocommerce-ordering select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.woocommerce-ordering select:hover {
    border-color: #9ca3af;
}

/* Product Grid Styles - Override ALL conflicting styles */
.woocommerce .archive-products-section .products-grid,
.archive-product-page .archive-products-section .products-grid,
.products-grid {
    display: grid !important;
    /* Default for shop and general archives: 3 columns */
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 1.5rem !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure each card behaves as a grid item and doesn't stretch full width */
.products-grid>.product-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    grid-column: auto !important;
}

@media (max-width: 1024px) {

    .woocommerce .archive-products-section .products-grid,
    .archive-product-page .archive-products-section .products-grid,
    .products-grid {
        /* Shop/general: 2 columns at <=1024px */
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 768px) {

    .woocommerce .archive-products-section .products-grid,
    .archive-product-page .archive-products-section .products-grid,
    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 480px) {

    .woocommerce .archive-products-section .products-grid,
    .archive-product-page .archive-products-section .products-grid,
    .products-grid {
        grid-template-columns: 1fr !important;
    }
}

input[name="min_rating"] + span {
    color: #FACC15;
}

/* Product Card Styles - Ensure grid compatibility */
.archive-products-section .product-card {
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    position: relative;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    transform-style: preserve-3d;
    perspective: 1000px;
    display: flex;
    flex-direction: column;
    height: 380px;
    width: 100%;
    margin: 0;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.sale-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background-color: #ef4444;
    color: white;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 9999px;
    z-index: 10;
}

.product-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-image {
    width: 100%;
    height: 20rem;
    overflow: hidden;
    flex-shrink: 0;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    padding: 0.85rem 1rem; /* slightly tighter */
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: 1.8rem;
}

.product-name {
    font-size: 1.8rem;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.35rem; /* tighter gap to price */
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-price-wrapper {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.25rem 0 0.6rem; /* place closer to title */
}

.product-price-wrapper .price {
    font-size: 1.125rem;
    font-weight: bold;
    color: #ef4444;
}

.product-price-wrapper del {
    color: #9ca3af;
    text-decoration: line-through;
    margin-left: 0.5rem;
}

/* Product Actions */
.product-actions {
    padding: 0 1rem 1rem;
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    /* Push to bottom */
}

/* Buttons - match screenshot (Red add to cart, gray details) */
.add-to-cart-btn {
    flex: 1;
    background: #ef4444;
    /* red-500 */
    color: #ffffff;
    font-size: 1.5rem;
    padding: 1.1rem 1.2rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    font-weight: 600;
}

.add-to-cart-btn:hover {
    background: #dc2626;
    /* red-600 */
    transform: translateY(-1px);
}

.view-details-btn {
    flex: 1;
    border: 1px solid #e2e8f0;
    /* gray-200 */
    background: #f7fafc;
    /* gray-50 */
    color: #4b5563;
    /* gray-600 */
    font-size: 1.5rem;
    padding: 1.1rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    font-weight: 600;
}

.view-details-btn:hover {
    background: #edf2f7;
    /* gray-100 */
    border-color: #cbd5e0;
    /* gray-300 */
    color: #374151;
    /* gray-700 */
    transform: translateY(-1px);
}

/* Pagination Styles */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    gap: 0.5rem;
}

.pagination-btn {
    background: white;
    color: #6b7280;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.2s ease;
}

.pagination-btn:hover {
    background: #f3f4f6;
}

.pagination-btn.active {
    background: #ef4444;
    color: white;
}

/* No Products Message */
.no-products {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

/* Screen Reader Text - Hide from visual display */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* Alternative method for screen reader text hiding */
.woocommerce .screen-reader-text,
.woocommerce-Price-amount .screen-reader-text,
.price .screen-reader-text {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
}

/* Responsive styles for products-meta */
@media (max-width: 768px) {
    .products-meta {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 15px;
        gap: 12px;
    }
    
    .results-count {
        text-align: center;
        font-size: 13px;
        padding: 6px 10px;
    }
    
    .woocommerce-ordering {
        justify-content: center;
    }
    
    .sorting-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        width: 100%;
    }
    
    .sorting-label {
        font-size: 13px;
        text-align: center;
    }
    
    .woocommerce-ordering select {
        min-width: 100%;
        width: 100%;
        padding: 10px 12px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .products-meta {
        padding: 10px 12px;
        border-radius: 6px;
        margin-bottom: 15px;
    }
    
    .results-count {
        font-size: 12px;
        padding: 5px 8px;
    }
}

/* Category Page Specific Styles - Full Width Layout */
.category-main-content {
    flex-direction: column !important;
}

.category-products-section {
    width: 100% !important;
}

.category-main-content .archive-products-section {
    width: 100% !important;
    max-width: none !important;
}

/* Ensure category grids use 4 columns like shop page */
.category-main-content .products-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 1.5rem !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Responsive for category pages */
@media (max-width: 1024px) {
    .category-main-content .products-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 768px) {
    .category-main-content .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 1rem !important;
    }
}

@media (max-width: 480px) {
    .category-main-content .products-grid {
        grid-template-columns: 1fr !important;
    }
}
