/* ============================================================
   shop.css - 商城前台共用样式
   包含：商品网格、商品详情、支付页、提货页、移动端居中
   ============================================================ */

/* ============ 商品网格 ============ */
.product-grid {
    display: grid;
    gap: 16px;
    padding: 4px 0 8px;
    grid-template-columns: repeat(4, 1fr);
}

.product-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: box-shadow var(--transition), transform var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}
.product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.product-card .product-img-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f5f6f8;
    overflow: hidden;
}
.product-card .product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.product-card:hover .product-img {
    transform: scale(1.04);
}
.product-card .product-body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}
.product-card .product-name {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 39px;
}
.product-card .product-prices {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
}
.product-card .price-sale {
    color: #e74c3c;
    font-weight: 700;
    font-size: 18px;
    line-height: 1.2;
}
.product-card .price-original {
    color: #9ca3af;
    font-size: 13px;
    text-decoration: line-through;
    font-weight: 400;
}
.product-card .price-normal {
    color: #1a1a1a;
    font-weight: 700;
    font-size: 18px;
    line-height: 1.2;
}

/* ============ 商品详情页 ============ */
.product-detail-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}
.product-detail-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    padding: 28px;
}
.product-detail-top {
    display: flex;
    gap: 36px;
    align-items: flex-start;
}

/* 左侧图库 */
.product-gallery {
    flex: 0 0 400px;
    width: 400px;
    max-width: 100%;
}
.product-main-image-box {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f5f6f8;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--color-border);
}
.product-main-image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s ease;
}

.sub-images-wrapper {
    position: relative;
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sub-images-scroll {
    flex: 1;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px 0;
}
.sub-images-scroll::-webkit-scrollbar { display: none; }
.sub-images-scroll img {
    width: 68px;
    height: 68px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.2s, transform 0.2s;
    background: #f5f6f8;
}
.sub-images-scroll img:hover {
    transform: scale(1.05);
}
.sub-images-scroll img.active {
    border-color: var(--color-text);
}
.sub-nav-arrow {
    width: 22px;
    height: 68px;
    background: rgba(0,0,0,0.05);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: #6b7280;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    user-select: none;
}
.sub-nav-arrow:hover { background: rgba(0,0,0,0.12); }
.sub-nav-arrow.hidden { visibility: hidden; }

/* 右侧信息 */
.product-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.product-info .product-title {
    font-size: 26px;
    font-weight: 500;
    line-height: 1.35;
    color: var(--color-text);
    margin: 0;
    word-break: break-word;
}
.product-info .product-category-row {
    font-size: 13px;
    color: var(--color-text-secondary);
}
.product-info .product-category-row a {
    display: inline-block;
    padding: 2px 14px;
    background: #f0f0f0;
    border-radius: 16px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
}
.product-info .product-category-row a:hover { background: #e0e0e0; }

.product-info .price-block {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}
.product-info .price-block .sale-price {
    color: #e74c3c;
    font-weight: 700;
    font-size: 30px;
    line-height: 1.1;
}
.product-info .price-block .original-price {
    color: #9ca3af;
    font-size: 16px;
    text-decoration: line-through;
}
.product-info .price-block .normal-price {
    color: #1a1a1a;
    font-weight: 700;
    font-size: 30px;
    line-height: 1.1;
}

.product-info .stock-row {
    font-size: 14px;
    color: var(--color-text-secondary);
}
.product-info .stock-row strong {
    color: var(--color-text);
    font-weight: 600;
}

.product-info .buy-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 14px 48px;
    background: #f97316;
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    text-align: center;
    text-decoration: none;
    align-self: flex-start;
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.3);
    letter-spacing: 0.5px;
}
.product-info .buy-btn:hover {
    background: #ea6a0a;
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}
.product-info .buy-btn:active { transform: scale(0.98); }
.product-info .buy-btn.disabled {
    background: #d1d5db;
    cursor: not-allowed;
    box-shadow: none;
    pointer-events: none;
}

/* 详情介绍 */
.product-description-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}
.product-description-section .section-title {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.product-description-section .section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: var(--color-text);
    border-radius: 2px;
}
.product-description-content {
    font-size: 15px;
    line-height: 1.8;
    color: #333;
    word-break: break-word;
}
.product-description-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 8px auto;
    border-radius: var(--radius-sm);
}
.product-description-content video,
.product-description-content iframe {
    max-width: 100%;
    display: block;
    margin: 8px auto;
    border-radius: var(--radius-sm);
}
.product-description-content .ql-align-center { text-align: center; }
.product-description-content .ql-align-right { text-align: right; }
.product-description-content .ql-align-justify { text-align: justify; }

