/**
 * Theme Header Styles - Automotive Parts Store
 * 沉稳工业灰风格：专业 + 可靠
 */

/* ========== HEADER STYLES ========== */

/* Top Bar - 深灰背景 */
body.template-automotive-parts .top-bar {
    background: linear-gradient(90deg, #2F3B40 0%, #1a2428 100%);
}
body.template-automotive-parts .top-bar .wp-block-group {
    border-bottom: none !important;
}
body.template-automotive-parts .top-bar .wp-block-image img {
    filter: brightness(0) invert(1);
}
body.template-automotive-parts .top-bar p {
    color: #fff !important;
}
body.template-automotive-parts .top-bar .top-2 p {
    color: #F59E0B !important;
    font-weight: 700;
    letter-spacing: 2px;
}

/* Middle Header - 深灰工业背景 */
body.template-automotive-parts .middle-header {
    background: #2F3B40;
    border-bottom: 3px solid #006EE9;
}
body.template-automotive-parts .logo-block .wp-block-site-title a {
    color: #fff !important;
    font-size: 34px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
}
body.template-automotive-parts .logo-block .wp-block-site-title a span,
body.template-automotive-parts .logo-block .wp-block-site-title a em {
    color: #006EE9 !important;
}

/* Search Block - 深色搜索框 */
body.template-automotive-parts .search-block .wp-block-search__inside-wrapper {
    background: rgba(255,255,255,0.08);
    border: 2px solid #006EE9;
    border-radius: 8px !important;
}
body.template-automotive-parts .search-block .wp-block-search__input {
    background: transparent !important;
    color: #fff;
}
body.template-automotive-parts .search-block .wp-block-search__input::placeholder {
    color: rgba(255,255,255,0.5) !important;
}
body.template-automotive-parts .search-block .wp-block-search__button {
    background: #006EE9 !important;
    border-radius: 6px !important;
}

/* Menu Header - 深灰工业导航 */
body.template-automotive-parts .menu-header {
    background: #1a2428 !important;
    border-top: 4px solid #006EE9 !important;
    box-shadow: 0 4px 16px rgba(0,110,233,0.2);
}
body.template-automotive-parts .menu-header .wp-block-navigation a {
    color: #fff !important;
    font-weight: 700;
    font-size: 13px !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 16px 20px;
}
body.template-automotive-parts .menu-header .wp-block-navigation a:hover {
    color: #006EE9 !important;
    background: rgba(0,110,233,0.15);
}

/* Cart - 蓝色图标 */
body.template-automotive-parts .cart-box .wc-block-mini-cart__icon {
    color: #006EE9 !important;
}
body.template-automotive-parts .cart-box .wc-block-mini-cart__badge {
    background: #006EE9 !important;
}

/* ========== FOOTER STYLES ========== */

/* Footer - 深灰金属渐变底 + 六边形网格 */
body.template-automotive-parts .wp-block-group[style*="black"] {
    background: 
        linear-gradient(135deg, #111a1e 0%, #1a2428 50%, #0a0e10 100%) !important;
    position: relative;
}
/* 六边形网格背景 */
body.template-automotive-parts .wp-block-group[style*="black"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 50% 50%, transparent 30px, rgba(0,110,233,0.02) 30px, rgba(0,110,233,0.02) 32px, transparent 32px);
    background-size: 64px 55px;
    pointer-events: none;
}

/* Footer Logo - 工业白蓝组合 */
body.template-automotive-parts .footer-box-1 .wp-block-site-title a {
    color: #fff !important;
    font-size: 32px !important;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 900;
}
body.template-automotive-parts .footer-box-1 .wp-block-site-title a span,
body.template-automotive-parts .footer-box-1 .wp-block-site-title a em {
    color: #006EE9 !important;
}

/* Footer Desc */
body.template-automotive-parts .footer-box-1 p {
    color: rgba(255,255,255,0.6) !important;
}

/* Footer Heading - 工业风格 */
body.template-automotive-parts .footer-widgets h3 {
    color: #fff !important;
    background: rgba(0,110,233,0.1);
    border-left: 4px solid #006EE9;
    padding: 10px 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 13px;
}

/* Footer Links - 工业线框 */
body.template-automotive-parts .footer-widgets ul li {
    border-bottom: 1px solid rgba(0,110,233,0.15);
    padding: 8px 0;
}
body.template-automotive-parts .footer-widgets ul li a {
    transition: all 0.3s;
}
body.template-automotive-parts .footer-widgets ul li a:hover {
    color: #006EE9 !important;
    padding-left: 8px;
    background: rgba(0,110,233,0.05);
}

/* Copyright - 工业金属条 */
body.template-automotive-parts .wp-block-group[style*="border-top"] {
    border-top: none !important;
    background: linear-gradient(90deg, #0a0e10, rgba(0,110,233,0.15), #0a0e10) !important;
    border-top: 3px solid #006EE9 !important;
}
body.template-automotive-parts .copyright-text,
body.template-automotive-parts .copyright-text p {
    color: rgba(255,255,255,0.7) !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 12px;
}
body.template-automotive-parts .copyright-text a {
    color: #006EE9 !important;
    font-weight: 700;
}

/* Scroll to Top - 工业蓝 */
body.template-automotive-parts .scroll-top::before {
    background: #006EE9;
    border: 2px solid rgba(255,255,255,0.3);
}
body.template-automotive-parts .scroll-top:hover::before {
    background: #005AC4 !important;
    transform: rotate(-45deg) translateY(-10px);
}

/* ==================== 最终版：商品网格自动化样式（去重复版） ==================== */

/* 1. 外层容器居中（左右各留10%空白） */
.auto-product-section,
.custom-products-grid .auto-product-section {
    max-width: 80% !important;
    margin: 0 auto !important;
}

/* 2. 强制商品列表使用网格：桌面5列 */
.auto-product-section ul.products,
.custom-products-grid .auto-product-section ul.products {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 25px !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    clear: both !important;
}

/* 3. 每个商品卡片：固定高度，flex列布局 */
.auto-product-section ul.products li.product,
.custom-products-grid .auto-product-section ul.products li.product {
    float: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    height: 380px;
    display: flex !important;
    flex-direction: column;
}

/* 4. 卡片内链接区（自适应剩余空间） */
.auto-product-section ul.products li.product .woocommerce-loop-product__link {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    padding: 20px 15px 10px;
}

/* 5. 商品图片 */
.auto-product-section ul.products li.product img {
    max-height: 140px;
    width: auto;
    margin: 0 auto 15px;
    object-fit: contain;
}

/* 6. 标题：两行，超出省略号 */
.auto-product-section ul.products li.product .woocommerce-loop-product__title {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.3;
    margin: 0 0 8px 0;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    word-break: break-word !important;
    white-space: normal !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    padding: 0 !important;
}

/* 7. 价格样式 */
.auto-product-section ul.products li.product .price {
    font-size: 15px;
    font-weight: 700;
    margin: 8px 0;
    color: #222;
}

/* 8. 按钮置底 */
.auto-product-section ul.products li.product .button {
    margin-top: auto !important;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 30px;
    padding: 6px 12px;
    font-size: 13px;
    text-align: center;
    display: inline-block;
    width: auto;
    transition: 0.2s;
}
.auto-product-section ul.products li.product .button:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

/* 9. 栏目头部（标题栏+查看全部按钮） */
.auto-product-section .sec-head-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

/* 10. "查看全部"按钮修复（桌面+移动） */
.auto-product-section .sec-head-box a,
.auto-product-section .sec-head-box .wp-block-button__link,
.custom-products-grid .sec-head-box a,
.custom-products-grid .sec-head-box .wp-block-button__link {
    background-color: transparent !important;
    background: transparent !important;
    border: 1px solid #ddd !important;
    border-radius: 30px !important;
    color: #333 !important;
    padding: 8px 25px !important;
    font-size: 14px !important;
    text-decoration: none !important;
    display: inline-block !important;
    line-height: normal !important;
    transition: 0.2s !important;
    white-space: nowrap;
}
.auto-product-section .sec-head-box a:hover,
.custom-products-grid .sec-head-box a:hover {
    background-color: #f5f5f5 !important;
    border-color: #bbb !important;
    color: #333 !important;
}

/* 11. 清除可能的干扰（针对主题全局样式） */
.woocommerce ul.products,
.woocommerce-page ul.products {
    display: grid !important;
}
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
    clear: none !important;
}

/* 12. 修复伪元素导致 grid 错位：移除所有 .products 上的伪元素 */
.auto-product-section ul.products::before,
.auto-product-section ul.products::after,
.custom-products-grid .auto-product-section ul.products::before,
.custom-products-grid .auto-product-section ul.products::after,
.woocommerce ul.products::before,
.woocommerce ul.products::after,
ul.products::before,
ul.products::after {
    display: none !important;
    content: none !important;
}

@media (max-width: 768px) {
    .auto-product-section,
    .custom-products-grid .auto-product-section {
        max-width: 90% !important;
    }
    .auto-product-section ul.products,
    .custom-products-grid .auto-product-section ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
    .auto-product-section ul.products li.product,
    .custom-products-grid .auto-product-section ul.products li.product {
        height: auto !important;
        min-height: 280px !important;
    }
    .auto-product-section ul.products li.product .woocommerce-loop-product__title {
        font-size: 14px !important;
        line-height: 1.35 !important;
        max-height: 2.7em !important;
    }
    .auto-product-section ul.products li.product .price {
        font-size: 14px !important;
    }
    .auto-product-section ul.products li.product .button {
        width: 90% !important;
        margin: 10px auto !important;
        padding: 6px 10px !important;
        font-size: 12px !important;
        white-space: normal !important;
        line-height: 1.3;
    }
    /* 修复"查看全部"按钮高度过高 */
    .auto-product-section .sec-head-box a,
    .custom-products-grid .sec-head-box a {
        padding: 6px 16px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
        line-height: normal !important;
        height: auto !important;
        align-self: center !important;
        display: inline-block !important;
    }
}
/* ========== 不同分类不同列数（优先级高于全局） ========== */
/* 第一个分类：5列（同时匹配 .layout-5cols 或默认无类名的情况） */
.auto-product-section.layout-5cols ul.products,
.auto-product-section:not(.layout-3cols):not(.layout-4cols) ul.products {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
}

/* 第二个分类：3列 */
.auto-product-section.layout-3cols ul.products {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

/* 第三个分类：4列 */
.auto-product-section.layout-4cols ul.products {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

/* 每个商品卡片宽度自适应（防止被浮动干扰） */
.auto-product-section ul.products li.product {
    width: 100% !important;
    margin: 0 !important;
    float: none !important;
}

/* 桌面端：确保上面定义的列数生效，且卡片高度不变 */
@media (min-width: 769px) {
    .auto-product-section.layout-3cols ul.products li.product,
    .auto-product-section.layout-4cols ul.products li.product,
    .auto-product-section.layout-5cols ul.products li.product {
        height: 380px !important;
    }
}

/* 移动端统一为2列，覆盖上面的列数定义 */
@media (max-width: 768px) {
    .auto-product-section.layout-3cols ul.products,
    .auto-product-section.layout-4cols ul.products,
    .auto-product-section.layout-5cols ul.products,
    .auto-product-section:not(.layout-3cols):not(.layout-4cols) ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .auto-product-section ul.products li.product {
        height: auto !important;
        min-height: 320px;
    }
}

/* 极窄屏幕（手机小屏）可改为1列（可选） */
@media (max-width: 480px) {
    .auto-product-section.layout-3cols ul.products,
    .auto-product-section.layout-4cols ul.products,
    .auto-product-section.layout-5cols ul.products,
    .auto-product-section:not(.layout-3cols):not(.layout-4cols) ul.products {
        grid-template-columns: 1fr !important;
    }
}

/* 让两个按钮水平排列 */
.woocommerce div.product form.cart {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* 给"直接结算"按钮应用蓝色 + 椭圆形状 */
.woocommerce div.product form.cart a.button.alt {
    background-color: #345DE6;
    border-width: 0;
    color: #ffffff;
    font-family: inherit;
    font-size: inherit;
    font-style: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    line-height: inherit;
    padding: calc(0.667em + 2px) calc(1.333em + 2px);
    text-decoration: none;
    text-transform: inherit;
    cursor: pointer;
    display: inline-block;
    text-align: center;
    transition: background-color 0.2s ease;
    border-radius: 9999px;
}

/* 悬浮时深一点蓝色 */
.woocommerce div.product form.cart a.button.alt:hover {
    background-color: #2563eb;
    color: #ffffff;
}

/* 确保数量输入框垂直居中 */
.woocommerce div.product form.cart .quantity {
    margin: 0;
}

.woocommerce ul.products br {
    display: none;
}
.woocommerce ul.products li.product .button,
.product-section ul.products li.product .button {
    background: var(--wp--preset--color--primary, #2271b1) !important;
    color: #fff !important;
}

/* PC 端固定容器高度 550px，图片填满且不变形（轻微裁剪） */
@media (min-width: 992px) {
    .single-banner-container {
        height: 550px;
        overflow: hidden;
    }
    .single-banner-container img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
    }
}

/* 移动端（小于992px）不做任何强制高度，保持原始自适应 */
@media (max-width: 991px) {
    .single-banner-container {
        height: auto;
    }
    .single-banner-container img {
        height: auto;
        width: 100%;
    }
}

/* 原有 .sec-head-box 升级 */
.sec-head-box {
    background: linear-gradient(90deg, #f0f4ff 0%, #fff 100%);
    padding: 12px 25px;
    border-radius: 50px;
    border-left: 8px solid #345de6;
}
.sec-head-box h2 {
    font-size: 32px !important;
    font-weight: 800 !important;
    position: relative;
    display: inline-block;
}
.sec-head-box h2::before {
    content: "🔥";
    margin-right: 12px;
    font-size: 28px;
}
.sec-head-box a {
    background: #345de6 !important;
    border: none !important;
    box-shadow: 0 5px 12px rgba(52,93,230,0.3);
    transition: 0.2s;
}
.sec-head-box a:hover {
    transform: scale(1.03);
    background: #1e3a8a !important;
}

/* Footer Links - 白色文字 */
body.template-automotive-parts .footer-widgets ul li {
    color: #fff;
    opacity: 1;
    transition: opacity 0.3s;
}
body.template-automotive-parts .footer-widgets ul li:hover {
    opacity: 1;
}
body.template-automotive-parts .footer-widgets ul li a {
    color: #fff !important;
}
body.template-automotive-parts .footer-widgets ul li a:hover {
    color: #6B7280 !important;
}

/* ========== FOOTER 通用修复 ========== */

/* 1. footer 所有文字和链接强制白色 */
.custom-footer-class .footer-box-1 p,
.custom-footer-class .footer-box-3 p,
.custom-footer-class .footer-box-3 li,
.custom-footer-class .footer-box-4 p,
.custom-footer-class .footer-box-4 li {
    color: #ffffff !important;
}
.custom-footer-class .footer-box-3 ul li a,
.custom-footer-class .footer-box-4 ul li a {
    color: #ffffff !important;
}

/* 2. Service clientèle 列表去除圆点 */
.custom-footer-class .footer-box-3 ul {
    list-style: none !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
}
.custom-footer-class .footer-box-3 ul::before,
.custom-footer-class .footer-box-3 ul::after {
    display: none !important;
}

/* 3. Find it Fast 简码区域去除圆点 */
.custom-footer-class .footer-box-2 ul,
.custom-footer-class .footer-box-2 .wp-block-list {
    list-style: none !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
}
.custom-footer-class .footer-box-2 ul li::before,
.custom-footer-class .footer-box-2 .wp-block-list li::before {
    content: none !important;
    display: none !important;
}
.custom-footer-class .footer-box-2 ul::before,
.custom-footer-class .footer-box-2 ul::after,
.custom-footer-class .footer-box-2 .wp-block-list::before,
.custom-footer-class .footer-box-2 .wp-block-list::after {
    display: none !important;
    content: none !important;
}

/* ========== SWIPER 轮播图移动端自适应修复 ========== */
/* 父主题在781px断点设min-height:800px、599px断点设600px，严重过高 */
@media screen and (max-width: 1024px) {
    .banner-image-cover { min-height: 350px !important; }
    .banner-image-cover .wp-block-cover__image-background { width: 100% !important; height: 100% !important; object-fit: cover !important; }
}
@media screen and (max-width: 768px) {
    .wp-block-group.electronics-market-swiper { overflow: hidden; }
    .banner-image-cover { min-height: 250px !important; }
    .banner-image-cover .wp-block-cover__image-background { width: 100% !important; height: 100% !important; object-fit: cover !important; object-position: center center !important; }
    .banner-image-cover .wp-block-cover__inner-container { padding: 15px !important; }
    .electronics-market-swiper-button-prev,
    .electronics-market-swiper-button-next { width: 30px !important; height: 30px !important; margin-top: -15px !important; }
    .electronics-market-swiper-button-prev:after,
    .electronics-market-swiper-button-next:after { font-size: 12px !important; }
    .electronics-market-pagination span.swiper-pagination-bullet { width: 8px !important; height: 8px !important; }
}
@media screen and (max-width: 480px) {
    .banner-image-cover { min-height: 200px !important; }
    .banner-image-cover .wp-block-cover__inner-container { padding: 10px !important; }
    .electronics-market-swiper-button-prev,
    .electronics-market-swiper-button-next { width: 25px !important; height: 25px !important; margin-top: -12px !important; }
    .electronics-market-swiper-button-prev:after,
    .electronics-market-swiper-button-next:after { font-size: 10px !important; }
}
