/* Category Products Page Styles */
.category-products-page {
    padding: 20px 0 40px;
    background: #f8f9fa;
    min-height: calc(100vh - 200px);
}

.category-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    align-items: start;
}

/* Filters Sidebar */
.filters-sidebar {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.filter-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.filter-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-section h3::before {
    content: '⚙️';
    font-size: 12px;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 4px; /* Reduced gap */
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px; /* Reduced padding */
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    color: #555;
    font-size: 13px;
    text-decoration: none;
    font-family: 'Amazon Ember', Arial, sans-serif;
    margin-bottom: 2px; /* Reduced margin */
}

.filter-option:hover {
    background: #f8f9fa;
    color: #F58731;
}

.filter-option.active {
    background: #F58731;
    color: white;
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
    margin: 0;
    width: 14px;
    height: 14px;
    accent-color: #F58731;
}

/* Category Icons */
.filter-option.category-link[href*="electronics"]::before {
    content: '📱';
    font-size: 12px;
}

.filter-option.category-link[href*="fashion"]::before {
    content: '👕';
    font-size: 12px;
}

.filter-option.category-link[href*="home"]::before {
    content: '🏠';
    font-size: 12px;
}

.filter-option.category-link[href*="beauty"]::before {
    content: '💄';
    font-size: 12px;
}

.filter-option.category-link[href*="sports"]::before {
    content: '⚽';
    font-size: 12px;
}

.filter-option.category-link[href*="toys"]::before {
    content: '🧸';
    font-size: 12px;
}

.filter-option.category-link[href*="books"]::before {
    content: '📚';
    font-size: 12px;
}

.filter-option.category-link[href*="health"]::before {
    content: '💊';
    font-size: 12px;
}

.filter-option.category-link[href*="automotive"]::before {
    content: '🚗';
    font-size: 12px;
}

.filter-option.category-link[href*="groceries"]::before {
    content: '🛒';
    font-size: 12px;
}

.filter-option.category-link[href*="jewelry"]::before {
    content: '💍';
    font-size: 12px;
}

.filter-option.category-link[href*="food"]::before {
    content: '🍕';
    font-size: 12px;
}

/* Price Range Slider */
.price-range-slider {
    margin-top: 10px;
}

.price-slider {
    width: 100%;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    outline: none;
    margin: 15px 0;
    -webkit-appearance: none;
}

.price-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #F58731;
    border-radius: 50%;
    cursor: pointer;
}

.price-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #F58731;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.price-inputs {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.price-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    text-align: center;
}

.price-input:focus {
    outline: none;
    border-color: #F58731;
}

/* Two Column Layout for Brand and Rating */
.two-column-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.two-column-filters .filter-section {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.two-column-filters .filter-options {
    max-height: 150px;
    overflow-y: auto;
}

/* Advertisement Sidebar */
.advertisement-sidebar {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ad-space {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.ad-space h4 {
    font-size: 14px;
    margin-bottom: 6px;
    font-weight: 600;
}

.ad-space p {
    font-size: 12px;
    margin-bottom: 12px;
    opacity: 0.9;
}

.ad-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-size: 12px;
}

.ad-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Products Main Area */
.products-main {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.category-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    padding: 25px;
    color: white;
}

.category-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.category-header p {
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Products Controls */
.products-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.results-count {
    color: #666;
    font-size: 14px;
    font-weight: 600;
}

.sort-options select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    font-family: 'Amazon Ember', Arial, sans-serif;
}

.sort-options select:focus {
    outline: none;
    border-color: #F58731;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.product-card {
    background: white;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: #F58731;
}

.product-image {
    width: 100%;
    height: 160px;
    background: #f8f9fa;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    overflow: hidden;
    position: relative;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.product-image .placeholder {
    font-size: 2.5rem;
    color: #ddd;
}

.product-info {
    text-align: center;
}

.product-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.product-price {
    font-size: 16px;
    font-weight: 700;
    color: #F58731;
    margin-bottom: 8px;
}

.product-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-bottom: 12px;
}

.stars {
    color: #ffc107;
    font-size: 12px;
}

.rating-count {
    color: #666;
    font-size: 11px;
}

.add-to-cart-btn {
    width: 100%;
    padding: 10px;
    background: #F58731;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-family: 'Amazon Ember', Arial, sans-serif;
}

.add-to-cart-btn:hover:not(:disabled) {
    background: #e07a2b;
    transform: translateY(-1px);
}

.add-to-cart-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 50px 20px;
    color: #666;
    display: none;
}

.loading-state .spinner {
    width: 35px;
    height: 35px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #F58731;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    display: none;
}

.empty-state i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 15px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #333;
}

