/*!
 * 自定义产品管理器前端样式 - 轮播重构版本 v4.0.0
 * 彻底重构轮播系统，解决所有已知问题
 * 优化移动端适配，防止溢出
 */

:root {
    --cpm-primary: #2e7d32;
    --cpm-primary-dark: #1b5e20;
    --cpm-secondary: #4caf50;
    --cpm-success: #d4edda;
    --cpm-error: #f8d7da;
    --cpm-bg: #ffffff;
    --cpm-border: #e9ecef;
    --cpm-text: #333333;
    --cpm-text-light: #666666;
    --cpm-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --cpm-radius: 8px;
    --cpm-transition: all 0.3s ease;
}

* {
    max-width: 100vw;
    box-sizing: border-box;
}

img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* 模态框样式 */
.cpm-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.cpm-modal-content {
    background-color: #ffffff;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cpm-modal-header {
    padding: 24px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #2e7d32 0%, #4caf50 100%);
    border-radius: 12px 12px 0 0;
    color: white;
}

.cpm-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.cpm-modal-close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.cpm-modal-close:hover {
    opacity: 1;
}

.cpm-modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.cpm-form-group {
    margin-bottom: 24px;
}

.cpm-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.cpm-form-group input,
.cpm-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
}

.cpm-form-group input:focus,
.cpm-form-group textarea:focus {
    border-color: #2e7d32;
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.cpm-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.cpm-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.cpm-form-actions .btn {
    min-width: 120px;
    margin: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .cpm-modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .cpm-modal-header {
        padding: 20px;
    }
    
    .cpm-modal-body {
        padding: 20px;
    }
    
    .cpm-form-actions {
        flex-direction: column;
    }
    
    .cpm-form-actions .btn {
        min-width: auto;
        width: 100%;
    }
}

/* 表单验证样式 */
.cpm-form-group input:invalid,
.cpm-form-group textarea:invalid {
    border-color: #ff4444;
}

.cpm-form-group input:valid,
.cpm-form-group textarea:valid {
    border-color: #00C851;
}

/* 加载状态 */
.cpm-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2e7d32;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 成功消息 */
.cpm-success-message {
    background: #d4edda;
    color: #155724;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

/* 错误消息 */
.cpm-error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

/* 产品页面样式 */
.custom-product-single {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.product-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.product-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 40px;
}

@media (max-width: 768px) {
    .product-top {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 30px;
    }
}

.product-gallery {
    position: relative;
}

.gallery-main {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: transparent;
    aspect-ratio: 1 / 1;
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    height: 0;
}

.gallery-slides {
    display: flex;
    transition: transform 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.gallery-slide {
    min-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    flex-shrink: 0;
}

.gallery-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.8);
    color: #333;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.3s;
}

.gallery-arrow.prev {
    left: 15px;
}

.gallery-arrow.next {
    right: 15px;
}

.gallery-arrow:hover {
    background: rgba(255,255,255,0.9);
}

.gallery-placeholder {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 2px dashed #e9ecef;
    border-radius: 8px;
}

.placeholder-content {
    text-align: center;
    color: #6c757d;
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

/* 移动端轮播图优化 */
@media (max-width: 768px) {
    .gallery-main {
        padding-bottom: 0;
        height: auto;
        aspect-ratio: unset;
    }
    .gallery-slides {
        position: static;
        height: auto;
        display: block;
        transform: none !important;
    }
    .gallery-slide {
        position: static;
        min-width: 100%;
        display: block;
        margin-bottom: 10px;
    }
    .gallery-image {
        width: 100%;
        height: auto;
        max-height: 400px;
        object-fit: contain;
    }
    .gallery-arrow {
        width: 36px;
        height: 36px;
        font-size: 18px;
        background: rgba(255,255,255,0.9);
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        /* 新增：手机端隐藏轮播箭头 */
        display: none;
    }
}

.product-info {
    padding: 20px 0;
}

.product-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #333;
}

.product-badges {
    margin-bottom: 20px;
}

.product-badge {
    display: inline-block;
    background: #e8f5e8;
    color: #2e7d32;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 8px;
    margin-bottom: 8px;
}

.product-sku {
    font-size: 16px;
    color: #666;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.product-variations {
    margin-bottom: 25px;
}

.variation-group {
    margin-bottom: 20px;
    position: relative;
    transition: all 0.3s ease;
}

.variation-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    transition: color 0.3s ease;
}

