/* frontend.css - 前端样式文件 */
/* 放置位置: /wp-content/plugins/industrial-product-system/css/frontend.css */

/* ========== 产品网格样式 ========== */
.wp-block-industrial-product-grid .product-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.wp-block-industrial-product-grid .product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15) !important;
}

.wp-block-industrial-product-grid .product-card:hover .card-image img {
    transform: scale(1.05);
}

.wp-block-industrial-product-grid .video-badge {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* 响应式 - 产品网格 */
@media (max-width: 768px) {
    .wp-block-industrial-product-grid .product-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .wp-block-industrial-product-grid .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ========== 单个产品展示样式 ========== */
.wp-block-single-product.layout-horizontal a:hover {
    transform: scale(1.02);
    transition: transform 0.3s;
}

.wp-block-single-product .product-info a {
    transition: all 0.3s;
}

.wp-block-single-product .product-info a:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 25px rgba(0, 102, 204, 0.4) !important;
}

/* 响应式 - 单个产品 */
@media (max-width: 768px) {
    .wp-block-single-product.layout-horizontal > div {
        grid-template-columns: 1fr !important;
    }
    
    .wp-block-single-product.layout-horizontal .product-media {
        height: 300px;
    }
}

/* ========== 产品分类样式 ========== */
.wp-block-product-categories .category-card {
    position: relative;
    overflow: hidden;
}

.wp-block-product-categories .category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s;
}

.wp-block-product-categories .category-card:hover::before {
    transform: translateX(0);
}

.wp-block-product-categories .category-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25) !important;
}

/* 响应式 - 产品分类 */
@media (max-width: 768px) {
    .wp-block-product-categories > div {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .wp-block-product-categories > div {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ========== 特色产品样式 ========== */
.wp-block-featured-products .featured-card {
    transition: all 0.3s;
}

.wp-block-featured-products .featured-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.2) !important;
}

.wp-block-featured-products .featured-card img {
    transition: transform 0.3s;
}

.wp-block-featured-products .featured-card:hover img {
    transform: scale(1.1);
}

/* 响应式 - 特色产品 */
@media (max-width: 768px) {
    .wp-block-featured-products .featured-slider {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .wp-block-featured-products .featured-slider {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ========== 通用样式优化 ========== */
.product-card a,
.category-card,
.featured-card a {
    display: block;
}

.product-card a:focus,
.category-card:focus,
.featured-card a:focus {
    outline: 3px solid #0066cc;
    outline-offset: 3px;
}

/* 图片加载优化 */
.card-image img,
.product-media img {
    object-fit: cover;
    object-position: center;
}

/* 按钮悬停效果 */
.product-info a[style*="background"] {
    position: relative;
    overflow: hidden;
}

.product-info a[style*="background"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.3s;
}

.product-info a[style*="background"]:hover::before {
    left: 100%;
}

/* 加载动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card,
.category-card,
.featured-card {
    animation: fadeIn 0.5s ease-out;
}

/* 打印样式 */
@media print {
    .wp-block-industrial-product-grid,
    .wp-block-single-product,
    .wp-block-product-categories,
    .wp-block-featured-products {
        page-break-inside: avoid;
    }
    
    .video-badge,
    .product-info a {
        display: none;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .product-card,
    .category-card,
    .featured-card {
        border: 2px solid currentColor !important;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .wp-block-industrial-product-grid .product-card,
    .wp-block-single-product,
    .wp-block-featured-products .featured-card {
        background: #1a1a1a !important;
        color: #f5f5f5 !important;
    }
    
    .product-card h3,
    .featured-card h3 {
        color: #f5f5f5 !important;
    }
    
    .card-excerpt,
    .product-card p {
        color: #d0d0d0 !important;
    }
}