/* ===== Category index page (subcategory listing) ===== */
.category-container {
    max-width: 1430px;
    margin: 0 auto;
    padding: 0 15px 30px;
}

.category-container .home-categories-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 10px 0 30px 0;
    padding: 0 0 15px 0;
    border-bottom: 1px solid #e5e5e5;
}

.category-container .home-categories-title {
    margin: 0;
    font-weight: 600;
    line-height: 1.2;
    text-align: left;
}

/* ===== Category carousel (circle icons) ===== */
.category-carousel-wrapper {
    padding: 0 0 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
}

.category-carousel-container {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 100%;
}

.category-carousel {
    flex: 1;
    overflow: hidden;
    position: relative;
    width: 100%;
    max-width: 100%;
}

.category-carousel-track {
    display: flex;
    gap: 20px;
    transition: transform 0.3s ease;
    will-change: transform;
    flex-wrap: nowrap;
}

.category-carousel-item {
    flex: 0 0 auto;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
    max-width: 120px;
}

.category-carousel-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    background: #fff;
}

.category-carousel-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-carousel-label {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    color: #000;
    line-height: 1.3;
}

.carousel-nav {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    z-index: 10;
}

.carousel-nav:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

.carousel-nav svg {
    width: 20px;
    height: 20px;
    color: #000;
}

.carousel-nav-prev {
    margin-right: 10px;
}

.carousel-nav-next {
    margin-left: 10px;
}

/* ===== Subcategory grid ===== */
.category-grid .category-card {
    margin-bottom: 30px;
}

.category-grid .category-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.category-grid .category-card .category-card-img {
    width: 100%;
    aspect-ratio: 5 / 3;
    object-fit: cover;
    border-radius: 4px;
    transition: opacity 0.2s ease;
    display: block;
}

.category-grid .category-card a:hover .category-card-img {
    opacity: 0.85;
}

.category-grid .category-card .category-card-name {
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    margin-top: 12px;
    margin-bottom: 0;
}

.category-grid .category-labels-container {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
}

.category-grid .label-red {
    background: #dc3545;
    color: #fff;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}

/* ===== Related blog posts ===== */
.category-blog-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.category-blog-section .section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.category-blog-card {
    height: 100%;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.category-blog-card:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.category-blog-card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.category-blog-card .blog-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    order: -1;
}

.category-blog-card .blog-card-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.category-blog-card .blog-card-meta {
    font-size: 12px;
    color: #7a7a7a;
    margin-bottom: 8px;
}

.category-blog-card .blog-card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}

.category-blog-card .blog-card-excerpt {
    font-size: 13px;
    color: #555;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Description / SEO text ===== */
.category-description {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
    line-height: 1.7;
    font-size: 14px;
    color: #333;
}

.category-description ul,
.category-description ol {
    list-style: disc;
    padding-left: 40px !important;
    margin-bottom: 1em;
}

.category-description ol {
    list-style: decimal;
}

.category-description li {
    margin-bottom: 0.3em;
}

.category-description table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.category-description table th,
.category-description table td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: left;
}

.category-description table th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.category-description h2,
.category-description h3 {
    margin-top: 1.2em;
    margin-bottom: 0.6em;
}

/* ===== Category show page (product listing) ===== */

/* Hero: image left + h1/description right */
.category-hero {
    align-items: stretch;
    height: 380px;
    overflow: hidden;
    margin-top: 20px;
    margin-bottom: 20px;
}

.category-hero-img-wrapper {
    position: relative;
    display: block;
    height: 100%;
    overflow: hidden;
    border-radius: 4px;
}

.category-hero-img-wrapper .zoom-icon {
    position: absolute;
    bottom: 30px;
    right: 14px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.category-hero-img-wrapper .zoom-icon svg {
    width: 16px;
    height: 16px;
    color: #333;
}

.category-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.category-hero-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 14px 0;
    line-height: 1.3;
}

.category-hero-text-col {
    display: flex;
    flex-direction: column;
    max-height: 380px;
}

.category-hero-description {
    font-size: 14px;
    line-height: 1.7;
    color: #444;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f5f5f5;
}

.category-hero-description::-webkit-scrollbar {
    width: 6px;
}

.category-hero-description::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 3px;
}

.category-hero-description::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.category-hero-description ul,
.category-hero-description ol {
    list-style: disc;
    padding-left: 24px !important;
    margin-bottom: 0.8em;
}

.category-hero-description ol {
    list-style: decimal;
}

.category-hero-description li {
    margin-bottom: 0.2em;
}

.category-hero-description table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.8em 0;
}

.category-hero-description table th,
.category-hero-description table td {
    border: 1px solid #ccc;
    padding: 6px 8px;
    text-align: left;
    font-size: 13px;
}

.category-hero-description table th {
    background-color: #f5f5f5;
    font-weight: 600;
}

hr.category-hero-separator {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 0 0 24px;
}

.category-image-gallery {
    margin-bottom: 20px;
}

.category-image-gallery img {
    width: 100%;
    border-radius: 4px;
}

/* Product group headers (type 3 — grouped categories like kitchen cabinets) */
.category-container .product-group-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 24px 0 16px 0;
    padding: 0 0 10px 0;
    border-bottom: 1px solid #e5e5e5;
}

.category-container .product-group-header:first-child {
    margin-top: 0;
}

.category-container .product-group-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

/* Category show page — product count in header */
.category-product-count {
    font-size: 14px;
    font-weight: 400;
    color: #7a7a7a;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .carousel-nav {
        display: none !important;
    }

    .category-carousel-item {
        min-width: 100px;
        max-width: 100px;
    }

    .category-carousel-image {
        width: 80px;
        height: 80px;
    }

    .category-carousel-label {
        font-size: 11px;
    }

    .category-grid .category-card {
        margin-bottom: 20px;
    }

    .category-blog-card .blog-card-img {
        height: 160px;
    }

    .category-hero {
        height: auto;
    }

    .category-hero-text-col {
        max-height: none;
    }

    .category-hero-description {
        overflow: hidden;
        max-height: 5.1em;
        position: relative;
    }

    .category-hero-description::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 2em;
        background: linear-gradient(transparent, #fff);
        pointer-events: none;
    }

    .category-hero-description.expanded {
        max-height: none;
        overflow: visible;
    }

    .category-hero-description.expanded::after {
        display: none;
    }

    .category-hero-title {
        font-size: 20px;
    }
}

/* Read more toggle — visible only on mobile */
.category-desc-toggle {
    display: none;
}

@media (max-width: 768px) {
    .category-desc-toggle {
        display: inline-block;
        background: none;
        border: none;
        color: #007bff;
        font-size: 13px;
        font-weight: 600;
        padding: 6px 0 0;
        cursor: pointer;
    }

    .category-desc-toggle:hover {
        text-decoration: underline;
    }
}