.variation-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.variation-option {
    padding: 8px 16px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.variation-option:hover {
    border-color: #2e7d32;
}

.variation-option.active {
    border-color: #2e7d32;
    background: #2e7d32;
    color: white;
}

/* 必需选项组样式 */
.required-variation {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    background: #f9f9f9;
}

.required-variation.not-selected {
    border: 2px solid #ff4444;
    background-color: #fff8f8;
    animation: pulse 1s infinite;
}

.required-variation.not-selected .variation-label {
    color: #ff4444;
    font-weight: bold;
}

.required-variation.not-selected .variation-label:after {
    content: ' *';
    color: #ff4444;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0);
    }
}

.product-quantity {
    margin-bottom: 25px;
}

.product-quantity label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.quantity-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.quantity-input {
    width: 100px;
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    text-align: center;
    font-size: 16px;
}

.min-order {
    color: #666;
    font-size: 14px;
}

.product-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 30px;
}

.cpm-buttons-wrapper,
.cpm-contact-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 200px;
}

.cpm-buttons-wrapper .btn,
.cpm-contact-wrapper .btn {
    width: 100%;
    margin: 0;
}

/* 新按钮颜色 */
.btn-email {
    background-color: #3b82f6;
    color: white;
}
.btn-email:hover {
    background-color: #2563eb;
}
.btn-whatsapp {
    background-color: #25D366;
    color: white;
}
.btn-whatsapp:hover {
    background-color: #128C7E;
}

/* 消息样式 */
.cpm-message-area {
    width: 100%;
    margin-top: 10px;
}

.cpm-message {
    padding: 12px 15px;
    border-radius: 6px;
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.4;
}

.cpm-message-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    animation: slideDown 0.3s ease;
}

.cpm-message-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 按钮禁用状态 */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    text-align: center;
}

.btn-primary {
    background: #2e7d32;
    color: white;
}

.btn-primary:hover {
    background: #1b5e20;
}

.btn-secondary {
    background: #4caf50;
    color: white;
}

.btn-secondary:hover {
    background: #388e3c;
}

.btn-outline {
    background: transparent;
    border: 2px solid #2e7d32;
    color: #2e7d32;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background: #2e7d32;
    color: white;
}

/* ==================== 兼容产品部分 ==================== */
.compatible-products-section {
    margin: 40px 40px 0;
    padding: 30px 0;
    border-top: 1px solid #eaeaea;
    border-bottom: 1px solid #eaeaea;
}

.compatible-products-section h3 {
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

.compatible-products-container {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 50px;
}

/* 当兼容产品数量≤4个时的样式 - 使用flex布局 */
.compatible-products-container.no-carousel {
    padding: 0 !important;
    display: block !important;
}

.compatible-products-container.no-carousel .compatible-products-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 20px !important;
    transform: none !important;
    transition: none !important;
    width: 100% !important;
}

.compatible-products-container.no-carousel .compatible-product {
    flex: 0 0 calc(25% - 15px) !important;
    min-width: calc(25% - 15px) !important;
    opacity: 1 !important;
    transform: none !important;
}

/* 兼容产品轮播样式 */
.compatible-products-grid {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    gap: 20px;
    padding: 10px 0;
}

.compatible-product {
    flex: 0 0 auto;
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-sizing: border-box;
}

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

/* 修复向左缩进问题 - 确保轮播从0位置开始 */
.compatible-products-container:not(.no-carousel) {
    overflow: hidden !important;
    padding: 0 50px !important;
}

.compatible-products-container:not(.no-carousel) .compatible-products-grid {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* 图片容器 */
.compatible-product-image {
    margin-bottom: 10px;
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 6px;
    background: #f8f9fa;
    position: relative;
}

.compatible-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
    will-change: transform;
    aspect-ratio: 1 / 1;
}

