/**
 * WooCommerce分类展示小部件样式 - 极简风格
 */

/* 主容器 */
.wcw-category-widget {
    max-width: 100%;
    margin: 0 auto;
}

/* 分类网格布局 */
.wcw-categories-grid {
    display: grid;
    gap: 30px;
    grid-template-columns: repeat(6, 1fr); /* 桌面端默认6列 */
}

/* 分类项样式 - 极简 */
.wcw-category-item {
    transition: transform 0.3s ease;
}

/* 悬停效果 */
.wcw-hover-enabled .wcw-category-item:hover {
    transform: translateY(-3px);
}

.wcw-category-link {
    display: block;
    text-decoration: none;
    color: inherit;
    text-align: center;
}

.wcw-category-link:hover {
    text-decoration: none;
    color: inherit;
}

/* 图片容器 */
.wcw-category-image-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

/* 分类图片 - 纯净样式 */
.wcw-category-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    transition: transform 0.3s ease;
}

.wcw-hover-enabled .wcw-category-item:hover .wcw-category-image {
    transform: scale(1.02);
}

/* 占位符图标 - 纯净样式 */
.wcw-category-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 32px;
    transition: transform 0.3s ease;
}

.wcw-hover-enabled .wcw-category-item:hover .wcw-category-placeholder {
    transform: scale(1.02);
    background: #eeeeee;
}

/* 分类名称 */
.wcw-category-name {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
    color: #333;
    line-height: 1.4;
    text-align: center;
    transition: color 0.3s ease;
}

.wcw-hover-enabled .wcw-category-item:hover .wcw-category-name {
    color: #007cba;
}

/* 产品数量 */
.wcw-category-count {
    font-size: 14px;
    color: #666;
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 12px;
    display: inline-block;
}

/* 隐藏类 */
.wcw-hidden {
    display: none !important;
}

/* 平板设备样式 */
@media (max-width: 1024px) {
    .wcw-categories-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }
    
    .wcw-category-image-wrapper {
        margin-bottom: 12px;
    }
    
    .wcw-category-image,
    .wcw-category-placeholder {
        width: 80px;
        height: 80px;
    }
    
    .wcw-category-placeholder {
        font-size: 28px;
    }
    
    .wcw-category-name {
        font-size: 15px;
    }
}

/* 手机设备样式 */
@media (max-width: 768px) {
    .wcw-categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .wcw-category-image-wrapper {
        margin-bottom: 10px;
    }
    
    .wcw-category-image,
    .wcw-category-placeholder {
        width: 60px;
        height: 60px;
    }
    
    .wcw-category-placeholder {
        font-size: 22px;
    }
    
    .wcw-category-name {
        font-size: 14px;
    }
}

/* 小屏手机适配 */
@media (max-width: 480px) {
    .wcw-categories-grid {
        gap: 15px;
    }
    
    .wcw-category-image-wrapper {
        margin-bottom: 8px;
    }
    
    .wcw-category-image,
    .wcw-category-placeholder {
        width: 50px;
        height: 50px;
    }
    
    .wcw-category-placeholder {
        font-size: 18px;
    }
    
    .wcw-category-name {
        font-size: 13px;
    }
}

/* 加载动画 */
.wcw-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.wcw-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: wcw-spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes wcw-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 无分类选择时的提示 */
.wcw-category-widget p {
    text-align: center;
    color: #666;
    padding: 60px 20px;
    margin: 0;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px dashed #ddd;
    font-size: 16px;
}

/* RTL语言支持 */
[dir="rtl"] .wcw-category-widget {
    direction: rtl;
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .wcw-category-item,
    .wcw-category-image,
    .wcw-category-placeholder,
    .wcw-category-name {
        transition: none;
    }
    
    .wcw-hover-enabled .wcw-category-item:hover {
        transform: none;
    }
    
    .wcw-hover-enabled .wcw-category-item:hover .wcw-category-image,
    .wcw-hover-enabled .wcw-category-item:hover .wcw-category-placeholder {
        transform: none;
    }
    
    @keyframes wcw-spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
}

