/* 基础设置 */
.custom-featured-categories {
    display: grid;
    gap: 20px;
    padding: 20px;
    margin: 0 auto;
    max-width: 1200px;
    width: 100%;
    box-sizing: border-box;
}

/* 链接样式 - 移除下划线 */
.custom-featured-categories a.category-link {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    height: 100%;
}

.custom-featured-categories a.category-link:hover {
    text-decoration: none;
}

/* ========== Grid 布局 - 图片整张展示 ========== */
.custom-featured-categories-grid {
    grid-template-columns: repeat(3, 1fr);
}

.custom-featured-categories-grid .category-module {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.custom-featured-categories-grid .category-module:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.custom-featured-categories-grid .category-banner {
    height: 220px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.custom-featured-categories-grid .category-banner img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.custom-featured-categories-grid .category-module:hover .category-banner img {
    transform: scale(1.05);
}

.custom-featured-categories-grid .category-title {
    padding: 15px;
    margin: 0;
    font-size: 16px;
    text-align: center;
    font-weight: 600;
    color: #333;
}

/* ========== Card 布局 - 图片整张展示 ========== */
.custom-featured-categories-card {
    grid-template-columns: repeat(3, 1fr);
}

.custom-featured-categories-card .category-module {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #eaeaea;
}

.custom-featured-categories-card .category-module:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
    border-color: #007cba;
}

.custom-featured-categories-card .category-banner {
    height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.custom-featured-categories-card .category-banner img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.custom-featured-categories-card .category-module:hover .category-banner img {
    transform: scale(1.1);
}

.custom-featured-categories-card .category-content {
    padding: 20px;
    text-align: center;
}

.custom-featured-categories-card .category-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* ========== Large Image 布局 - 图片整张展示 ========== */
.custom-featured-categories-large_image {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.custom-featured-categories-large_image .large-main-section {
    flex: 1;
    max-width: 400px;
}

.custom-featured-categories-large_image .large-main-item {
    height: 100%;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.custom-featured-categories-large_image .large-main-item .category-banner {
    height: 450px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.custom-featured-categories-large_image .large-main-item .category-banner img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.6s ease;
}

.custom-featured-categories-large_image .large-main-item:hover .category-banner img {
    transform: scale(1.08);
}

.custom-featured-categories-large_image .large-main-item .category-title {
    padding: 20px;
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    color: #333;
}

.custom-featured-categories-large_image .large-side-section {
    flex: 1;
    max-width: 600px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    align-items: start;
}

.custom-featured-categories-large_image .category-module-small {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.custom-featured-categories-large_image .category-module-small:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.custom-featured-categories-large_image .category-module-small .category-banner {
    height: 200px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.custom-featured-categories-large_image .category-module-small .category-banner img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.custom-featured-categories-large_image .category-module-small:hover .category-banner img {
    transform: scale(1.1);
}

.custom-featured-categories-large_image .category-module-small .category-title {
    padding: 15px 10px;
    margin: 0;
    font-size: 16px;
    text-align: center;
    font-weight: 600;
    color: #333;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== Dynamic 布局 - 图片整张展示 ========== */
.custom-featured-categories-dynamic {
    grid-template-columns: repeat(2, 1fr);
}

.custom-featured-categories-dynamic .category-module {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.custom-featured-categories-dynamic .category-module:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.custom-featured-categories-dynamic .category-banner {
    height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.custom-featured-categories-dynamic .category-banner img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.custom-featured-categories-dynamic .category-module:hover .category-banner img {
    transform: scale(1.05);
}

.custom-featured-categories-dynamic .category-content {
    padding: 15px;
}

.custom-featured-categories-dynamic .category-title {
    margin: 0;
    font-size: 16px;
    text-align: center;
    font-weight: 600;
    color: #333;
}

/* ========== Circle Box 布局 - 增大图片尺寸 ========== */
.custom-featured-categories-circle_box {
    display: grid;
    gap: 40px;
    justify-items: center;
    grid-template-columns: repeat(3, 1fr);
}

.custom-featured-categories-circle_box .category-module {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 350px;
}

.custom-featured-categories-circle_box .circle-image-wrapper {
    position: relative;
    width: 320px;
    height: 320px;
    margin-bottom: 15px;
}

.custom-featured-categories-circle_box .circle-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 8px solid white;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.custom-featured-categories-circle_box .circle-image.no-image {
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-featured-categories-circle_box .circle-text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 30px;
}

.custom-featured-categories-circle_box .circle-text-overlay .category-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: white;
    text-align: center;
    line-height: 1.4;
    padding: 15px;
}

.custom-featured-categories-circle_box .circle-image-wrapper:hover .circle-text-overlay {
    opacity: 1;
}

.custom-featured-categories-circle_box .circle-image-wrapper:hover .circle-image {
    transform: scale(1.08);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.custom-featured-categories-circle_box .mobile-circle-text {
    display: none;
    margin-top: 15px;
}

.custom-featured-categories-circle_box .mobile-circle-text .category-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #333;
    text-align: center;
    line-height: 1.3;
}

/* ========== Circle Below 布局 - 增大图片尺寸 ========== */
.custom-featured-categories-circle_below {
    display: grid;
    gap: 40px;
    justify-items: center;
    grid-template-columns: repeat(3, 1fr);
}

.custom-featured-categories-circle_below .category-module {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 280px;
}

.custom-featured-categories-circle_below .circle-image-wrapper {
    width: 240px;
    height: 240px;
    margin-bottom: 20px;
}

.custom-featured-categories-circle_below .circle-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 4px solid white;
}

.custom-featured-categories-circle_below .circle-image.no-image {
    background: #f0f0f0;
}

.custom-featured-categories-circle_below .category-module:hover .circle-image {
    transform: scale(1.12);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.custom-featured-categories-circle_below .category-title {
    margin: 20px 0 0 0;
    font-size: 18px;
    font-weight: 700;
    color: #333;
    padding: 0 15px;
    max-width: 220px;
    text-align: center;
}

/* ========== 响应式设计 ========== */

/* 平板端 (768px-1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Large布局保持左右结构 */
    .custom-featured-categories-large_image {
        flex-direction: row;
    }
    
    .custom-featured-categories-large_image .large-main-item .category-banner {
        height: 350px;
    }
    
    /* Grid和Card布局：2列 */
    .custom-featured-categories-grid,
    .custom-featured-categories-card {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 圆形布局：3列 */
    .custom-featured-categories-circle_box,
    .custom-featured-categories-circle_below {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 30px;
    }
    
    .custom-featured-categories-circle_box .circle-image-wrapper {
        width: 220px;
        height: 220px;
    }
    
    .custom-featured-categories-circle_below .circle-image-wrapper {
        width: 180px;
        height: 180px;
    }
}

/* 手机横屏 (576px-767px) */
@media (min-width: 576px) and (max-width: 767px) {
    /* Large布局保持左右结构 */
    .custom-featured-categories-large_image {
        flex-direction: row;
    }
    
    .custom-featured-categories-large_image .large-main-item .category-banner {
        height: 250px;
    }
    
    /* Grid、Card、Dynamic布局：2列 */
    .custom-featured-categories-grid,
    .custom-featured-categories-card,
    .custom-featured-categories-dynamic {
        grid-template-columns: repeat(2, 1fr);
        max-width: 100%;
    }
    
    /* 圆形布局：3列 */
    .custom-featured-categories-circle_box,
    .custom-featured-categories-circle_below {
        grid-template-columns: repeat(3, 1fr) !important;
        justify-content: center;
        max-width: 100%;
        gap: 20px;
    }
    
    .custom-featured-categories-circle_box .category-module,
    .custom-featured-categories-circle_below .category-module {
        max-width: 180px;
    }
    
    .custom-featured-categories-circle_box .circle-image-wrapper {
        width: 160px;
        height: 160px;
    }
    
    .custom-featured-categories-circle_below .circle-image-wrapper {
        width: 150px;
        height: 150px;
    }
}

/* 手机竖屏 (小于576px) */
@media (max-width: 575px) {
    /* 所有布局容器 */
    .custom-featured-categories {
        display: grid !important;
        grid-template-columns: 1fr;
        padding: 15px;
        justify-items: center;
    }
    
    /* Large布局改为上下结构 */
    .custom-featured-categories-large_image {
        flex-direction: column;
        align-items: center;
        width: 100%;
        max-width: 400px;
    }
    
    .custom-featured-categories-large_image .large-main-item .category-banner {
        height: 200px;
    }
    
    .custom-featured-categories-large_image .large-side-section {
        grid-template-columns: repeat(2, 1fr);
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }
    
    .custom-featured-categories-large_image .large-main-item .category-title {
        font-size: 18px;
        padding: 15px;
    }
    
    .custom-featured-categories-large_image .category-module-small .category-banner {
        height: 150px;
    }
    
    .custom-featured-categories-large_image .category-module-small .category-title {
        font-size: 14px;
        padding: 10px 5px;
    }
    
    /* Grid、Card、Dynamic布局：1列 */
    .custom-featured-categories-grid,
    .custom-featured-categories-card,
    .custom-featured-categories-dynamic {
        grid-template-columns: 1fr;
        width: 100%;
        max-width: 400px;
    }
    
    /* 圆形布局：2列 */
    .custom-featured-categories-circle_box,
    .custom-featured-categories-circle_below {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        justify-content: center;
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
        gap: 20px;
    }
    
    .custom-featured-categories-circle_box .category-module,
    .custom-featured-categories-circle_below .category-module {
        max-width: 160px;
        margin: 0;
    }
    
    .custom-featured-categories-circle_box .circle-image-wrapper {
        width: 140px;
        height: 140px;
    }
    
    .custom-featured-categories-circle_below .circle-image-wrapper {
        width: 130px;
        height: 130px;
    }
    
    /* Circle Box布局：手机端显示下方文字 */
    .custom-featured-categories-circle_box .circle-text-overlay {
        display: none;
    }
    
    .custom-featured-categories-circle_box .mobile-circle-text {
        display: block;
    }
    
    .custom-featured-categories-circle_below .category-title {
        font-size: 15px;
        max-width: 130px;
        margin-top: 12px;
    }
}

/* 超小手机端 (小于400px) */
@media (max-width: 400px) {
    /* 圆形布局保持2列但缩小尺寸 */
    .custom-featured-categories-circle_box,
    .custom-featured-categories-circle_below {
        grid-template-columns: repeat(2, 1fr) !important;
        max-width: 350px;
        gap: 15px;
    }
    
    .custom-featured-categories-circle_box .category-module,
    .custom-featured-categories-circle_below .category-module {
        max-width: 140px;
    }
    
    .custom-featured-categories-circle_box .circle-image-wrapper {
        width: 120px;
        height: 120px;
    }
    
    .custom-featured-categories-circle_below .circle-image-wrapper {
        width: 110px;
        height: 110px;
    }
    
    .custom-featured-categories-circle_box .mobile-circle-text .category-title,
    .custom-featured-categories-circle_below .category-title {
        font-size: 14px;
        max-width: 120px;
    }
    
    .custom-featured-categories-large_image .large-side-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

/* 极小手机端 (小于320px) */
@media (max-width: 320px) {
    .custom-featured-categories-circle_box,
    .custom-featured-categories-circle_below {
        grid-template-columns: repeat(2, 1fr) !important;
        max-width: 300px;
        gap: 10px;
    }
    
    .custom-featured-categories-circle_box .category-module,
    .custom-featured-categories-circle_below .category-module {
        max-width: 120px;
    }
    
    .custom-featured-categories-circle_box .circle-image-wrapper {
        width: 100px;
        height: 100px;
    }
    
    .custom-featured-categories-circle_below .circle-image-wrapper {
        width: 95px;
        height: 95px;
    }
    
    .custom-featured-categories-large_image .large-side-section {
        grid-template-columns: 1fr;
    }
}

/* 通用样式 */
.custom-featured-categories .category-banner img {
    display: block;
}

/* 加载动画 */
.custom-featured-categories .category-module {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 延迟动画 */
.custom-featured-categories .category-module:nth-child(1) { animation-delay: 0.1s; }
.custom-featured-categories .category-module:nth-child(2) { animation-delay: 0.2s; }
.custom-featured-categories .category-module:nth-child(3) { animation-delay: 0.3s; }
.custom-featured-categories .category-module:nth-child(4) { animation-delay: 0.4s; }
.custom-featured-categories .category-module:nth-child(5) { animation-delay: 0.5s; }
.custom-featured-categories .category-module:nth-child(6) { animation-delay: 0.6s; }

/* ========== 强制修复圆形布局在手机端的列数问题 ========== */

/* 手机端通用修复 - 确保圆形布局显示2列 */
@media (max-width: 767px) {
    .custom-featured-categories-circle_box,
    .custom-featured-categories-circle_below {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
    
    /* 确保每个模块不会变成全宽 */
    .custom-featured-categories-circle_box .category-module,
    .custom-featured-categories-circle_below .category-module {
        width: 100% !important;
        max-width: 160px !important;
        margin: 0 auto !important;
    }
}

/* 超小手机端调整 */
@media (max-width: 480px) {
    .custom-featured-categories-circle_box,
    .custom-featured-categories-circle_below {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    
    .custom-featured-categories-circle_box .category-module,
    .custom-featured-categories-circle_below .category-module {
        max-width: 140px !important;
    }
}

/* 极小手机端调整 */
@media (max-width: 360px) {
    .custom-featured-categories-circle_box,
    .custom-featured-categories-circle_below {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    
    .custom-featured-categories-circle_box .category-module,
    .custom-featured-categories-circle_below .category-module {
        max-width: 120px !important;
    }
}

/* 强制清除可能覆盖grid布局的flex属性 */
.custom-featured-categories-circle_box,
.custom-featured-categories-circle_below {
    display: grid !important;
}

/* 防止父元素覆盖子元素布局 */
.custom-featured-categories {
    display: grid !important;
}

/* 确保圆形布局容器不会继承错误的显示属性 */
body .custom-featured-categories-circle_box,
body .custom-featured-categories-circle_below,
html .custom-featured-categories-circle_box,
html .custom-featured-categories-circle_below {
    display: grid !important;
}

/* 核武器级修复 - 使用最高优先级 */
body .custom-featured-categories.custom-featured-categories-circle_box,
body .custom-featured-categories.custom-featured-categories-circle_below {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 40px !important;
}

/* 手机端核武器级修复 */
@media (max-width: 767px) {
    body .custom-featured-categories.custom-featured-categories-circle_box,
    body .custom-featured-categories.custom-featured-categories-circle_below {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
}