.compatible-product:hover .compatible-product-image img {
    transform: scale(1.08);
}

.compatible-product-title {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 14px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    flex-grow: 1;
    min-height: 36px;
}

.compatible-product-sku {
    font-size: 12px;
    color: #666;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 兼容产品导航箭头 - 完全独立样式 */
.compatible-nav {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 2px solid rgba(46, 125, 50, 0.2) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    font-size: 20px;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.7);
    opacity: 0;
}

.compatible-nav:hover {
    background: rgba(46, 125, 50, 0.1) !important;
    border-color: #2e7d32 !important;
    transform: translateY(-50%) scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.2) !important;
    opacity: 1 !important;
}

.compatible-products-container:hover .compatible-nav {
    opacity: 1;
}

.compatible-nav.prev {
    left: 0;
}

.compatible-nav.next {
    right: 0;
}

/* 当没有轮播时隐藏导航箭头 */
.compatible-products-container.no-carousel .compatible-nav {
    display: none !important;
}

/* 兼容产品循环轮播克隆元素 */
.carousel-clone {
    opacity: 0.7;
    pointer-events: none;
    filter: grayscale(20%);
}

/* 移动端兼容产品优化 */
@media (max-width: 768px) {
    .compatible-products-container {
        padding: 0 20px !important;
    }
    .compatible-product {
        flex: 0 0 calc(50% - 10px) !important;
        min-width: calc(50% - 10px) !important;
        margin-bottom: 15px;
    }
    .compatible-product-image {
        height: 150px;
        aspect-ratio: 1 / 1;
    }
    .compatible-product-title {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }
    .compatible-products-container.no-carousel .compatible-product {
        flex: 0 0 calc(50% - 10px) !important;
        min-width: calc(50% - 10px) !important;
    }
    .compatible-nav {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .compatible-products-container {
        padding: 0 15px !important;
    }
    .compatible-product {
        flex: 0 0 calc(100% - 10px) !important;
        min-width: calc(100% - 10px) !important;
    }
    .compatible-products-container.no-carousel .compatible-product {
        flex: 0 0 100% !important;
        min-width: 100% !important;
    }
}

/* ==================== 相关产品部分 ==================== */
.related-products {
    margin: 40px;
    padding: 30px 0;
    border-top: 1px solid #eaeaea;
}

.related-products h3 {
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

.related-grid-container {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 50px;
    overflow: hidden;
}

/* 当相关产品数量≤4个时的样式 - 使用flex布局 */
.related-grid-container.no-carousel {
    padding: 0 !important;
}

.related-grid-container.no-carousel .related-products-slider {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 20px !important;
    overflow: visible !important;
    transform: none !important;
    transition: none !important;
}

.related-grid-container.no-carousel .related-product-card {
    flex: 0 0 calc(25% - 15px) !important;
    min-width: calc(25% - 15px) !important;
    opacity: 1 !important;
}

/* 相关产品轮播样式 */
.related-products-slider {
    display: flex;
    width: 100%;
    gap: 20px;
    padding: 10px 0;
    transition: transform 0.4s ease;
}

.related-product-card {
    flex: 0 0 auto;
    width: 280px;
    height: 380px;
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.related-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.related-product-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.related-product-image {
    margin-bottom: 10px;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 6px;
    background: #f8f9fa;
}

.related-product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.related-product-card:hover .related-product-img {
    transform: scale(1.05);
}

.related-product-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    color: #666;
}

.related-product-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.related-product-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    flex-grow: 1;
}

.related-product-sku {
    font-size: 14px;
    color: #666;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: auto;
}

/* 相关产品导航箭头 - 完全独立样式 */
.related-nav {
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(221, 221, 221, 0.3);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    font-size: 20px;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    opacity: 0;
}

.related-nav:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: #2e7d32;
    color: #2e7d32;
    opacity: 1;
}

.related-grid-container:hover .related-nav {
    opacity: 1;
}

.related-nav.prev {
    left: 0;
}

.related-nav.next {
    right: 0;
}

