/**
 * KB Featured Categories - Frontend Styles
 *
 * @author    Starter
 * @copyright 2024
 * @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

/* Container */
.kbfc-featured-categories {
    width: 100%;
    padding: 40px 0;
}

.kbfc-template {
    margin-bottom: 40px;
}

.kbfc-template:last-child {
    margin-bottom: 0;
}

/* Template Title */
.kbfc-template-title {
    text-align: center;
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 30px;
    color: #232323;
}

/* Categories Wrapper - Grid Layout */
.kbfc-categories-wrapper {
    display: grid;
    gap: 20px;
}

/* Columns Configuration */
.kbfc-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.kbfc-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.kbfc-cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

/* Category Item */
.kbfc-category-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #f8f8f8;
}

.kbfc-category-item a {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Image Wrapper */
.kbfc-image-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
}

.kbfc-category-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease, filter 0.4s ease;
}

/* Overlay */
.kbfc-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--kbfc-hover-color, rgba(0,0,0,0.3));
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* Content */
.kbfc-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: #fff;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.kbfc-category-name {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: #fff;
}

.kbfc-category-desc {
    font-size: 14px;
    margin: 0 0 10px 0;
    opacity: 0.9;
    line-height: 1.4;
}

.kbfc-view-more {
    display: inline-block;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.kbfc-category-item:hover .kbfc-view-more {
    opacity: 1;
    transform: translateY(0);
}

/* ===== SINGLE COLUMN STYLES ===== */

/* Style 1: Text Overlay Centered */
.kbfc-single_column.kbfc-style1 .kbfc-content {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    text-align: center;
    background: transparent;
}

.kbfc-single_column.kbfc-style1 .kbfc-category-item:hover .kbfc-overlay {
    opacity: 1;
}

/* Style 2: Text Overlay Bottom */
.kbfc-single_column.kbfc-style2 .kbfc-content {
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
}

/* Style 3: Text Below Image */
.kbfc-single_column.kbfc-style3 .kbfc-image-wrapper {
    aspect-ratio: 16 / 9;
}

.kbfc-single_column.kbfc-style3 .kbfc-content {
    position: relative;
    background: #fff;
    color: #232323;
    padding: 15px 20px;
}

.kbfc-single_column.kbfc-style3 .kbfc-category-name {
    color: #232323;
}

.kbfc-single_column.kbfc-style3 .kbfc-category-desc {
    color: #666;
}

.kbfc-single_column.kbfc-style3 .kbfc-view-more {
    color: #2fb5d2;
}

/* Style 4: Text Side by Side */
.kbfc-single_column.kbfc-style4 .kbfc-category-item a {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.kbfc-single_column.kbfc-style4 .kbfc-image-wrapper {
    width: 50%;
    aspect-ratio: 1 / 1;
}

.kbfc-single_column.kbfc-style4 .kbfc-content {
    position: relative;
    width: 50%;
    background: #f8f8f8;
    color: #232323;
    padding: 30px;
}

.kbfc-single_column.kbfc-style4 .kbfc-category-name {
    color: #232323;
}

.kbfc-single_column.kbfc-style4 .kbfc-category-desc {
    color: #666;
}

/* ===== SPLIT COLUMN STYLES ===== */

/* Split 1: Large Left, Small Right */
.kbfc-split_column.kbfc-split1 {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: repeat(2, 1fr);
}

.kbfc-split_column.kbfc-split1 .kbfc-category-item:first-child {
    grid-row: span 2;
}

/* Split 2: Small Left, Large Right */
.kbfc-split_column.kbfc-split2 {
    grid-template-columns: 1fr 2fr;
    grid-template-rows: repeat(2, 1fr);
}

.kbfc-split_column.kbfc-split2 .kbfc-category-item:nth-child(2) {
    grid-row: span 2;
}

/* Split 3: Equal Columns */
.kbfc-split_column.kbfc-split3 {
    grid-template-columns: repeat(2, 1fr);
}

/* Split 4: Masonry Style */
.kbfc-split_column.kbfc-split4 {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 200px;
}

.kbfc-split_column.kbfc-split4 .kbfc-category-item:nth-child(3n+1) {
    grid-row: span 2;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 991px) {
    .kbfc-cols-5 {
        grid-template-columns: repeat(3, 1fr);
    }

    .kbfc-single_column.kbfc-style4 .kbfc-category-item a {
        flex-direction: column;
    }

    .kbfc-single_column.kbfc-style4 .kbfc-image-wrapper,
    .kbfc-single_column.kbfc-style4 .kbfc-content {
        width: 100%;
    }
}

@media (max-width: 767px) {
    .kbfc-featured-categories {
        padding: 20px 0;
    }

    .kbfc-template-title {
        font-size: 22px;
        margin-bottom: 20px;
    }

    .kbfc-cols-3,
    .kbfc-cols-5 {
        grid-template-columns: repeat(2, 1fr);
    }

    .kbfc-split_column.kbfc-split1,
    .kbfc-split_column.kbfc-split2,
    .kbfc-split_column.kbfc-split4 {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .kbfc-split_column.kbfc-split1 .kbfc-category-item:first-child,
    .kbfc-split_column.kbfc-split2 .kbfc-category-item:nth-child(2),
    .kbfc-split_column.kbfc-split4 .kbfc-category-item:nth-child(3n+1) {
        grid-row: auto;
    }

    .kbfc-category-name {
        font-size: 16px;
    }
}

@media (max-width: 479px) {
    .kbfc-cols-2,
    .kbfc-cols-3,
    .kbfc-cols-5,
    .kbfc-split_column.kbfc-split3 {
        grid-template-columns: 1fr;
    }

    .kbfc-categories-wrapper {
        gap: 15px;
    }
}
