/**
 * Shenhua Carousel Styles
 * Banner轮播和产品横向滚动的CSS样式
 *
 * @package Shenhua Themes
 * @since 1.0
 */

/* ============================================
   Banner轮播样式
   ============================================ */

.sh-banner-carousel {
    position: relative;
    width: 100%;
    height: 420px;
    overflow: hidden;
    background-color: #f1f5f9;
}

.sh-carousel-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.sh-carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.sh-carousel-slide.is-active {
    opacity: 1;
    z-index: 1;
}

.sh-carousel-slide a {
    display: block;
    width: 100%;
    height: 100%;
}

.sh-carousel-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
    list-style: none;
    margin: 0;
    padding: 0;
}

.sh-carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background-color 0.3s ease;
    border: 2px solid transparent;
}

.sh-carousel-dot:hover,
.sh-carousel-dot.is-active {
    background-color: #ffffff;
    border-color: #1a365d;
}

.sh-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 60px;
    background-color: rgba(26, 54, 93, 0.6);
    color: #ffffff;
    border: none;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background-color 0.3s ease;
    opacity: 0;
}

.sh-banner-carousel:hover .sh-carousel-arrow {
    opacity: 1;
}

.sh-carousel-arrow:hover {
    background-color: rgba(26, 54, 93, 0.9);
}

.sh-carousel-prev {
    left: 0;
    border-radius: 0 4px 4px 0;
}

.sh-carousel-next {
    right: 0;
    border-radius: 4px 0 0 4px;
}

@media (max-width: 768px) {
    .sh-banner-carousel {
        height: 250px;
    }

    .sh-carousel-arrow {
        width: 30px;
        height: 40px;
        font-size: 16px;
        opacity: 1;
    }
}

/* ============================================
   产品横向滚动样式
   ============================================ */

.sh-product-scroller {
    position: relative;
    width: 100%;
    padding: 0 40px;
    box-sizing: border-box;
}

.sh-scroller-wrapper {
    overflow: hidden;
    width: 100%;
}

/* WordPress 块编辑器渲染的 post-template 需要横向滚动 */
.sh-scroller-wrapper .wp-block-post-template,
.sh-scroller-wrapper .wp-block-query {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 20px !important;
    overflow-x: auto !important;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 10px 0;
    list-style: none;
}

.sh-scroller-wrapper .wp-block-post-template::-webkit-scrollbar,
.sh-scroller-wrapper .wp-block-query::-webkit-scrollbar {
    display: none;
}

.sh-scroller-wrapper .wp-block-post-template > li,
.sh-scroller-wrapper .wp-block-query > .wp-block-group {
    flex: 0 0 auto !important;
    width: 200px;
    list-style: none;
}

/* 兼容旧的 .sh-scroller-track 结构 */
.sh-scroller-track {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 10px 0;
}

.sh-scroller-track::-webkit-scrollbar {
    display: none;
}

.sh-scroller-item {
    flex: 0 0 auto;
    width: 200px;
    text-align: center;
    background-color: #ffffff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sh-scroller-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.sh-scroller-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.sh-scroller-item p {
    margin: 0;
    padding: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #1a365d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sh-scroller-item p a {
    color: #1a365d;
    text-decoration: none;
    transition: color 0.3s ease;
}

.sh-scroller-item p a:hover {
    color: #c53030;
}

/* post-template 内的展品卡片样式 */
.sh-scroller-wrapper .wp-block-post-template .sh-scroller-item {
    width: 100%;
}

.sh-scroller-wrapper .wp-block-post-template .wp-block-post-featured-image img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px 4px 0 0;
}

.sh-scroller-wrapper .wp-block-post-template .wp-block-post-title {
    font-size: 14px;
    font-weight: 500;
    color: #1a365d;
    padding: 8px 10px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sh-scroller-wrapper .wp-block-post-template .wp-block-post-title a {
    color: #1a365d;
    text-decoration: none;
    transition: color 0.3s ease;
}

.sh-scroller-wrapper .wp-block-post-template .wp-block-post-title a:hover {
    color: #c53030;
}

/* 滚动按钮 */
.sh-scroller-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 60px;
    background-color: rgba(26, 54, 93, 0.7);
    color: #ffffff;
    border: none;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background-color 0.3s ease;
    border-radius: 4px;
    line-height: 1;
    padding: 0;
}

.sh-scroller-btn:hover {
    background-color: rgba(26, 54, 93, 0.9);
}

.sh-scroller-prev {
    left: 0;
}

.sh-scroller-next {
    right: 0;
}