/* 当没有轮播时隐藏导航箭头 */
.related-grid-container.no-carousel .related-nav {
    display: none !important;
}

.related-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.related-nav:disabled:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(221, 221, 221, 0.3);
    color: rgba(0, 0, 0, 0.7);
    transform: translateY(-50%);
}

/* 相关产品循环轮播克隆元素 */
.carousel-clone {
    opacity: 0.7;
    pointer-events: none;
    filter: grayscale(20%);
}

/* ==================== 响应式设计 ==================== */

/* 兼容产品响应式已在上面 */
/* 相关产品响应式 */
@media (max-width: 1200px) {
    .related-product-card {
        flex: 0 0 240px;
        width: 240px;
        height: 350px;
    }
    
    .related-grid-container.no-carousel .related-product-card {
        flex: 0 0 calc(33.333% - 15px) !important;
        min-width: calc(33.333% - 15px) !important;
    }
    
    .related-product-image {
        height: 240px;
    }
}

@media (max-width: 992px) {
    .related-products {
        margin: 25px;
        padding: 25px 0;
    }
    
    .related-grid-container {
        padding: 0 40px;
    }
    
    .related-nav {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

@media (max-width: 768px) {
    .custom-product-single {
        padding: 10px;
    }
    
    .related-products {
        margin: 20px;
        padding: 20px 0;
    }
    
    .related-grid-container {
        padding: 0 35px;
    }
    
    .related-product-card {
        flex: 0 0 220px;
        width: 220px;
        height: 340px;
    }
    
    .related-grid-container.no-carousel .related-product-card {
        flex: 0 0 calc(50% - 15px) !important;
        min-width: calc(50% - 15px) !important;
    }
    
    .related-product-image {
        height: 220px;
    }
    
    .related-nav {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .cpm-baskets-sidebar {
        display: none;
    }
    
    .cpm-basket-panel {
        width: 320px;
        right: -320px;
    }
}

@media (max-width: 576px) {
    .related-grid-container {
        padding: 0 30px;
    }
    
    .related-product-card {
        flex: 0 0 100%;
        width: 100%;
        height: auto;
    }
    
    .related-grid-container.no-carousel .related-product-card {
        flex: 0 0 100% !important;
        min-width: 100% !important;
    }
    
    .related-product-image {
        height: 220px;
    }
    
    .related-nav {
        width: 35px;
        height: 35px;
        font-size: 14px;
        opacity: 0.8;
    }
}

/* 规格部分样式 */
.specifications-section {
    margin: 40px;
    padding: 0;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 40px;
}

.specifications-container {
    padding: 30px 0;
    max-width: 1200px;
    margin: 0 auto;
}

.specifications-title {
    font-size: 28px;
    margin-bottom: 30px;
    color: #333;
    text-align: center;
    display: block;
    padding-bottom: 15px;
    border-bottom: 2px solid #2e7d32;
}

.specifications-table-wrapper {
    overflow-x: auto;
	 overflow-y: visible;   /* 确保垂直方向不裁剪 */
    max-width: 1200px;
    margin: 0 auto;
}

.spec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
    border-radius: 8px;
    overflow: visible;      /* 关键：不裁剪内容 */
    height: auto;           /* 根据内容自动撑开 */
}

.spec-table th,
.spec-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #ddd;
    width: 25%;
    text-align: left;
}

.spec-table th {
    background-color: #f7f7f7;
    font-weight: 600;
    color: #222;
    border-right: 1px solid #e0e0e0;
}

.spec-table td {
    color: #555;
    background-color: #fff;
    border-right: 1px solid #f0f0f0;
}

.spec-table tr:hover {
    background-color: #f9f9f9;
}

/* 隐藏行：使用 spec-hidden 类控制（不再使用 nth-child） */
.spec-table tr.spec-hidden {
    display: none;
}

.spec-table tr.spec-visible {
    display: table-row;
}

.specifications-load-more {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

/* 移动端规格表优化 */
@media (max-width: 768px) {
    .specifications-table-wrapper {
        overflow-x: auto;
    }
    .spec-table,
    .spec-table tbody,
    .spec-table tr,
    .spec-table th,
    .spec-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    .spec-table tr {
        margin-bottom: 15px;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        padding: 10px;
    }
    .spec-table th,
    .spec-table td {
        border: none;
        padding: 6px 10px;
        text-align: left;
        width: auto;
    }
    .spec-table th {
        background-color: transparent;
        font-weight: 700;
        color: #2e7d32;
        padding-bottom: 0;
    }
    .spec-table td {
        padding-top: 0;
        word-break: break-word;
    }
    /* 移动端也使用 spec-hidden 控制隐藏 */
    .spec-table tr.spec-hidden {
        display: none;
    }
    .spec-table tr.spec-visible {
        display: block;
    }
    /* 移动端隐藏 Load More 按钮（可按需保留，此处按原逻辑） */
    #load-more-specs {
        display: inline-block;
    }
}

/* 产品详情样式 */
.product-description-section {
    margin: 40px;
    padding: 40px 0;
    border-bottom: 1px solid #e9ecef;
}

.product-description-section h3 {
    font-size: 28px;
    margin-bottom: 30px;
    color: #333;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #2e7d32;
}

.product-description {
    max-width: 1200px;
    margin: 0 auto;
    line-height: 1.6;
    color: #555;
}

.product-description ul {
    padding-left: 40px !important;
    margin: 15px 0 !important;
    list-style-type: disc !important;
}

.product-description ol {
    padding-left: 40px !important;
    margin: 15px 0 !important;
    list-style-type: decimal !important;
}

.product-description li {
    margin-bottom: 8px !important;
    line-height: 1.6 !important;
    display: list-item !important;
}

.product-description ul ul {
    list-style-type: circle !important;
    margin: 8px 0 !important;
}

.product-description ol ol {
    list-style-type: lower-alpha !important;
    margin: 8px 0 !important;
}

.product-description li p {
    display: inline;
    margin: 0;
}

/* MOQ显示样式 */
.selected-variation-moq {
    background: #e8f5e8;
    border: 1px solid #c8e6c9;
    border-radius: 6px;
    padding: 12px 15px;
    margin-top: 15px;
    font-size: 14px;
}

.selected-variation-moq strong {
    color: #2e7d32;
}

#current-moq-display {
    color: #d32f2f;
    font-weight: bold;
    margin-left: 5px;
}