/* 焦点样式 */
.wcw-category-link:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
    border-radius: 4px;
}

/* 可访问性增强 */
.wcw-category-link:focus .wcw-category-name {
    color: #007cba;
}

/* 自定义列数支持 */
.wcw-categories-grid.wcw-cols-1 { grid-template-columns: repeat(1, 1fr); }
.wcw-categories-grid.wcw-cols-2 { grid-template-columns: repeat(2, 1fr); }
.wcw-categories-grid.wcw-cols-3 { grid-template-columns: repeat(3, 1fr); }
.wcw-categories-grid.wcw-cols-4 { grid-template-columns: repeat(4, 1fr); }
.wcw-categories-grid.wcw-cols-5 { grid-template-columns: repeat(5, 1fr); }
.wcw-categories-grid.wcw-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* 超大屏幕适配 */
@media (min-width: 1920px) {
    .wcw-categories-grid {
        gap: 40px;
    }
    
    .wcw-category-image,
    .wcw-category-placeholder {
        width: 120px;
        height: 120px;
    }
    
    .wcw-category-placeholder {
        font-size: 40px;
    }
    
    .wcw-category-name {
        font-size: 18px;
    }
    
    .wcw-category-image-wrapper {
        margin-bottom: 18px;
    }
}

/* 图片加载失败样式 */
.wcw-category-image:not([src]),
.wcw-category-image[src=""] {
    display: none;
}

/* 空状态样式 */
.wcw-empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #999;
}

.wcw-empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    color: #ddd;
}

.wcw-empty-state h3 {
    margin: 0 0 12px 0;
    color: #666;
    font-weight: normal;
    font-size: 18px;
}

.wcw-empty-state p {
    margin: 0;
    font-size: 14px;
    background: none;
    border: none;
    padding: 0;
}

/* 编辑器增强样式 */
.elementor-control-categories_list .elementor-repeater-row-title {
    font-weight: 500 !important;
    color: #333 !important;
}

.elementor-control-categories_list .elementor-repeater-add {
    background: #007cba !important;
    border-color: #007cba !important;
}

.elementor-control-categories_list .elementor-repeater-add:hover {
    background: #005a87 !important;
    border-color: #005a87 !important;
}

/* 拖拽排序提示 */
.elementor-control-categories_list .elementor-repeater-row {
    position: relative;
}

.elementor-control-categories_list .elementor-repeater-row::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: #007cba;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.elementor-control-categories_list .elementor-repeater-row:hover::before {
    opacity: 1;
}

/* 加载状态样式 */
.wcw-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.wcw-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: wcw-spin 1s linear infinite;
}

.wcw-category-link {
    position: relative;
}

.wcw-category-link.wcw-loading {
    pointer-events: none;
}

/* 排序指示器 */
.wcw-sort-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 124, 186, 0.9);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wcw-category-item:hover .wcw-sort-indicator {
    opacity: 1;
}

/* 编辑器预览增强 */
.elementor-editor-active .wcw-category-item {
    cursor: default;
}

.elementor-editor-active .wcw-category-link {
    pointer-events: none;
}

/* 无障碍增强 */
.wcw-category-link[aria-describedby] {
    position: relative;
}

.wcw-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .wcw-category-placeholder {
        border: 2px solid currentColor;
    }
    
    .wcw-category-name {
        font-weight: bold;
    }
    
    .wcw-category-item:hover {
        outline: 3px solid currentColor;
        outline-offset: 2px;
    }
}

/* 打印样式 */
@media print {
    .wcw-category-widget {
        break-inside: avoid;
    }
    
    .wcw-category-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .wcw-category-link:hover {
        transform: none;
    }
    
    .wcw-category-image,
    .wcw-category-placeholder {
        transition: none;
    }
} 