/*
Theme Name: qianhang Shop Theme
Version: 1.0
*/
*{margin:0;padding:0;box-sizing:border-box;}
body{font-family:'Segoe UI',Roboto,sans-serif;background:#f8fafc;color:#1e293b;line-height:1.5;}
.container{max-width:1280px;margin:0 auto;padding:0 24px;}
.site-header{background:#fff;border-bottom:1px solid #eef2f6;padding:16px 0;margin-bottom:20px;}
.header-container{display:flex;justify-content:space-between;align-items:center;}
.logo a{font-size:1.5rem;font-weight:700;text-decoration:none;color:#1e2a3a;}
.main-nav .nav-menu{display:flex;list-style:none;gap:28px;}
.main-nav .nav-menu li a{text-decoration:none;color:#4a627a;font-weight:500;}
.site-footer{text-align:center;padding:30px 0;background:#f8fafc;color:#6c7e97;margin-top:60px;}
.hero{text-align:center;padding:80px 20px 60px;background:linear-gradient(135deg,#0a2540 0%,#1f4a6e 100%);color:#fff;}
.company{font-size:3rem;font-weight:800;margin-bottom:15px;}
.tagline{font-size:1.4rem;margin-bottom:30px;}
.btn-shop{display:inline-block;background:#fff;color:#0a2540;padding:12px 36px;border-radius:40px;text-decoration:none;font-weight:600;}
.features-list{display:flex;flex-wrap:wrap;justify-content:center;gap:30px;background:#f8fafc;padding:18px 30px;border-radius:50px;margin:30px 0;}
.products-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:30px;margin:60px 0;}
.product-card{background:#fff;border-radius:20px;padding:20px;text-align:center;box-shadow:0 2px 8px rgba(0,0,0,0.04);border:1px solid #eef2f6;transition:0.25s;}
.product-card img{width:100%;border-radius:16px;margin-bottom:15px;aspect-ratio:1/1;object-fit:cover;}
.product-card h3{font-size:1rem;margin:10px 0;}
.product-card .price{font-weight:700;color:#0a2540;display:block;margin:12px 0;}
.add-to-cart{display:inline-block;background:#0a2540;color:#fff;padding:6px 18px;border-radius:30px;text-decoration:none;font-size:0.85rem;}
.about{text-align:center;padding:60px 20px;max-width:900px;margin:0 auto;}
.cta{background:#f1f5f9;border-radius:32px;margin:60px 0 70px;padding:60px 30px;text-align:center;}
.btn-contact{background:#0a2540;color:#fff;padding:12px 32px;border-radius:40px;text-decoration:none;display:inline-block;}
.blog-layout{display:flex;gap:40px;max-width:1280px;margin:0 auto;}
.blog-content{flex:2.5;}
.blog-sidebar{flex:1.2;}
.blog-sidebar .widget{background:#fff;border-radius:24px;padding:20px 24px;margin-bottom:30px;box-shadow:0 4px 12px rgba(0,0,0,0.04);border:1px solid #eef2f6;}
.blog-sidebar .widget-title{font-size:1.2rem;border-left:4px solid #f5b042;padding-left:14px;margin-bottom:15px;}
.related.products ul.products{display:flex;flex-wrap:wrap;justify-content:space-between;margin:0;padding:0;list-style:none;}
.related.products ul.products li.product{width:calc(33.33% - 20px);margin:0 0 20px;flex:0 0 auto;}
.related.products ul.products li.product img{width:100%;aspect-ratio:1/1;object-fit:cover;}
.related.products ul.products li.product .woocommerce-loop-product__title{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;}
@media (max-width:768px){.products-grid{grid-template-columns:repeat(2,1fr);}.blog-layout{flex-direction:column;}.related.products ul.products li.product{width:calc(50% - 15px);}}
@media (max-width:480px){.products-grid{grid-template-columns:1fr;}.related.products ul.products li.product{width:100%;}}

/* 产品图库缩略图样式：增加上边距，美化缩略图 */
.woocommerce-product-gallery {
    position: relative;
}
.woocommerce-product-gallery .flex-control-nav {
    margin-top: 25px !important;
    text-align: center;
}
.woocommerce-product-gallery .flex-control-nav li {
    display: inline-block;
    margin: 0 8px !important;
    width: 80px;
    cursor: pointer;
}
.woocommerce-product-gallery .flex-control-nav li img {
    width: 100%;
    border-radius: 8px;
    border: 2px solid #eef2f6;
    transition: 0.2s;
}
.woocommerce-product-gallery .flex-control-nav li img.flex-active,
.woocommerce-product-gallery .flex-control-nav li img:hover {
    border-color: #f5b042;
}
@media (max-width: 768px) {
    .woocommerce-product-gallery .flex-control-nav li {
        width: 60px;
        margin: 0 5px;
    }
}

/* 产品详情页图库样式 */
.product-gallery {
    margin-bottom: 20px;
}
.product-gallery .main-image {
    margin-bottom: 20px; /* 主图与缩略图间距 */
}
.product-gallery .main-image img {
    width: 100%;
    height: auto;
    border-radius: 12px;
}
.product-gallery .thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-start;
}
.product-gallery .thumbnail {
    width: 80px;
    cursor: pointer;
    border: 1px solid #eef2f6;
    border-radius: 6px;
    transition: 0.2s;
}
.product-gallery .thumbnail:hover {
    border-color: #f5b042;
}
.product-gallery .thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}
@media (max-width: 768px) {
    .product-gallery .thumbnail {
        width: 60px;
    }
}

/* ========== 产品详情页美化（强制覆盖） ========== */
.product-detail-wrapper {
    display: flex;
    gap: 50px;
    margin: 40px 0;
    background: #fff;
    border-radius: 32px;
    padding: 30px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.05);
}
.product-gallery {
    flex: 1;
}
.main-image img {
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.thumbnails {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}
.thumbnail {
    width: 80px;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid #eef2f6;
    transition: 0.2s;
}
.thumbnail:hover {
    border-color: #f5b042;
}
.product-summary {
    flex: 1;
}
.product-summary h1 {
    font-size: 2rem;
    margin-bottom: 16px;
    color: #0a2540;
}
.price {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0a2540;
    margin-bottom: 20px;
}
.short-description {
    color: #4a627a;
    line-height: 1.6;
    margin-bottom: 20px;
}
.cart {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}
.quantity .qty {
    width: 70px;
    padding: 10px;
    border-radius: 40px;
    border: 1px solid #dce3ec;
}
.single_add_to_cart_button {
    background: #0a2540;
    color: white;
    padding: 12px 28px;
    border-radius: 40px;
    font-weight: 600;
    transition: 0.2s;
}
.single_add_to_cart_button:hover {
    background: #1f4a6e;
    transform: translateY(-2px);
}
.product_meta {
    font-size: 0.9rem;
    color: #5f7f9e;
    border-top: 1px solid #eef2f6;
    padding-top: 15px;
    margin-top: 15px;
}
.woocommerce-tabs {
    background: #fff;
    border-radius: 32px;
    padding: 30px;
    margin: 40px 0;
}
.woocommerce-tabs .tabs {
    display: flex;
    gap: 30px;
    border-bottom: 2px solid #eef2f6;
    margin-bottom: 25px;
}
.woocommerce-tabs .tabs li a {
    display: inline-block;
    padding: 10px 0;
    font-weight: 600;
    color: #4a627a;
    text-decoration: none;
}
.woocommerce-tabs .tabs li.active a {
    color: #0a2540;
    border-bottom: 3px solid #f5b042;
}
.related.products {
    margin-top: 60px;
}
.related.products h2 {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 30px;
}
.related.products ul.products {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}
.related.products ul.products li.product {
    background: #fff;
    border-radius: 24px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    transition: 0.25s;
}
.related.products ul.products li.product:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}
.related.products ul.products li.product img {
    border-radius: 20px;
    margin-bottom: 15px;
}
.related.products ul.products li.product .button {
    background: #0a2540;
    color: white;
    padding: 8px 20px;
    border-radius: 40px;
    font-size: 0.85rem;
}
@media (max-width: 768px) {
    .product-detail-wrapper {
        flex-direction: column;
    }
    .related.products ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}
@media (max-width: 480px) {
    .related.products ul.products {
        grid-template-columns: 1fr;
    }
}

/* 强制相关产品卡片固定宽高，标题不溢出 */
.related.products ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 25px !important;
    margin: 0 !important;
    padding: 0 !important;
}
.related.products ul.products li.product {
    width: auto !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}
.related.products ul.products li.product img {
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
    border-radius: 16px;
    margin-bottom: 15px;
}
.related.products ul.products li.product .woocommerce-loop-product__title {
    font-size: 0.95rem !important;
    font-weight: 600;
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 8px;
}
.related.products ul.products li.product .price {
    font-size: 1rem;
    margin: 8px 0;
}
.related.products ul.products li.product .button {
    margin-top: auto;
    background: #0a2540;
    color: white;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.8rem;
    text-align: center;
}
@media (max-width: 768px) {
    .related.products ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }
}
@media (max-width: 480px) {
    .related.products ul.products {
        grid-template-columns: 1fr !important;
    }
}

/* ========== 强制修复相关产品区域（覆盖所有继承） ========== */
.related.products ul.products,
.woocommerce-page .related.products ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(160px, 1fr)) !important;
    gap: 20px !important;
    margin: 30px 0 !important;
    padding: 0 !important;
}
.related.products ul.products li.product {
    width: auto !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    background: #fff;
    border-radius: 16px;
    padding: 15px;
    border: 1px solid #eef2f6;
}
.related.products ul.products li.product img {
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
    border-radius: 12px;
    margin-bottom: 10px;
}
.related.products ul.products li.product .woocommerce-loop-product__title {
    font-size: 0.9rem !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    line-height: 1.3 !important;
    min-height: 2.4em;
}
.related.products ul.products li.product .price {
    margin: 5px 0 !important;
}
.related.products ul.products li.product .button {
    margin-top: auto !important;
    background: #0a2540;
    color: white;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.75rem;
    text-align: center;
}
@media (max-width: 768px) {
    .related.products ul.products,
    .woocommerce-page .related.products ul.products {
        grid-template-columns: repeat(2, minmax(140px, 1fr)) !important;
    }
}
@media (max-width: 480px) {
    .related.products ul.products,
    .woocommerce-page .related.products ul.products {
        grid-template-columns: 1fr !important;
    }
}

/* ========== 固定产品主图比例，防止变形 ========== */
.product-gallery .main-image {
    position: relative;
    width: 100%;
    overflow: hidden;
}
.product-gallery .main-image img {
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: contain !important;
    background-color: #f8fafc;
    border-radius: 16px;
}
/* 如果希望图片填满正方形且裁剪，请将 object-fit 改为 cover */

/* 首页产品网格：防止标题撑大卡片 */
.products-grid .product-card {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
}
.products-grid .product-card img {
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
    margin-bottom: 12px;
}
.products-grid .product-card h3 {
    font-size: 0.95rem !important;
    line-height: 1.3 !important;
    margin: 8px 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    min-height: 2.4em;
}
.products-grid .product-card .price {
    font-size: 1rem;
    margin: 6px 0;
}
.products-grid .product-card .add-to-cart {
    margin-top: auto;
}