/* 归档页面样式 */
.page {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 32px;
    padding: 40px;
    max-width: 1400px;
    margin: auto;
}

.sidebar {
    position: sticky;
    top: 20px;
    align-self: start;
    height: fit-content;
    background: #f9faf9;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    padding: 20px;
}

.sidebar h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #0a7d3b;
}

.nav-group {
    margin-bottom: 12px;
}

.nav-item {
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s, color .2s;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
}

.nav-item:hover {
    background: #e8f5ec;
}

.nav-item.active {
    background: #0a7d3b;
    color: #fff;
    font-weight: 600;
}

.sub-item {
    padding-left: 16px;
    font-size: 14px;
    color: #555;
}

.main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.header {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #0a7d3b;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
}

.archive-description {
    color: #666;
    line-height: 1.6;
}

.search {
    display: flex;
    gap: 10px;
}

.search input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
}

.search button {
    padding: 10px 18px;
    background: #0a7d3b;
    color: #fff;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s;
    font-family: inherit;
}

.search button:hover {
    background: #096a32;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.filters select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.card {
    position: relative;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 16px;
    background: #fff;
    box-shadow: 0 0 0 rgba(0,0,0,0);
    transition: transform .3s, box-shadow .3s, opacity .6s ease;
    overflow: hidden;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
}

.card h4 {
    margin-top: 10px;
    font-size: 16px;
    color: #111;
}

.card p {
    font-size: 14px;
    color: #555;
    margin-top: 4px;
}

.badge {
    display: inline-block;
    margin-top: 6px;
    background: #e8f5ec;
    color: #0a7d3b;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 999px;
}

.view-btn {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10,125,59,0.85);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    opacity: 0;
    transition: opacity .3s;
    cursor: pointer;
    text-decoration: none;
}

