/* --- 基础重置 --- */
:root {
    --primary-color: #1a1a1a;
    --accent-color: #d4a373;
    --text-color: #333;
    --text-light: #777;
    --border-color: #e5e5e5;
    --bg-color: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-color);
    margin: 0;
    padding: 0;
    background-color: #fafafa;
}

.product-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 40px;
    background-color: var(--bg-color);
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border-radius: 8px;
}

/* --- 顶部布局 --- */
.product-top {
    display: flex;
    flex-wrap: wrap;
    gap: 60px;
}

.gallery-section {
    flex: 1 1 450px;
}

.info-section {
    flex: 1 1 400px;
}

/* --- 图片区域 --- */
.main-image-wrapper {
    width: 100%;
    max-width: 450px; /* 限制主图最大宽度，防止在大屏上过大 */
    max-height: 600px; /* 对应 3:4 的最大高度 */
    margin: 0 auto 20px auto; /* 居中显示，下方留白 20px */
    aspect-ratio: 3 / 4;
    background-color: #f9f9f9;
    border-radius: 6px;
    overflow: hidden;
    /* 下面两行用于配合 object-fit: contain 时的居中 */
    display: flex;
    align-items: center;
    justify-content: center;
}

#main-image {
    width: 100%;
    height: 100%;
    /* cover: 裁剪图片填满容器，不留白（适合服装电商）
       contain: 完整显示图片，两边可能留白（适合不同比例的商品图）
       你可以根据你的实际图片比例二选一
    */
    object-fit: cover;
    display: block;
}

.thumbnail-list {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 5px;
    max-width: 450px; /* 缩略图列表的总宽度与主图最大宽度保持一致 */
    margin: 0 auto; /* 居中显示 */
}

/* 隐藏缩略图列表的滚动条，让 UI 更干净 (可选) */
.thumbnail-list::-webkit-scrollbar {
    height: 4px;
}
.thumbnail-list::-webkit-scrollbar-thumb {
    background-color: #ddd;
    border-radius: 4px;
}
.thumb-item {
    width: 80px;             /* 设定宽度 */
    height: 80px;            /* 设定与宽度相同的高度，使其成为正方形 */
    flex-shrink: 0;          /* 【关键】防止缩略图太多时在 flex 容器中被挤压变窄 */
    cursor: pointer;
    opacity: 0.5;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    border-radius: 4px;      /* 稍微加一点圆角，显得更精致 */
    overflow: hidden;
}

.thumb-item:hover {
    opacity: 1;
}

.thumb-item.active, .thumb-item:active {
    opacity: 1;
    border-color: var(--primary-color); /* 选中的边框颜色 */
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;       /* 【关键】保证图片按比例填满正方形，绝不拉伸变形 */
    display: block;
}


/* --- 信息区域 --- */
.product-title {
    font-size: 26px;
    font-weight: 400;
    letter-spacing: 0.5px;
    margin: 0 0 12px 0;
}

.product-sku {
    color: var(--text-light);
    font-size: 13px;
    margin-bottom: 30px;
    letter-spacing: 0.5px;
}

.price-box {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 25px;
}

.currency {
    font-size: 20px;
    font-weight: 500;
    color: var(--primary-color);
    padding-bottom: 4px;
}

.price {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.multi-price {
    font-size: 12px;
    color: #fff;
    background: var(--accent-color);
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
    font-weight: 500;
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 30px 0;
}

/* --- 规格选项 --- */
.tier-group {
    margin-bottom: 30px;
}

.tier-name {
    font-size: 14px;
    color: var(--text-light);
    margin: 0 0 15px 0;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.options-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.option-btn {
    padding: 10px 24px;
    border: 1px solid var(--border-color);
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-color);
    border-radius: 2px;
    transition: all 0.2s ease;
}

.option-btn:hover {
    border-color: #999;
}

.option-btn.selected {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* --- 数量与库存 --- */
.action-area {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-bottom: 40px;
}

.qty-selector {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.qty-selector button {
    width: 40px;
    height: 40px;
    background: #fff;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-color);
    transition: background 0.2s;
}

.qty-selector button:hover {
    background: #f5f5f5;
}

.qty-selector input {
    width: 50px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    font-size: 15px;
    color: var(--text-color);
    outline: none;
}

.stock-info {
    font-size: 14px;
}

.in-stock { color: #2e7d32; }
.out-stock { color: #d32f2f; font-weight: 500; }

/* --- 按钮 --- */
.btn {
    width: 100%;
    padding: 18px;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 1px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s ease;
}

.btn:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
}

.btn:hover:not(:disabled) {
    background: #000;
}

.buy-message {
    margin-top: 15px;
    font-size: 14px;
    text-align: center;
}

/* --- 详情长图 --- */
.detail-section {
    margin-top: 80px;
    padding-top: 60px;
    border-top: 1px solid var(--border-color);
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
    font-weight: 400;
    font-size: 24px;
    letter-spacing: 2px;
}

.detail-images img {
    display: block;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

/* ================= 新增：弹窗样式 ================= */

/* 遮罩层，默认隐藏 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65); /* 半透明黑色背景 */
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

/* 弹窗内容区 */
.modal-content {
    background-color: #fff;
    padding: 35px 30px;
    border-radius: 8px;
    text-align: center;
    position: relative;
    max-width: 320px;
    width: 85%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease;
}

/* 关闭按钮 (右上角的 X) */
.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--primary-color);
}

.modal-content h3 {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 1px;
}

.modal-content p {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 20px;
    line-height: 1.5;
}


.contact-info {
    background-color: #f9f9f9;
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 6px;
    margin: 20px 0;
    text-align: left;
}

.contact-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    padding: 8px 0;
    border-bottom: 1px dashed #e0e0e0;
}

.contact-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.contact-item:first-child {
    padding-top: 0;
}

.contact-item .label {
    color: var(--text-light);
    font-size: 15px;
}

.contact-item .value {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.5px;
    user-select: all; /* 允许用户一键全选复制 */
}

/* 用户所选商品的信息提示区 */
.sku-hint {
    margin-top: 20px;
    font-size: 13px;
    color: var(--primary-color);
    background: #f8f9fa;
    border: 1px dashed #ccc;
    padding: 12px;
    border-radius: 4px;
    text-align: left;
    line-height: 1.6;
}

/* 简单的弹窗动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}