/* ==========================================================================
   Products Page Styling
   ========================================================================== */

.products-page-main {
    position: relative;
    background-color: #ffffff;
    padding: 150px 0 100px 0; /* Clears sticky header */
    box-sizing: border-box;
}

.products-page-container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 45px;
}

/* Page Header */
.products-page-header {
    margin-bottom: 20px;
}

.products-page-title {
    font-family: 'Manrope', sans-serif;
    font-size: 80px;
    font-weight: 700; /* bold */
    color: #171717;
    margin: 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

/* Divider Line */
.products-page-divider {
    border: none;
    border-top: 1px solid #171717;
    margin: 30px 0 50px 0;
}

/* Layout Grid Wrapper */
.products-layout-wrapper {
    display: flex;
    gap: 60px;
    width: 100%;
    align-items: flex-start;
}

/* Sidebar Navigation */
.products-sidebar {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 130px; /* Aligns under sticky header when scrolled */
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    padding-right: 15px;
}

/* Custom Scrollbar for Sidebar */
.products-sidebar::-webkit-scrollbar {
    width: 4px;
}

.products-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.products-sidebar::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 4px;
}

.sidebar-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #171717;
    margin: 0 0 24px 0;
    line-height: 1.2;
}

/* Nested Category Lists */
.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.category-link-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 10px;
    padding: 4px 0;
}

.category-filter-link {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: rgba(23, 23, 23, 0.6); /* muted link color */
    text-decoration: none;
    transition: color 0.3s ease, font-weight 0.3s ease;
    line-height: 1.4;
    flex-grow: 1;
}

.category-filter-link:hover {
    color: #171717;
}

.category-item.is-active > .category-link-wrapper > .category-filter-link {
    color: #F9452C; /* active color red */
    font-weight: 700;
}

/* Subcategory chevron toggles */
.category-toggle-btn {
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: rgba(23, 23, 23, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease, transform 0.3s ease;
    border-radius: 4px;
}

.category-toggle-btn:hover {
    color: #171717;
    background-color: #f1f5f9;
}

.category-item.is-expanded > .category-link-wrapper > .category-toggle-btn > .chevron-icon {
    transform: rotate(180deg);
}

/* Subcategory indent panel */
.subcategory-wrapper {
    display: none; /* collapsed initially */
}

.subcategory-wrapper .category-list {
    padding-left: 16px;
    margin-top: 8px;
    margin-bottom: 4px;
    border-left: 1.5px solid #e2e8f0;
}

/* Level 2 Subheading Style e.g. "SAFETY" in caps styling */
.subcategory-wrapper .category-filter-link {
    font-size: 14px;
    text-transform: capitalize;
}

/* Products Grid Area */
.products-grid-area {
    flex-grow: 1;
    position: relative;
    min-height: 500px;
}

/* Grid Load Transition Overlay */
.products-grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.65);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.products-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(249, 69, 44, 0.1);
    border-radius: 50%;
    border-top-color: #F9452C;
    animation: products-spin 0.8s linear infinite;
}

@keyframes products-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Grid Layout */
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    width: 100%;
}

/* Product Card */
.product-card {
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid rgba(23, 23, 23, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.product-image-wrapper {
    width: 100%;
    height: 220px;
    overflow: hidden;
    background-color: #f8fafc;
    position: relative;
    padding: 8px;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
    border-radius: 8px;
}

.product-card:hover .product-image {
    transform: scale(1.04);
}

.product-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f1f5f9;
    font-size: 40px;
}

.product-card-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
}

.product-card-title {
    font-family: 'Manrope', sans-serif;
    font-size: 18px;
    font-weight: 600; /* semi bold */
    color: #171717;
    margin: 0;
    line-height: 1.3;
}

.product-card-desc {
    font-family: 'DM Sans', sans-serif;
    font-size: 16px;
    font-weight: 400; /* regular */
    color: rgba(23, 23, 23, 0.7); /* body color opacity 70% */
    line-height: 24px;
    margin: 0;
    flex-grow: 1;
}

/* Empty State */
.no-products-found {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px;
    color: rgba(23, 23, 23, 0.4);
    gap: 16px;
}

.no-products-found .empty-icon {
    color: rgba(23, 23, 23, 0.2);
}

.no-products-found p {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

/* Responsive Rules */
@media (max-width: 1200px) {
    .products-page-title {
        font-size: 70px;
    }
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .products-layout-wrapper {
        gap: 40px;
    }
    .products-sidebar {
        width: 250px;
    }
}

@media (max-width: 991px) {
    .products-page-main {
        padding: 120px 0 80px 0;
    }
    .products-page-container {
        padding: 0 24px;
    }
    .products-page-title {
        font-size: 60px;
    }
    .products-layout-wrapper {
        flex-direction: column;
        gap: 50px;
    }
    .products-sidebar {
        width: 100%;
        position: static;
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .products-page-title {
        font-size: 48px;
    }
    .products-grid {
        grid-template-columns: 1fr;
    }
    .product-image-wrapper {
        height: 200px;
    }
}
