/* ========================================
   Products Page Styles
   ======================================== */

/* Products Layout */
.products-page {
    padding: 3rem 0;
    padding-top: 130px; /* Navbar clearance with extra margin: 40px announcement + 70px navbar + 20px buffer */
    background: var(--gray-50);
    min-height: 60vh;
}

.products-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .products-layout {
        grid-template-columns: 1fr;
    }
    
    .products-sidebar {
        display: none;
    }
}

/* Sidebar Filters */
.products-sidebar {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.filter-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--gray-200);
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 1rem;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-700);
    transition: color var(--transition-fast);
}

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

.filter-checkbox input[type="checkbox"] {
    margin-right: 0.5rem;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.filter-checkbox .count {
    margin-left: auto;
    color: var(--gray-500);
    font-size: 0.75rem;
}

/* Price Range */
.price-range {
    padding: 1rem 0;
}

.price-range input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    outline: none;
    -webkit-appearance: none;
}

.price-range input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.price-range input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.price-values {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-600);
}

.price-values span:nth-child(2) {
    font-weight: 600;
    color: var(--primary);
}

/* Clear Filters Button */
.clear-filters {
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.75rem;
    font-size: 0.875rem;
}

/* Products Main */
.products-main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Sort Bar */
.sort-bar {
    background: var(--white);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-count {
    color: var(--gray-600);
    font-size: 0.875rem;
}

.results-count strong {
    color: var(--gray-900);
}

.sort-options select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--gray-700);
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color var(--transition-fast);
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.sort-options select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Products Grid Override for Products Page */
.products-page .products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 0;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 0;
}

.page-btn,
.page-num {
    padding: 0.5rem 1rem;
    border: 2px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-700);
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 40px;
    text-align: center;
}

.page-btn:hover:not(:disabled),
.page-num:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

.page-num.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Mobile Filter Toggle */
.filter-toggle {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-xl);
    z-index: 100;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

@media (max-width: 1024px) {
    .filter-toggle {
        display: flex;
    }
    
    .products-sidebar.mobile-active {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--white);
        z-index: 999;
        overflow-y: auto;
        padding: 2rem;
    }
}

/* Loading State */
.product-skeleton {
    background: var(--white);
    border-radius: var(--radius-xl);
    overflow: hidden;
    animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-image {
    height: 250px;
    background: var(--gray-200);
}

.skeleton-content {
    padding: 1.5rem;
}

.skeleton-line {
    height: 16px;
    background: var(--gray-200);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-line.price {
    width: 40%;
    height: 24px;
    margin-top: 1rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--white);
    border-radius: var(--radius-xl);
}

.empty-state h3 {
    font-size: 1.5rem;
    color: var(--gray-900);
    margin-bottom: 1rem;
}

.empty-state p {
    color: var(--gray-600);
    margin-bottom: 2rem;
}

/* Special Badge Styles */
.product-badge.organic {
    background: var(--success);
}

.product-badge.premium {
    background: linear-gradient(135deg, #FFD700, #FFA500);
}

.product-badge.limited {
    background: var(--info);
}