@media (max-width: 768px) {
    .sh-product-scroller {
        padding: 0 30px;
    }

    .sh-scroller-wrapper .wp-block-post-template > li,
    .sh-scroller-item {
        width: 150px;
    }

    .sh-scroller-item img,
    .sh-scroller-wrapper .wp-block-post-template .wp-block-post-featured-image img {
        height: 120px;
    }

    .sh-scroller-btn {
        width: 24px;
        height: 40px;
        font-size: 14px;
    }
}

/* ============================================
   分页样式优化 - 美观版
   ============================================ */

/* 分页容器 - 居中显示，不换行 */
.wp-block-query-pagination,
nav.wp-block-query-pagination {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px !important;
    margin: 40px auto !important;
    padding: 15px 0 !important;
    flex-wrap: nowrap !important;
    max-width: 100% !important;
    background: transparent !important;
    border: none !important;
}

/* 分页数字容器 */
.wp-block-query-pagination-numbers {
    display: flex !important;
    gap: 3px !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
}

/* 所有页码按钮基础样式 - 缩小尺寸 */
.page-numbers,
a.page-numbers,
span.page-numbers {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 34px !important;
    height: 34px !important;
    padding: 0 10px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    color: #334155 !important;
    border: 1px solid transparent !important;
    margin: 0 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06) !important;
    cursor: pointer !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

/* 页码悬停效果 */
a.page-numbers:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1a365d 100%) !important;
    color: #ffffff !important;
    border-color: #1e40af !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(30, 64, 175, 0.2) !important;
}

