/* For smooth scrolling */
html {
    scroll-behavior: smooth;
}

.category-products-grid {
    padding-block: 4rem;
}

.subcategory-section {
    margin-bottom: 6rem;
    scroll-margin-top: 100px;
    /* Offset for fixed headers */
}

.subcategory-section:last-child {
    margin-bottom: 4rem;
}

/* Updated Floating Subcategory Navigation Styles */
.subcategory-nav {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 250px;
    background-color: #ffffff;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    overflow: hidden;
    transition: all 0.3s ease;
}

.subcategory-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Positions items on opposite ends */
    padding: 1rem 1.25rem;
    background-color: var(--color-primary);
    color: var(--color-white);
    cursor: pointer;
    /* Make the whole header clickable */
}

.subcategory-nav-header .header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.subcategory-nav-header .header-content svg {
    width: 1.25rem;
    height: 1.25rem;
}

.subcategory-nav-header .toggle-btn {
    background: none;
    border: none;
    color: white;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.subcategory-nav-header .toggle-btn svg {
    transition: transform 0.3s ease;
}

.subcategory-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 50vh;
    overflow-y: auto;
    transition: max-height 0.4s ease-in-out, padding 0.4s ease-in-out, opacity 0.3s ease-in-out;
    border-top: 1px solid var(--color-gray);
}

.subcategory-nav.collapsed ul {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    opacity: 0;
    border-top: none;
}

.subcategory-nav.collapsed .toggle-btn svg {
    transform: rotate(-180deg);
}


.subcategory-nav li a {
    display: block;
    padding: 0.85rem 1.25rem;
    color: var(--color-text);
    text-decoration: none;
    font-size: var(--font-size-sm);
    border-bottom: 1px solid var(--color-gray);
    transition: all 0.2s ease-in-out;
}

.subcategory-nav li:last-child a {
    border-bottom: none;
}

.subcategory-nav li a:hover {
    background-color: #f0f9ff;
    color: var(--color-primary);
    transform: translateX(5px);
}


/* Existing styles below... */
.subcategory-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.subcategory-description {
    font-size: var(--font-size-lg);
    color: var(--color-text);
    line-height: 1.6;
    max-width: 800px;
    margin: 0;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    width: 100%;
}

/* Changed .product-grid-item to an 'a' tag, styles are compatible */
.product-grid-item {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: var(--color-gray);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: all 0.3s ease;
    text-decoration: none;
    /* Added to remove underline from link */
}

.product-grid-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(251, 147, 32, 0.15);
}

.product-grid-image {
    position: relative;
    height: 250px;
    overflow: hidden;
}

.product-grid-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.product-grid-item:hover .product-grid-image img {
    transform: scale(1.1);
}

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg,
            rgba(251, 147, 32, 0.9) 0%,
            rgba(51, 51, 51, 0.9) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateY(100%);
}

.product-grid-item:hover .product-overlay {
    opacity: 1;
    transform: translateY(0);
}

.product-overlay-content {
    text-align: center;
    color: var(--color-white);
    padding: 2rem;
    max-width: 90%;
}

.product-overlay-content h4 {
    font-size: var(--font-size-xl);
    margin-bottom: 1rem;
    color: var(--color-white);
}

.product-overlay-content p {
    font-size: var(--font-size-md);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.product-overlay-content .btn {
    background-color: var(--color-white);
    color: var(--color-primary);
    border-color: var(--color-white);
}

.product-overlay-content .btn::after {
    background-color: var(--color-primary);
}

.product-overlay-content .btn:hover {
    color: var(--color-white);
}

.product-grid-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.product-grid-info h4 {
    font-size: var(--font-size-xl);
    color: var(--color-primary);
    margin: 0;
}

.product-grid-info p {
    font-size: var(--font-size-md);
    color: var(--color-text);
    line-height: 1.5;
    margin: 0;
}

/* Category Overview Section */
.category-overview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
    min-height: 80vh;
    padding-block: 4rem;
    background-color: var(--color-background);
}

.category-content,
.category-image {
    flex: 1;
}

.category-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2rem;
}

.category-features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--color-gray);
    border-radius: var(--border-radius-sm);
    transition: all 0.3s ease;
}

.feature-item:hover {
    transform: translateX(10px);
    background-color: var(--color-primary);
    color: var(--color-white);
}

.feature-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: var(--color-primary);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.feature-item:hover .feature-icon {
    background: var(--color-white);
    color: var(--color-primary);
}

.feature-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.feature-item span {
    font-size: var(--font-size-lg);
    font-weight: 500;
    transition: color 0.3s ease;
}

.category-image {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
}

.category-image img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    margin-top: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.category-image:hover img {
    transform: scale(1.02);
}

@media (max-width: 768px) {
    .category-products-grid {
        padding-block: 2rem;
    }

    .subcategory-section {
        margin-bottom: 4rem;
    }

    .subcategory-header {
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .subcategory-description {
        font-size: var(--font-size-md);
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .product-grid-item {
        margin: 0 auto;
        width: 100%;
    }

    .product-grid-image {
        height: 200px;
    }

    .product-overlay-content {
        padding: 1.5rem;
    }

    .product-overlay-content h4 {
        font-size: var(--font-size-lg);
    }

    .product-overlay-content p {
        font-size: var(--font-size-sm);
    }

    .product-grid-info {
        padding: 1rem;
    }

    /* Category Overview Mobile */
    .category-overview {
        flex-direction: column;
        gap: 2rem;
        padding-block: 2rem;
        min-height: auto;
    }

    .category-content {
        align-items: center;
        text-align: center;
    }

    .category-features {
        width: 100%;
    }

    .feature-item {
        justify-content: center;
        text-align: center;
    }

    .feature-item:hover {
        transform: translateY(-5px);
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .subcategory-header {
        text-align: center;
    }

    .subcategory-description {
        font-size: var(--font-size-sm);
    }

    .product-overlay-content {
        padding: 1rem;
    }

    .feature-item {
        padding: 0.75rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .feature-item span {
        font-size: var(--font-size-md);
    }
}