/**
 * Category Grid Module Styles
 * Compatible with Cravento Theme
 */

#cz-category-grid {
    padding: 60px 0;
    background-color: var(--global-palette9, #fff);
}

/* Section Header */
#cz-category-grid .section-header {
    text-align: center;
    margin-bottom: 50px;
}

#cz-category-grid .section-title {
    font-size: 32px;
    font-weight: 600;
    color: var(--global-palette1, #333);
    margin: 0;
    position: relative;
    display: inline-block;
}

#cz-category-grid .section-title:after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: var(--global-palette2, #78b946);
}

/* Categories Grid */
#cz-category-grid .categories-row {
    margin: 0 -15px;
}

#cz-category-grid .categories-row > div {
    padding: 0 15px;
    margin-bottom: 30px;
}

/* Category Item */
#cz-category-grid .category-item {
    background: #fff;
    border: 1px solid var(--global-palette4, #e8e8e8);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

#cz-category-grid .category-item:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--global-palette2, #78b946);
    transform: translateY(-5px);
}

#cz-category-grid .category-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Category Image */
#cz-category-grid .category-image-wrapper {
    position: relative;
    overflow: hidden;
    padding-top: 100%; /* 4:3 aspect ratio */
    background-color: #f5f5f5;
}

#cz-category-grid .category-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

#cz-category-grid .category-item:hover .category-image {
    transform: scale(1.1);
}

#cz-category-grid .category-no-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
}

#cz-category-grid .category-no-image .material-icons {
    font-size: 60px;
    color: #ccc;
}

/* Overlay */
#cz-category-grid .category-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f7f5ef;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#cz-category-grid .category-item:hover .category-overlay {
    opacity: 1;
}

#cz-category-grid .view-category {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

#cz-category-grid .view-category .material-icons {
    font-size: 20px;
}

/* Category Info */
#cz-category-grid .category-info {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

#cz-category-grid .category-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--global-palette1, #333);
    margin: 0 0 10px 0;
    transition: color 0.3s ease;
}

#cz-category-grid .category-item:hover .category-name {
    color: var(--global-palette2, #78b946);
}

#cz-category-grid .product-count {
    font-size: 14px;
    color: #999;
    margin: 0 0 15px 0;
}

/* Subcategories */
#cz-category-grid .subcategories {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

#cz-category-grid .subcategories-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#cz-category-grid .subcategories-list li {
    font-size: 12px;
}

#cz-category-grid .subcat-link {
    display: inline-block;
    padding: 4px 12px;
    background-color: #f5f5f5;
    color: #666;
    border-radius: 15px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

#cz-category-grid .subcat-link:hover {
    background-color: var(--global-palette2, #78b946);
    color: #fff;
}

#cz-category-grid .more-subcats {
    padding: 4px 12px;
    background-color: #e8e8e8;
    color: #999;
    border-radius: 15px;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 991px) {
    #cz-category-grid {
        padding: 40px 0;
    }

    #cz-category-grid .section-title {
        font-size: 28px;
    }

    #cz-category-grid .section-header {
        margin-bottom: 35px;
    }
}

@media (max-width: 767px) {
    #cz-category-grid {
        padding: 30px 0;
    }

    #cz-category-grid .section-title {
        font-size: 24px;
    }

    #cz-category-grid .section-header {
        margin-bottom: 25px;
    }

    #cz-category-grid .categories-row > div {
        margin-bottom: 20px;
    }

    #cz-category-grid .category-name {
        font-size: 18px;
    }

    /* Always show overlay on mobile */
    #cz-category-grid .category-overlay {
        opacity: 0;
    }

    #cz-category-grid .category-item:active .category-overlay {
        opacity: 1;
    }
}

@media (max-width: 575px) {
    #cz-category-grid .section-title {
        font-size: 20px;
    }

    #cz-category-grid .category-name {
        font-size: 16px;
    }

    #cz-category-grid .category-info {
        padding: 15px;
    }

    #cz-category-grid .view-category {
        font-size: 14px;
    }
}

/* Loading Animation */
#cz-category-grid .loading {
    text-align: center;
    padding: 60px 0;
}

#cz-category-grid .loading::after {
    content: '';
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 5px solid var(--global-palette4, #e8e8e8);
    border-top-color: var(--global-palette2, #78b946);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Empty State */
#cz-category-grid .no-categories {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

#cz-category-grid .no-categories .material-icons {
    font-size: 80px;
    color: #ddd;
    margin-bottom: 20px;
}

#cz-category-grid .no-categories p {
    font-size: 18px;
    margin: 0;
}
