/* 产品详情页专用样式 */

/* ============================
   产品图片画廊样式
   ============================ */
.product-gallery {
    padding: 0 !important;
}

/* 产品信息区域对齐样式 */
.product-info-card {
    padding-left: 0 !important;
}

/* 产品页面布局优化 */
.product-row {
    align-items: flex-start;
}

.product-column {
    display: block;
}

.product-column .card-custom {
    height: auto;
}

/* 价格区域样式 */
.price-section {
    display: flex;
    align-items: baseline;
    /* gap: 12px; */
}

.original-price {
    text-decoration: line-through;
    font-size: 18px;
    font-weight: 500;
}

/* 购买数量区域样式 */
.quantity-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.quantity-section h5 {
    margin: 0;
    line-height: 40px;
    /* 与组件高度保持一致 */
}

/* 购买数量选择器样式 */
.quantity-selector {
    display: flex;
    align-items: center;
    gap: 0;
    width: fit-content;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.quantity-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #f8f9fa;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.quantity-btn:hover {
    background: var(--primary-color);
    color: white;
}

.quantity-btn:disabled {
    background: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
}

.quantity-input {
    width: 60px;
    height: 40px;
    border: none;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    background: white;
    color: var(--text-primary);
    outline: none;
    line-height: 40px;
    /* 确保垂直居中 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-input:focus {
    outline: none;
    box-shadow: none;
}

/* 产品特性和服务保障样式 */
.product-features,
.service-guarantee {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.feature-item,
.guarantee-item {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.feature-item i,
.guarantee-item i {
    font-size: 16px;
    width: 20px;
}

.product-features h6,
.service-guarantee h6 {
    color: var(--text-primary);
    font-weight: 600;
}

/* ============================
   图片画廊和缩略图样式
   ============================ */
.main-image-container {
    position: relative;
    overflow: hidden;
    margin-bottom: 10px;
    border-top-right-radius: 12px;
    border-top-left-radius: 12px;
}

.main-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    cursor: crosshair;
    transition: transform 0.3s ease;
}

.magnifier {
    position: absolute;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: none;
    pointer-events: none;
    opacity: 0;
    width: 150px;
    height: 150px;
    background-repeat: no-repeat;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease;
}

.thumbnail-container {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.thumbnail-scroll {
    display: flex;
    gap: 10px;
    transition: transform 0.3s ease;
    /* 设置足够的宽度来容纳所有缩略图 */
    width: calc(6 * 80px + 5 * 10px);
    /* 6张图片的总宽度 */
}

/* 为缩略图容器添加一个视窗包装器 */
.thumbnail-viewport {
    overflow: hidden;
    width: calc(5 * 80px + 4 * 10px);
    /* 只显示5张缩略图的窗口 */
}

.thumbnail-wrapper {
    flex-shrink: 0;
    width: 80px;
}

.thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.thumbnail:hover {
    border-color: var(--primary-color);
    opacity: 0.8;
}

.thumbnail.active {
    border-color: var(--primary-color);
}

.thumbnail-nav {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
    position: relative;
    flex-shrink: 0;
}

.thumbnail-nav:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.thumbnail-nav:disabled,
.thumbnail-nav[style*="opacity: 0.5"] {
    pointer-events: none;
}

.thumbnail-nav[style*="opacity: 0.5"]:hover {
    background: white;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

/* 颜色选择按钮样式 */
.color-option {
    border-color: #ddd !important;
    color: #999 !important;
    background-color: #f8f9fa !important;
}

.color-option.active {
    background-color: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
}

.color-option:hover {
    background-color: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
}

/* 产品详情图片样式 */
.detail-img {
    width: 100%;
    height: auto;
    /* border-radius: 8px; */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.detail-image {
    margin-bottom: 0 !important;
}

/* ============================
   PC端样式
   ============================ */
/* PC端确保缩略图正常显示 */
@media (min-width: 768px) {
    .page-container {
        padding: 20px;
    }

    .thumbnail-container {
        display: flex !important;
        margin: 12px 0 !important;
    }

    .main-image {
        height: 400px !important;
        border-radius: 12px 12px 0 0 !important;
        cursor: crosshair !important;
    }

    .main-image-container {
        border-radius: 0 !important;
        margin-bottom: 0 !important;
    }

    .product-gallery {
        padding: 0 !important;
        border-radius: 12px !important;
        margin: 0 0 20px 0 !important;
    }

    /* 确保PC端不会触发移动端模态框 */
    .main-image {
        cursor: crosshair !important;
    }

    /* PC端保持原有的商品信息布局顺序 */
    .product-info-container {
        display: block !important;
    }

    .product-price-section {
        order: unset !important;
        margin-bottom: 24px !important;
    }

    .product-title-section {
        order: unset !important;
        margin-bottom: 0 !important;
    }

    .product-title-section h1 {
        margin-bottom: 16px !important;
    }

    .product-title-section p {
        margin-bottom: 24px !important;
    }
    .product-info-container {
        display: block !important;
    }

    .product-price-section {
        order: unset !important;
        margin-bottom: 0 !important;
    }

    .product-title-section {
        order: unset !important;
        margin-bottom: 24px !important;
    }

    .product-title-section h1 {
        margin-bottom: 16px !important;
    }

    .product-title-section p {
        margin-bottom: 24px !important;
    }
}
 
/* ============================
   移动端专用样式
   ============================ */
@media (max-width: 767px) {
    .page-container {
        padding: 0px;
    }
    
    /* 隐藏桌面版元素 */
    .desktop-only {
        display: none !important;
    }

    /* 产品图片轮播 */
    .product-gallery {
        margin-left: -15px !important;
        margin-right: -15px !important;
        margin-top: -24px !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }

    .main-image-container {
        border-radius: 0 !important;
        margin-bottom: 0 !important;
    }

    .main-image {
        border-radius: 0 !important;
        height: 350px !important;
        width: 100% !important;
        object-fit: cover !important;
        cursor: pointer !important;
    }

    /* 缩略图容器在移动端已通过HTML类控制隐藏 */

    /* 轮播指示器 */
    .carousel-indicators {
        position: absolute;
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        gap: 8px;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .carousel-indicator {
        width: 8px;
        height: 8px;
        background: rgba(255, 255, 255, 0.5);
        border-radius: 50%;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .carousel-indicator.active {
        background: white;
        transform: scale(1.2);
    }

    /* 移动端商品信息区域 */
    .product-column .card-custom {
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 20px !important;
    }

    /* 移动端主图隐藏padding */
    .product-column .card-custom.mobile-main-image {
        padding: 0px !important;
    }

    /* 移动端商品信息容器使用flex布局 */
    .product-info-container {
        display: flex !important;
        flex-direction: column !important;
    }

    /* 移动端价格区域排序到最前 */
    .product-price-section {
        order: 1 !important;
        margin-bottom: 20px !important;
    }

    /* 移动端标题区域排序到第二 */
    .product-title-section {
        order: 2 !important;
        margin-bottom: 20px !important;
    }

    /* 移动端底部固定按钮栏 */
    .mobile-bottom-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid var(--border-color);
        padding: 12px 16px;
        display: flex;
        align-items: center;
        gap: 12px;
        z-index: 1000;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    }

    .bottom-actions {
        display: flex;
        gap: 0px;
    }

    .action-btn {
        background: none;
        border: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 42px;
        color: var(--text-secondary);
        font-size: 12px;
        cursor: pointer;
        transition: color 0.3s ease;
    }

    .action-btn i {
        font-size: 18px;
        margin-bottom: 2px;
    }

    .action-btn:hover {
        color: var(--primary-color);
    }

    .purchase-buttons {
        flex: 1;
        display: flex;
        gap: 8px;
    }

    .btn-add-cart {
        flex: 1;
        background: var(--primary-color);
        color: white;
        border: none;
        border-radius: 6px;
        padding: 12px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: background 0.3s ease;
    }

    .btn-add-cart:hover {
        background: #e55a00;
    }

    .btn-buy-now {
        flex: 1;
        background: #dc3545;
        color: white;
        border: none;
        border-radius: 6px;
        padding: 12px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: background 0.3s ease;
    }

    .btn-buy-now:hover {
        background: #c82333;
    }

    /* 移动端分享弹框 */
    .share-modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        z-index: 9999;
        display: none;
    }

    .share-modal.show {
        display: flex;
        align-items: flex-end;
    }

    .share-modal .modal-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
    }

    .share-modal-content {
        position: relative;
        width: 100%;
        background: white;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .share-modal.show .share-modal-content {
        transform: translateY(0);
    }

    .share-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px 20px 16px 20px;
        border-bottom: 1px solid var(--border-color);
    }

    .share-header h6 {
        margin: 0;
        font-weight: 600;
        font-size: 16px;
    }

    .share-close {
        background: none;
        border: none;
        width: 24px;
        height: 24px;
        color: var(--text-secondary);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .share-options {
        display: flex;
        justify-content: space-around;
        padding: 24px 20px;
        gap: 20px;
    }

    .share-option {
        background: none;
        border: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        cursor: pointer;
        flex: 1;
        transition: transform 0.2s ease;
    }

    .share-option:active {
        transform: scale(0.95);
    }

    .share-icon {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--primary-color);
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 8px;
        transition: background 0.3s ease;
    }

    .share-icon i {
        font-size: 24px;
        color: white;
    }

    .share-icon.moments {
        background: #07c160;
    }

    .share-icon.copy {
        background: #1485ee;
    }

    .share-option span {
        font-size: 14px;
        color: var(--text-primary);
        font-weight: 500;
    }

    /* 移动端产品规格选择弹框 */
    .spec-modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        z-index: 9999;
        display: none;
    }

    .spec-modal.show {
        display: flex;
        align-items: flex-end;
    }

    .spec-modal .modal-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
    }

    .spec-modal-content {
        position: relative;
        width: 100%;
        background: white;
        border-radius: 16px 16px 0 0;
        max-height: 70vh;
        display: flex;
        flex-direction: column;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }

    .spec-modal.show .spec-modal-content {
        transform: translateY(0);
    }

    .spec-header {
        padding: 16px;
        border-bottom: 1px solid var(--border-color);
    }

    .spec-product-info {
        display: flex;
        gap: 12px;
        align-items: flex-start;
        position: relative;
    }

    .spec-product-image {
        width: 80px;
        height: 80px;
        object-fit: cover;
        border-radius: 8px;
    }

    .spec-product-details {
        flex: 1;
    }

    .spec-price-section {
        display: flex;
        align-items: baseline;
        gap: 10px;
        margin-bottom: 6px;
    }

    .spec-price {
        font-size: 20px;
        font-weight: 700;
        color: var(--primary-color);
        line-height: 1;
    }

    .spec-original-price {
        font-size: 15px;
        font-weight: 500;
        color: #aaa;
        text-decoration: line-through;
        line-height: 1;
        opacity: 0.8;
    }

    .spec-stock {
        font-size: 14px;
        color: var(--text-secondary);
        margin-bottom: 4px;
    }

    .spec-selected {
        font-size: 14px;
        color: var(--text-secondary);
    }

    .spec-close {
        position: absolute;
        top: 0;
        right: 0;
        width: 24px;
        height: 24px;
        background: none;
        border: none;
        color: var(--text-secondary);
        cursor: pointer;
    }

    .spec-content {
        flex: 1;
        padding: 16px;
        overflow-y: auto;
    }

    .spec-section {
        margin-bottom: 24px;
    }

    .spec-section h6 {
        margin-bottom: 12px;
        font-weight: 600;
    }

    /* 购买数量区域特殊对齐样式 */
    .spec-section.quantity-section {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
    }

    .spec-section.quantity-section h6 {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .spec-options {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .spec-option {
        padding: 8px 16px;
        border: 1px solid var(--border-color);
        border-radius: 6px;
        background: white;
        color: var(--text-primary);
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .spec-option.active {
        border-color: var(--primary-color);
        background: var(--primary-color);
        color: white;
    }

    .spec-quantity {
        display: flex;
        align-items: center;
        gap: 0;
        width: fit-content;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    .spec-quantity-btn {
        width: 42px;
        height: 42px;
        border: none;
        background: #f8f9fa;
        color: var(--text-secondary);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        font-size: 14px;
    }

    .spec-quantity-btn:hover {
        background: var(--primary-color);
        color: white;
    }

    .spec-quantity-btn:disabled {
        background: #e9ecef;
        color: #adb5bd;
        cursor: not-allowed;
    }

    .spec-quantity-input {
        width: 65px;
        height: 42px;
        border: none;
        text-align: center;
        font-weight: 600;
        outline: none;
        background: white;
        font-size: 16px;
        color: var(--text-primary);
    }

    .spec-footer {
        padding: 16px;
        border-top: 1px solid var(--border-color);
    }

    .spec-buttons {
        display: flex;
        gap: 12px;
    }

    .spec-add-cart-btn {
        flex: 1;
        background: var(--primary-color);
        color: white;
        border: none;
        border-radius: 8px;
        padding: 14px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: background 0.3s ease;
    }

    .spec-add-cart-btn:hover {
        background: #e55a00;
    }

    .spec-buy-now-btn {
        flex: 1;
        background: #dc3545;
        color: white;
        border: none;
        border-radius: 8px;
        padding: 14px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: background 0.3s ease;
    }

    .spec-buy-now-btn:hover {
        background: #c82333;
    }

    /* 移动端图片预览模态框 */
    .image-modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        z-index: 9999;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .image-modal.show {
        display: flex;
        opacity: 1;
    }

    .modal-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.9);
    }

    .modal-content {
        position: relative;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .modal-close {
        position: absolute;
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.2);
        border: none;
        border-radius: 50%;
        color: white;
        font-size: 18px;
        cursor: pointer;
        z-index: 10001;
        transition: background 0.3s ease;
    }

    .modal-close:hover {
        background: rgba(255, 255, 255, 0.3);
    }

    .modal-image-container {
        position: relative;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .modal-image {
        max-width: 90%;
        max-height: 80%;
        object-fit: contain;
        transition: transform 0.3s ease;
    }

    .modal-indicators {
        position: absolute;
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        gap: 12px;
    }

    .modal-indicator {
        width: 10px;
        height: 10px;
        background: rgba(255, 255, 255, 0.5);
        border-radius: 50%;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .modal-indicator.active {
        background: white;
        transform: scale(1.3);
    }

    .modal-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 50px;
        height: 50px;
        background: rgba(255, 255, 255, 0.2);
        border: none;
        border-radius: 50%;
        color: white;
        font-size: 20px;
        cursor: pointer;
        transition: background 0.3s ease;
        z-index: 10001;
    }

    .modal-nav:hover {
        background: rgba(255, 255, 255, 0.3);
    }

    .modal-nav.prev {
        left: 20px;
    }

    .modal-nav.next {
        right: 20px;
    }
}
