/**
 * YITU User Profile Recommendations - 前端样式
 *
 * @package YITU_User_Profile_Recommendations
 * @since 1.0.0
 */

/* 推荐区块容器 */
.yitu-recommendations-wrapper {
    margin: 40px 0;
    clear: both;
}

/* 标题样式 */
.yitu-rec-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

/* 产品容器 */
.yitu-rec-products {
    position: relative;
    min-height: 200px;
}

/* 加载状态 */
.yitu-rec-loading {
    opacity: 0.6;
    pointer-events: none;
}

.yitu-rec-spinner {
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: #999;
}

.yitu-rec-spinner:before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #333;
    border-radius: 50%;
    animation: yitu-rec-spin 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

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

/* 网格布局 */
.yitu-rec-grid {
    display: grid;
    gap: 20px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.yitu-rec-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

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

.yitu-rec-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

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

.yitu-rec-grid.columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* 响应式 - 平板 */
@media (max-width: 1024px) {
    .yitu-rec-grid.columns-4,
    .yitu-rec-grid.columns-5,
    .yitu-rec-grid.columns-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 响应式 - 手机横屏 */
@media (max-width: 768px) {
    .yitu-rec-grid.columns-3,
    .yitu-rec-grid.columns-4,
    .yitu-rec-grid.columns-5,
    .yitu-rec-grid.columns-6 {
        grid-template-columns: repeat(2, 1fr);
    }

    .yitu-rec-title {
        font-size: 20px;
    }
}

/* 响应式 - 手机竖屏 */
@media (max-width: 480px) {
    .yitu-rec-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    .yitu-rec-title {
        font-size: 18px;
        margin-bottom: 15px;
    }
}

/* 产品卡片样式（兼容 WooCommerce 默认样式） */
.yitu-rec-product {
    position: relative;
    text-align: center;
}

.yitu-rec-product img {
    width: 100%;
    height: auto;
    display: block;
}

/* 滑块布局 */
.yitu-rec-slider {
    position: relative;
}

.yitu-rec-slide {
    padding: 0 10px;
}

/* Slick 滑块箭头（如果使用 Slick） */
.yitu-rec-slider .slick-prev,
.yitu-rec-slider .slick-next {
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    z-index: 10;
}

.yitu-rec-slider .slick-prev:hover,
.yitu-rec-slider .slick-next:hover {
    background: rgba(0, 0, 0, 0.7);
}

.yitu-rec-slider .slick-prev {
    left: -20px;
}

.yitu-rec-slider .slick-next {
    right: -20px;
}

/* 空状态和错误状态 */
.yitu-rec-empty,
.yitu-rec-error {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 16px;
}

.yitu-rec-error {
    color: #d63638;
}

/* 与主题兼容 - Electro 主题特定样式 */
.electro-child .yitu-recommendations-wrapper {
    margin: 50px 0;
}

.electro-child .yitu-rec-title {
    font-family: inherit;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 产品卡片悬停效果 */
.yitu-rec-product {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.yitu-rec-product:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 加载骨架屏（可选） */
.yitu-rec-loading .yitu-rec-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: yitu-rec-skeleton 1.5s ease-in-out infinite;
}

@keyframes yitu-rec-skeleton {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 打印样式 */
@media print {
    .yitu-recommendations-wrapper {
        display: none;
    }
}

/* 深色模式支持（可选） */
@media (prefers-color-scheme: dark) {
    .yitu-rec-title {
        color: #f0f0f0;
    }

    .yitu-rec-spinner {
        color: #ccc;
    }

    .yitu-rec-spinner:before {
        border-color: rgba(255, 255, 255, 0.1);
        border-top-color: #fff;
    }

    .yitu-rec-empty,
    .yitu-rec-error {
        color: #ccc;
    }
}

/* 辅助功能增强 */
.yitu-rec-product a:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .yitu-rec-product:hover {
        box-shadow: 0 0 0 3px #000;
    }
}