.empty-state p {
    line-height: 1.5;
    color: #666;
    font-size: 14px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
}

.pagination button:hover:not(:disabled) {
    border-color: #F58731;
    color: #F58731;
}

.pagination button.active {
    background: #F58731;
    color: white;
    border-color: #F58731;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .category-layout {
        grid-template-columns: 240px 1fr;
        gap: 20px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .filters-sidebar {
        padding: 15px;
    }
    
    .two-column-filters {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

@media (max-width: 768px) {
    .category-products-page {
        padding: 10px 0 25px;
    }
    
    .category-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .filters-sidebar {
        position: static;
        max-height: none;
        order: 2;
        padding: 15px;
    }
    
    .products-main {
        order: 1;
        padding: 15px;
    }
    
    .category-header {
        padding: 20px 15px;
        margin-bottom: 20px;
    }
    
    .category-header h1 {
        font-size: 20px;
    }
    
    .category-header p {
        font-size: 13px;
    }
    
    .products-controls {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
        padding: 12px 0;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .product-card {
        padding: 12px;
    }
    
    .product-image {
        height: 120px;
    }
    
    .advertisement-sidebar {
        display: none;
    }
    
    .filter-section h3 {
        font-size: 13px;
        margin-bottom: 10px;
    }
    
    .filter-option {
        font-size: 12px;
        padding: 5px 6px;
    }
    
    .two-column-filters {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .product-card {
        padding: 10px;
    }
    
    .product-image {
        height: 100px;
    }
    
    .product-name {
        font-size: 12px;
    }
    
    .product-price {
        font-size: 14px;
    }
    
    .filters-sidebar {
        padding: 12px;
    }
    
    .filter-section {
        margin-bottom: 15px;
        padding-bottom: 12px;
    }
    
    .filter-section h3 {
        font-size: 12px;
    }
    
    .filter-option {
        font-size: 11px;
    }
}

/* Animation for product cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    animation: fadeInUp 0.4s ease forwards;
}

/* Filter mobile toggle */
.mobile-filter-toggle {
    display: none;
    background: #F58731;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 15px;
    width: 100%;
    font-size: 14px;
    font-family: 'Amazon Ember', Arial, sans-serif;
}

@media (max-width: 768px) {
    .mobile-filter-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }
    
    .filters-sidebar {
        display: none;
    }
    
    .filters-sidebar.active {
        display: block;
    }
}

/* Mobile overlay for filters */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.filters-sidebar.active + .mobile-overlay {
    display: block;
}

/* Brand placeholder */
.brand-placeholder {
    color: #999;
    font-size: 12px;
    text-align: center;
    padding: 10px;
    font-style: italic;
}

/* Enhanced filter spacing */
.filter-option {
    padding: 4px 6px; /* Reduced padding */
    border-radius: 4px;
    transition: all 0.2s ease;
}

.filter-option:hover {
    background: #f5f5f5;
}

.filter-option input[type="checkbox"]:checked + span,
.filter-option input[type="radio"]:checked + span {
    color: #F58731;
    font-weight: 600;
}

/* Price range specific styles */
.price-filter .filter-options {
    gap: 6px;
}

.price-filter .filter-option {
    padding: 5px 8px;
}

/* Success notification */
.add-to-cart-success {
    position: fixed;
    top: 15px;
    right: 15px;
    background: #43a047;
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    z-index: 10000;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Product image enhancements */
.product-image {
    position: relative;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

.product-image .placeholder {
    color: #cbd5e0;
    font-size: 2rem;
}

/* Stock status */
.stock-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

/* Wishlist icon */
.wishlist-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    font-size: 14px;
    color: #666;
}

.wishlist-icon:hover {
    background: white;
    transform: scale(1.1);
}

.wishlist-icon.active {
    color: #e74c3c;
}

/* Compact category styles */
.filter-section h3 {
    font-size: 13px;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.filter-options {
    gap: 2px; /* Further reduced gap */
}

.filter-option {
    padding: 3px 6px; /* Further reduced padding */
    font-size: 12px;
    margin-bottom: 1px; /* Further reduced margin */
}

/* Ensure white text in category header */
.category-header,
.category-header h1,
.category-header p {
    color: white !important;
}

.category-header h1 {
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

.category-header p {
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* Active category state */
.filter-option.category-link.active {
    background: #F58731;
    color: white;
    font-weight: 600;
}

.filter-option.category-link.active::before {
    filter: brightness(0) invert(1);
}
