/* Products Page Styles */
:root {
    /* Primary Colors from Logo */
    --primary-green: #4bc755;
    --light-green: #e4f2ed;
    --dark-green: #2a7d32;
    --orange: #ff8c00;
    --yellow: #ffd700;
    --dark-orange: #e67e22;
    
    /* Additional Colors */
    --white: #ffffff;
    --light-gray: #f8f9fa;
    --gray: #6c757d;
    --dark-gray: #343a40;
    --black: #000000;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary-green), var(--dark-green));
    --gradient-orange: linear-gradient(135deg, var(--orange), var(--dark-orange));
    --gradient-warm: linear-gradient(135deg, var(--light-green), var(--yellow));
}

/* Mobile Product Cards - Force 1 per row on all mobile devices */
@media (max-width: 991px) {
    #featured-products-container .col-lg-3,
    #featured-products-container .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* Pagination Styles */
.pagination {
    margin: 0;
}

.pagination .page-item {
    margin: 0 2px;
}

.pagination .page-link {
    color: var(--primary-green);
    border: 1px solid var(--light-green);
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.pagination .page-link:hover {
    background-color: var(--light-green);
    border-color: var(--primary-green);
    color: var(--dark-green);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-green);
    border-color: var(--primary-green);
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: var(--gray);
    background-color: var(--light-gray);
    border-color: var(--light-gray);
}

/* Category Filter Icons */
.category-label i.fa-folder {
    color: var(--primary-green);
    margin-right: 0.5rem;
}

.subcategory-label i.fa-tag {
    color: var(--orange);
    margin-right: 0.5rem;
}

.expand-icon {
    color: var(--dark-green);
    cursor: pointer;
    transition: color 0.3s ease;
}

.expand-icon:hover {
    color: var(--orange);
}

/* Filter Group Headers */
.filter-group h6 i {
    color: var(--primary-green);
    margin-right: 0.5rem;
}

/* Products Page Title Section */
.products-page-title-section {
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 25%, #ffc107 75%, #ff9800 100%);
    padding: 3rem 0;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.products-page-title-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="dots" patternUnits="userSpaceOnUse" width="20" height="20"><circle cx="10" cy="10" r="1.5" fill="white" opacity="0.15"/></pattern></defs><rect width="100" height="100" fill="url(%23dots)"/></svg>');
    opacity: 0.4;
}

.products-page-title-section::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 40%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    transform: rotate(15deg);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: rotate(15deg) translateY(0px); }
    50% { transform: rotate(15deg) translateY(-20px); }
}

.products-page-title-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.products-page-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.products-page-title-icon {
    background: rgba(255, 255, 255, 0.2);
    padding: 1rem;
    border-radius: 50%;
    font-size: 1.5rem;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.products-title-text {
    background: linear-gradient(45deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.products-page-title-section .breadcrumb {
    justify-content: center;
    margin-bottom: 1.5rem;
}

.products-page-title-section .breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255, 255, 255, 0.7);
}

.products-page-title-section .breadcrumb-item a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.products-page-title-section .breadcrumb-item a:hover {
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.products-page-title-section .breadcrumb-item.active {
    color: white;
    font-weight: 600;
}

.products-page-description {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 0;
    font-weight: 500;
}

/* Products Section */
.products-section {
    padding: 2rem 0;
    min-height: 70vh;
}

/* Filters Sidebar */
.filters-sidebar {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
    position: sticky;
    top: 180px; /* Account for header height */
    z-index: 999; /* Below header but above other content */
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-gray);
}

.filters-header h5 {
    color: var(--primary-green);
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group h6 {
    color: var(--dark-green);
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-options {
    max-height: 200px;
    overflow-y: auto;
}

.filter-options::-webkit-scrollbar {
    width: 4px;
}

.filter-options::-webkit-scrollbar-track {
    background: var(--light-gray);
    border-radius: 2px;
}

.filter-options::-webkit-scrollbar-thumb {
    background: var(--primary-green);
    border-radius: 2px;
}

.form-check {
    margin-bottom: 0.75rem;
}

.form-check-input:checked {
    background-color: var(--primary-green);
    border-color: var(--primary-green);
}

.form-check-label {
    color: var(--dark-green);
    font-weight: 500;
    cursor: pointer;
    transition: color 0.3s ease;
}

.form-check-label:hover {
    color: var(--primary-green);
}

/* Price Range */
.price-range {
    padding: 0 0.5rem;
}

.form-range {
    height: 8px;
    background: var(--light-gray);
    border-radius: 4px;
    outline: none;
}

.form-range::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-green);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.price-range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--dark-green);
    font-weight: 500;
}

/* Filter Actions */
.filter-actions {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 2px solid var(--light-gray);
}

/* Products Header */
.products-header {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.products-count {
    font-size: 1.1rem;
    color: var(--dark-green);
    font-weight: 600;
}

.products-count span {
    color: var(--primary-green);
}

.products-sort select {
    border: 2px solid var(--light-gray);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-weight: 500;
    color: var(--dark-green);
    transition: all 0.3s ease;
}

.products-sort select:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 0.2rem rgba(76, 175, 80, 0.25);
}