/* 友情提示 */
.shop-notice-box {
    margin-top: 24px;
    padding: 16px 20px;
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.7;
    color: #78350f;
    word-break: break-word;
}
.shop-notice-box img { max-width: 100%; height: auto; }

/* ============ 支付页 ============ */
.pay-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 0 40px;
}
.pay-card {
    display: flex;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
    overflow: hidden;
}
.pay-left {
    flex: 1;
    background: #f9fafb;
    padding: 32px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.pay-left .pay-product-image {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: #f0f0f0;
    box-shadow: var(--shadow-sm);
    display: block;
}
.pay-right {
    flex: 2;
    padding: 32px 36px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}
.pay-right .pay-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.4;
    margin: 0;
    word-break: break-word;
}
.pay-right .pay-price {
    font-size: 26px;
    font-weight: 700;
    color: #e74c3c;
}
.pay-right .pay-price .original {
    font-size: 15px;
    color: #9ca3af;
    text-decoration: line-through;
    font-weight: 400;
    margin-left: 10px;
}
.pay-section-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 8px;
}
.payment-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.payment-option {
    padding: 12px 28px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    background: #fff;
    transition: all 0.2s;
    user-select: none;
    min-width: 100px;
    text-align: center;
}
.payment-option:hover {
    border-color: #9ca3af;
}
.payment-option.active {
    border-color: #1a1a1a;
    background: #1a1a1a;
    color: #fff;
}
.payment-qrcode-box {
    margin-top: 6px;
    padding: 20px;
    background: #f9fafb;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--color-border);
    text-align: center;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
}
.payment-qrcode-box img {
    width: 200px;
    height: 200px;
    object-fit: contain;
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    display: block;
}
.payment-qrcode-box .qrcode-tip {
    font-size: 13px;
    color: var(--color-text-secondary);
}
.pay-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.pay-actions .btn-back {
    padding: 12px 32px;
    background: #9ca3af;
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}
.pay-actions .btn-back:hover { background: #6b7280; }
.pay-actions .btn-paid {
    padding: 12px 32px;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    flex: 1;
    min-width: 140px;
    text-align: center;
}
.pay-actions .btn-paid:hover { background: #15803d; }
.pay-actions .btn-paid:active { transform: scale(0.98); }
.pay-actions .btn-paid:disabled { background: #86efac; cursor: not-allowed; }

/* ============ 响应式 ============ */
@media (max-width: 1024px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
    .product-gallery { flex: 0 0 340px; width: 340px; }
    .product-detail-top { gap: 24px; }
}

@media (max-width: 768px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }

    .product-detail-card { padding: 18px; }
    .product-detail-top {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;   /* ✅ 让子元素撑满整行宽度 */
    }
    .product-gallery {
        flex: 0 0 auto;
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }
    .product-info .product-title { font-size: 20px; }
    .product-info .price-block .sale-price,
    .product-info .price-block .normal-price { font-size: 24px; }
    .product-info .buy-btn {
        width: 100%;
        align-self: stretch;
        padding: 13px 20px;
    }

        /* ===== 移动端商品详情居中（标题除外） ===== */
    .product-info {
        align-items: center;
        text-align: center;
    }
    .product-info .product-title {
        width: 100%;
        text-align: left;      /* 标题保持左对齐 */
    }
    .product-info .product-category-row,
    .product-info .stock-row,
    .product-info .price-block {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    .product-info .price-block {
        display: flex;
        justify-content: center;
    }
    .product-info .buy-btn {
        align-self: center;
        width: 100%;
        max-width: 320px;
    }

    .pay-card { flex-direction: column; }
    .pay-left { padding: 24px; }
    .pay-left .pay-product-image { max-width: 220px; }
    .pay-right { padding: 20px 22px; }
    .pay-right .pay-title { font-size: 18px; }
    .pay-right .pay-price { font-size: 22px; }
}

@media (max-width: 480px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .product-card .product-name { font-size: 13px; }
    .product-card .price-sale,
    .product-card .price-normal { font-size: 16px; }
    .product-card .price-original { font-size: 12px; }

    .product-detail-card { padding: 14px; }
    .product-info .product-title { font-size: 18px; }
    .sub-images-scroll img { width: 56px; height: 56px; }
    .sub-nav-arrow { height: 56px; width: 20px; }

    .pay-right { padding: 16px; }
    .payment-option { padding: 10px 18px; font-size: 14px; min-width: 80px; }
    .payment-qrcode-box img { width: 160px; height: 160px; }
    .pay-actions { flex-direction: column-reverse; }
    .pay-actions .btn-back,
    .pay-actions .btn-paid { width: 100%; }
}