/* 当前页高亮 */
.page-numbers.current,
span.page-numbers.current {
    background: linear-gradient(135deg, #dc2626 0%, #c53030 100%) !important;
    color: #ffffff !important;
    border-color: #dc2626 !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25) !important;
    transform: scale(1.08) !important;
}

/* 省略号样式 */
.page-numbers.dots,
span.page-numbers.dots {
    background: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    min-width: auto !important;
    height: auto !important;
    padding: 0 6px !important;
    transform: none !important;
    box-shadow: none !important;
    font-weight: 400 !important;
}

/* 上一页/下一页按钮 - 缩小尺寸 */
.wp-block-query-pagination-previous,
.wp-block-query-pagination-next,
a.wp-block-query-pagination-previous,
a.wp-block-query-pagination-next {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    min-width: auto !important;
    height: 34px !important;
    padding: 0 14px !important;
    border-radius: 17px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    background: linear-gradient(135deg, #1e40af 0%, #1a365d 100%) !important;
    color: #ffffff !important;
    border: 1px solid transparent !important;
    box-shadow: 0 2px 6px rgba(30, 64, 175, 0.15) !important;
    letter-spacing: 0.3px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

.wp-block-query-pagination-previous:hover,
.wp-block-query-pagination-next:hover,
a.wp-block-query-pagination-previous:hover,
a.wp-block-query-pagination-next:hover {
    background: linear-gradient(135deg, #dc2626 0%, #c53030 100%) !important;
    border-color: #dc2626 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.25) !important;
}

/* 禁用状态的按钮 */
.wp-block-query-pagination-previous.disabled,
.wp-block-query-pagination-next.disabled {
    opacity: 0.5 !important;
    pointer-events: none !important;
    background: #e2e8f0 !important;
    color: #94a3b8 !important;
    box-shadow: none !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .wp-block-query-pagination,
    nav.wp-block-query-pagination {
        gap: 3px !important;
        margin: 25px auto !important;
    }
    
    .page-numbers,
    a.page-numbers,
    span.page-numbers {
        min-width: 30px !important;
        height: 30px !important;
        font-size: 12px !important;
        padding: 0 8px !important;
    }
    
    .wp-block-query-pagination-previous,
    .wp-block-query-pagination-next,
    a.wp-block-query-pagination-previous,
    a.wp-block-query-pagination-next {
        height: 30px !important;
        padding: 0 10px !important;
        font-size: 11px !important;
    }
}

/* ============================================
   产品网格样式 - 首页 Products 区域
   ============================================ */

/* 产品网格容器 */
.sh-products-grid {
    margin-top: 25px;
}

/* 产品网格布局 - 4列 */
.sh-products-grid .wp-block-post-template {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* 产品卡片样式 */
.sh-product-card {
    background-color: #ffffff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sh-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

/* 产品图片容器 - 统一尺寸 */
.sh-product-card .wp-block-post-featured-image,
.sh-products-grid .wp-block-post-featured-image {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    width: 100% !important;
    height: 200px !important;
}

/* 产品图片 - 多种选择器确保覆盖 */
.sh-product-card .wp-block-post-featured-image img,
.sh-products-grid .wp-block-post-featured-image img,
.sh-product-card figure.wp-block-post-featured-image img,
.sh-products-grid figure.wp-block-post-featured-image img,
.sh-product-card .wp-block-post-featured-image a img,
.sh-products-grid .wp-block-post-featured-image a img {
    width: 100% !important;
    height: 200px !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    max-height: none !important;
}

/* 图片链接容器 */
.sh-product-card .wp-block-post-featured-image a,
.sh-products-grid .wp-block-post-featured-image a {
    display: block !important;
    width: 100% !important;
    height: 200px !important;
    overflow: hidden !important;
}

/* 产品标题样式 */
.sh-product-card .wp-block-post-title {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #1a365d !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}

.sh-product-card .wp-block-post-title a {
    color: #1a365d !important;
    text-decoration: none !important;
    transition: color 0.3s ease !important;
}

.sh-product-card .wp-block-post-title a:hover {
    color: #c53030 !important;
}

/* 响应式设计 - 产品网格 */
@media (max-width: 1024px) {
    .sh-products-grid .wp-block-post-template {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .sh-products-grid .wp-block-post-template {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    
    .sh-product-card .wp-block-post-featured-image,
    .sh-products-grid .wp-block-post-featured-image,
    .sh-product-card .wp-block-post-featured-image a {
        height: 150px !important;
    }
    
    .sh-product-card .wp-block-post-featured-image img,
    .sh-products-grid .wp-block-post-featured-image img,
    .sh-product-card figure.wp-block-post-featured-image img,
    .sh-products-grid figure.wp-block-post-featured-image img,
    .sh-product-card .wp-block-post-featured-image a img,
    .sh-products-grid .wp-block-post-featured-image a img {
        height: 150px !important;
    }
    
    .sh-product-card .wp-block-post-title {
        font-size: 14px !important;
    }
}

@media (max-width: 480px) {
    .sh-products-grid .wp-block-post-template {
        grid-template-columns: 1fr !important;
    }
    
    .sh-product-card .wp-block-post-featured-image,
    .sh-products-grid .wp-block-post-featured-image,
    .sh-product-card .wp-block-post-featured-image a {
        height: 200px !important;
    }
    
    .sh-product-card .wp-block-post-featured-image img,
    .sh-products-grid .wp-block-post-featured-image img,
    .sh-product-card figure.wp-block-post-featured-image img,
    .sh-products-grid figure.wp-block-post-featured-image img,
    .sh-product-card .wp-block-post-featured-image a img,
    .sh-products-grid .wp-block-post-featured-image a img {
        height: 200px !important;
    }
}

/* ============================================
   统一所有展品图片尺寸 - 全局样式
   ============================================ */

/* 全局展品图片容器 */
.wp-block-post-featured-image {
    overflow: hidden !important;
}

/* 展品列表页图片 - 分类页面、归档页面 */
.exhibits-grid .wp-block-post-featured-image,
.wp-block-query:not(.sh-product-scroller .wp-block-query) .wp-block-post-featured-image {
    width: 100% !important;
    height: 200px !important;
    overflow: hidden !important;
}

.exhibits-grid .wp-block-post-featured-image img,
.wp-block-query:not(.sh-product-scroller .wp-block-query) .wp-block-post-featured-image img,
.exhibits-grid figure.wp-block-post-featured-image img,
.wp-block-query:not(.sh-product-scroller .wp-block-query) figure.wp-block-post-featured-image img {
    width: 100% !important;
    height: 200px !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
}

/* ============================================
   强制覆盖 WordPress 内联样式
   ============================================ */

/* 使用属性选择器覆盖内联样式 */
.sh-product-card img[style*="aspect-ratio"],
.sh-products-grid img[style*="aspect-ratio"],
.sh-fixed-image img {
    aspect-ratio: unset !important;
    width: 100% !important;
    height: 200px !important;
    object-fit: cover !important;
}

/* 覆盖 figure 元素的内联样式 */
.sh-product-card figure[style*="aspect-ratio"],
.sh-products-grid figure[style*="aspect-ratio"] {
    aspect-ratio: unset !important;
    width: 100% !important;
    height: 200px !important;
}

/* 确保图片在容器内正确显示 */
.sh-product-card > .wp-block-post-featured-image,
.sh-products-grid .wp-block-post-template > li > .wp-block-group > .wp-block-post-featured-image {
    width: 100% !important;
    height: 200px !important;
    flex-shrink: 0 !important;
}