.card:hover .view-btn {
    opacity: 1;
}

.load-more {
    text-align: center;
    margin-top: 20px;
}

.load-more button {
    padding: 12px 24px;
    border: 1px solid #0a7d3b;
    background: #fff;
    color: #0a7d3b;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all .2s;
    font-family: inherit;
}

.load-more button:hover {
    background: #0a7d3b;
    color: #fff;
}

#backTop {
    position: fixed;
    right: 30px;
    bottom: 30px;
    background: #0a7d3b;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity .3s;
    font-family: inherit;
}

#backTop.show {
    opacity: 1;
}

/* 篮子样式 */
.cpm-baskets-sidebar {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cpm-basket-toggle {
    background: linear-gradient(135deg, #2e7d32 0%, #4caf50 100%);
    color: white;
    border: none;
    padding: 16px 12px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    cursor: pointer;
    border-radius: 12px 0 0 12px;
    font-weight: 600;
    transition: all 0.4s ease;
    box-shadow: 0 4px 20px rgba(46, 125, 50, 0.3);
    position: relative;
    overflow: hidden;
    font-size: 14px;
    letter-spacing: 1px;
}

.cpm-basket-toggle:hover {
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
}

.cpm-basket-toggle[data-basket="sample"] {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.3);
}

.cpm-basket-toggle[data-basket="sample"]:hover {
    background: linear-gradient(135deg, #388e3c 0%, #4caf50 100%);
}

.cpm-basket-panel {
    position: absolute;
    right: -380px;
    top: 0;
    width: 380px;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 16px 0 0 16px;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
    transition: right 0.5s ease;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.cpm-basket-panel.open {
    right: 0;
}

.cpm-basket-header {
    background: linear-gradient(135deg, #2e7d32 0%, #4caf50 100%);
    padding: 20px 24px;
    border-radius: 16px 0 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.cpm-basket-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><path d="M0,0 L100,0 L100,100 Z" fill="rgba(255,255,255,0.1)"/></svg>');
    background-size: cover;
}

.cpm-basket-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.cpm-basket-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.cpm-basket-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.cpm-basket-content {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    background: rgba(248, 250, 252, 0.8);
}

.cpm-basket-content::-webkit-scrollbar {
    width: 6px;
}

.cpm-basket-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.cpm-basket-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.cpm-basket-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.cpm-basket-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: white;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #f1f5f9;
}

.cpm-basket-item:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    border-color: #e2e8f0;
}

.cpm-basket-item:last-child {
    margin-bottom: 0;
}

.cpm-basket-item-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 16px;
    flex-shrink: 0;
    border: 2px solid #f8fafc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
}

.cpm-basket-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.basket-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    color: #666;
}

.cpm-basket-item-info {
    flex: 1;
    min-width: 0;
}

.cpm-basket-item-title {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cpm-basket-item-sku {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}

.cpm-basket-item-quantity {
    font-size: 12px;
    color: #475569;
    font-weight: 500;
}

.cpm-basket-item-actions {
    display: flex;
    gap: 8px;
    margin-left: 12px;
}

.cpm-remove-item {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.cpm-remove-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.cpm-basket-empty {
    text-align: center;
    color: #64748b;
    padding: 40px 20px;
    font-style: italic;
    background: white;
    border-radius: 12px;
    border: 2px dashed #e2e8f0;
}

.cpm-basket-empty::before {
    content: '🛒';
    font-size: 32px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.6;
}

.cpm-basket-footer {
    padding: 20px 24px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 12px;
    background: white;
    border-radius: 0 0 0 16px;
}

.cpm-basket-footer button {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cpm-basket-footer button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cpm-basket-footer button:hover::before {
    opacity: 1;
}

.cpm-basket-footer button[data-action="clear"] {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.cpm-basket-footer button[data-action="clear"]:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 移动端产品操作区域适配 */
@media (max-width: 768px) {
    .product-actions {
        flex-direction: column;
    }
    .cpm-buttons-wrapper,
    .cpm-contact-wrapper {
        width: 100%;
    }
}