/* Products Grid - 3 columns layout for products page */
#featured-products-container .col-lg-3 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

/* Product Cards - Enhanced alignment for products page */
#featured-products-container .product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#featured-products-container .product-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}

#featured-products-container .product-title {
    line-height: 1.3;
    min-height: 2.6em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#featured-products-container .product-price {
    min-height: 1.5em;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

#featured-products-container .product-actions {
    margin-top: auto;
    align-items: center;
}

#featured-products-container .btn-sm {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Stock Status */
.stock-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.in-stock-badge {
    background: rgba(76, 175, 80, 0.9);
    color: white;
}

.low-stock-badge {
    background: rgba(255, 152, 0, 0.9);
    color: white;
}

.out-of-stock-badge {
    background: rgba(244, 67, 54, 0.9);
    color: white;
}

.product-card.out-of-stock {
    opacity: 0.7;
    position: relative;
}

.product-card.out-of-stock::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1;
}

.out-of-stock-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(244, 67, 54, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    z-index: 2;
}

/* Mobile Filter Toggle */
.mobile-filter-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

.mobile-filter-toggle .btn {
    border-radius: 50px;
    padding: 1rem 1.5rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Mobile Responsive */
@media (max-width: 991.98px) {
    .filters-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 300px;
        height: 100vh;
        z-index: 1050; /* Above header on mobile */
        transition: left 0.3s ease;
        overflow-y: auto;
        margin: 0;
        border-radius: 0;
    }
    
    .filters-sidebar.show {
        left: 0;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
    
    .products-page-title {
        font-size: 2.2rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .products-page-title-icon {
        font-size: 1.2rem;
        padding: 0.75rem;
    }
}

@media (max-width: 767.98px) {
    .products-section {
        padding: 1rem 0;
    }
    
    /* Product cards - 1 per row on mobile - More specific rules */
    #featured-products-container .col-lg-3.col-md-6.col-sm-12,
    #featured-products-container .col-lg-3,
    #featured-products-container .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        padding-left: 15px;
        padding-right: 15px;
    }
    
    #featured-products-container .product-card {
        margin-bottom: 1.5rem;
        width: 100%;
        max-width: 100%;
    }
    
    /* Ensure product grid doesn't overflow on mobile */
    #featured-products-container .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    #featured-products-container .row > [class*="col-"] {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .product-card-image {
        height: 150px;
    }
    
    .product-card-content {
        padding: 1rem;
        height: calc(100% - 150px);
    }
    
    .product-card-title {
        font-size: 1rem;
    }
    
    .product-card-price {
        font-size: 1.1rem;
    }
    
    .products-page-title {
        font-size: 1.8rem;
    }
    
    .products-page-title-icon {
        font-size: 1rem;
        padding: 0.6rem;
    }
    
    .filters-sidebar {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    /* Product cards - 1 per row on mobile - More specific rules */
    #featured-products-container .col-lg-3.col-md-6.col-sm-12,
    #featured-products-container .col-lg-3,
    #featured-products-container .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        padding-left: 15px;
        padding-right: 15px;
    }
    
    #featured-products-container .product-card {
        margin-bottom: 1.5rem;
        width: 100%;
        max-width: 100%;
    }
    
    /* Ensure product grid doesn't overflow on mobile */
    #featured-products-container .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    #featured-products-container .row > [class*="col-"] {
        padding-left: 15px;
        padding-right: 15px;
    }
}
    
    .products-header {
        padding: 1rem;
    }
    
    .products-header .row {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Loading States */
.products-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: var(--primary-green);
    font-size: 1.1rem;
    font-weight: 600;
}

.products-loading i {
    margin-right: 0.5rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.products-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}

.products-empty i {
    font-size: 4rem;
    color: var(--light-gray);
    margin-bottom: 1rem;
}

.products-empty h3 {
    color: var(--dark-green);
    margin-bottom: 1rem;
}

.products-empty p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

/* Filter Overlay for Mobile */
.filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.filter-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Hierarchical Category Filters */
.category-filter-group {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

.category-filter-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.category-label {
    font-weight: 600;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0.25rem 0;
    transition: color 0.2s ease;
}

.category-label:hover {
    color: #007bff;
}

.expand-icon {
    cursor: pointer;
    transition: transform 0.2s ease;
    color: #666;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

.expand-icon:hover {
    color: #007bff;
    transform: scale(1.1);
}

.subcategories-container {
    border-left: 2px solid #e9ecef;
    padding-left: 1rem;
    margin-top: 0.5rem;
    margin-left: 0.5rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.subcategory-label {
    font-weight: 400;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0.2rem 0;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.subcategory-label:hover {
    color: #007bff;
}

.subcategory-label i {
    color: #28a745;
    font-size: 0.8rem;
}

.category-label i {
    color: #007bff;
    font-size: 0.9rem;
}
