/* ================================
   🔥 修复:商品图片显示样式
   ================================ */

/* 商品图片区域容器 */
.product-image-section {
    position: sticky;
    top: 20px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

/* 主图片容器 - 固定尺寸,防止拉伸 */
.main-image-container {
    position: relative;
    width: 100%;
    height: 400px; /* 🔥 固定高度 */
    overflow: hidden;
    border-radius: 0;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 主图片轮播容器 */
.main-image-carousel {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 🔥 关键修复:主图片样式 - 防止拉伸变形 */
.main-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain; /* 🔥 关键:保持比例,不拉伸 */
    border-radius: 0;
    transition: all 0.3s ease;
    position: relative; /* 🔥 改为相对定位 */
    display: block;
    margin: auto;
}

/* 轮播图片定位 */
.carousel-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 95%;
    max-height: 95%;
    width: auto;
    height: auto;
    object-fit: contain;
    opacity: 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.carousel-image.transitioning {
    transition: opacity 0.3s ease;
}

.carousel-image.active {
    opacity: 1;
}

/* 🔥 修复:无图片占位符样式 */
.no-image-placeholder {
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #dee2e6;
    border-radius: 12px;
}

.no-image-content {
    text-align: center;
    padding: 20px;
}

/* 缩略图样式 */
.thumbnail-images {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 15px;
    background: #f8f9fa;
    flex-wrap: wrap;
}

.thumbnail-image {
    width: 60px;
    height: 60px;
    object-fit: cover; /* 缩略图可以裁剪 */
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.thumbnail-image:hover,
.thumbnail-image.active {
    opacity: 1;
    border-color: #667eea;
    transform: scale(1.05);
}

/* 图片导航按钮 */
.image-navigation {
    position: absolute;
    top: 50%;
    width: 100%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.main-image-container:hover .image-navigation {
    opacity: 1;
    pointer-events: auto;
}

.nav-btn {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    transform: scale(1.1);
}

/* ================================
   购买步骤指示器样式
   ================================ */
.purchase-steps-container {
    background: linear-gradient(135deg, #f8f9ff 0%, #e3f2fd 100%);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 25px;
}

.purchase-steps-with-arrows {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 10px;
}

.step-item {
    flex: 0 0 auto;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: white;
    padding: 15px 12px;
    border-radius: 12px;
    border: 2px solid #e9ecef;
    min-width: 80px;
    text-align: center;
    color: #6c757d;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
}

.step.active {
    border-color: #667eea;
    color: #667eea;
    background: linear-gradient(135deg, #f8f9ff 0%, #e3f2fd 100%);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.25);
    transform: translateY(-3px);
}

.step.completed {
    border-color: #28a745;
    color: #28a745;
    background: linear-gradient(135deg, #f8fff8 0%, #e8f5e8 100%);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.25);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #dee2e6;
    color: white;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.step.active .step-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.4);
}

.step.completed .step-number {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    box-shadow: 0 3px 8px rgba(40, 167, 69, 0.4);
}

.step-text {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
}

/* 箭头连接器样式 */
.arrow-connector {
    flex: 0 0 auto;
    color: #94a3b8;
    font-size: 16px;
    transition: all 0.3s ease;
}

.arrow-connector i {
    opacity: 0.6;
}

/* ================================
   支付相关样式
   ================================ */
.payment-upload-compact {
    background: #fff5f5;
    border: 1px dashed #dc3545;
    border-radius: 8px;
    padding: 12px;
}

.qr-display {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.qr-code {
    max-width: 180px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.payment-notice-highlight {
    color: #dc3545 !important;
    font-weight: 700 !important;
    font-size: 1.1em !important;
    text-shadow: 0 1px 2px rgba(220, 53, 69, 0.2);
    animation: subtle-pulse 2s infinite;
}

@keyframes subtle-pulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.9; 
        transform: scale(1.02);
    }
}

/* ================================
   规格选择样式
   ================================ */
.spec-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.spec-option {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    display: inline-block;
    min-width: 0;
    width: auto;
    position: relative;
    overflow: hidden;
}

.spec-option:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.spec-option.selected {
    border-color: #28a745;
    background: linear-gradient(135deg, #f8fff8 0%, #e8f5e8 100%);
    box-shadow: 0 3px 12px rgba(40, 167, 69, 0.25);
    transform: translateY(-2px);
}

/* 选中状态的对勾图标 - 放在右上角 */
.spec-option.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 6px;
    right: 8px;
    color: #28a745;
    font-size: 14px;
    background: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.spec-header {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    padding-right: 26px; /* 为右上角对勾留出空间 */
}

.spec-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin: 0;
}

.spec-price {
    font-weight: 700;
    font-size: 16px;
    color: #dc3545;
    margin: 0;
}

.spec-detail-description {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border-left: 4px solid #667eea;
}

.spec-detail-description h6 {
    margin-bottom: 10px;
    color: #667eea;
}

.spec-detail-description .description-content {
    color: #6c757d;
    line-height: 1.6;
}

/* ================================
   响应式设计
   ================================ */
@media (max-width: 768px) {
    /* 步骤指示器移动端优化 */
    .purchase-steps-container {
        padding: 15px 10px;
        border-radius: 0 0 12px 12px;
        margin-bottom: 20px;
    }
    
    .purchase-steps-with-arrows {
        gap: 5px;
    }
    
    .step {
        min-width: 65px;
        padding: 12px 8px;
    }
    
    .step-number {
        width: 26px;
        height: 26px;
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .step-text {
        font-size: 11px;
    }
    
    .arrow-connector {
        font-size: 14px;
    }
    
    /* 🔥 手机端从第二步开始隐藏商品详情 */
    .product-image-hide-mobile {
        display: none !important;
    }
    
    .payment-fullscreen-mobile {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
    
    /* 主图片容器移动端优化 */
    .main-image-container {
        height: 280px;
    }
    
    .nav-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .thumbnail-image {
        width: 50px;
        height: 50px;
    }
    
    /* 规格选择移动端优化 */
    .spec-option {
        padding: 10px 14px;
        margin-bottom: 8px;
    }
    
    .spec-options {
        gap: 8px;
    }
    
    .spec-header {
        gap: 8px;
        padding-right: 24px;
    }
    
    .spec-name {
        font-size: 13px;
    }
    
    .spec-price {
        font-size: 15px;
    }
    
    .spec-option.selected::after {
        top: 5px;
        right: 6px;
        width: 18px;
        height: 18px;
        font-size: 12px;
    }
    
    /* 支付区域移动端优化 */
    .qr-code {
        max-width: 140px;
    }
    
    .payment-upload-compact {
        padding: 10px;
    }
}

@media (max-width: 576px) {
    /* 超小屏幕优化 */
    .step {
        min-width: 55px;
        padding: 10px 6px;
    }
    
    .step-number {
        width: 22px;
        height: 22px;
        font-size: 11px;
        margin-bottom: 4px;
    }
    
    .step-text {
        font-size: 10px;
    }
    
    .arrow-connector {
        font-size: 12px;
    }
    
    .main-image-container {
        height: 240px;
    }
    
    .nav-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .thumbnail-image {
        width: 45px;
        height: 45px;
    }
    
    .qr-code {
        max-width: 120px;
    }
}

/* 电脑端优化 */
@media (min-width: 769px) {
    .purchase-steps-container {
        padding: 25px 30px;
    }
    
    .step {
        min-width: 100px;
        padding: 18px 15px;
    }
    
    .step-number {
        width: 36px;
        height: 36px;
        font-size: 15px;
        margin-bottom: 10px;
    }
    
    .step-text {
        font-size: 14px;
    }
    
    .arrow-connector {
        font-size: 18px;
        margin: 0 10px;
    }
    
    .qr-code {
        max-width: 200px;
    }
}

/* ================================
   其他优化样式
   ================================ */
.purchase-action-area {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 25px;
    border: 1px solid #e9ecef;
}

.section-title {
    color: #333;
    font-weight: 600;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
    margin-bottom: 20px;
}

.order-summary-section .card {
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-radius: 15px;
}

.order-summary-section .card-header {
    border-bottom: 1px solid #e9ecef;
    border-radius: 15px 15px 0 0 !important;
}

/* 产品标题样式 */
.product-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin: 0;
    line-height: 1.3;
}

@media (max-width: 768px) {
    .product-title {
        font-size: 1.3rem;
    }
    
    .purchase-action-area {
        padding: 20px;
        margin-top: 20px;
    }
}

@media (max-width: 576px) {
    .purchase-action-area {
        padding: 15px;
    }
    
    .section-title {
        font-size: 1.1rem;
    }
}

/* ================================
   🔥 富文本内容样式 - 与后台编辑器保持一致
   ================================ */
.rich-text-content {
    font-family: "微软雅黑", "Microsoft YaHei", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.8;
    color: #333;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.rich-text-content p {
    margin: 0.8em 0;
    line-height: 1.8;
}

/* 对齐方式 - wangEditor 使用 style 属性 */
.rich-text-content [style*="text-align: left"] { text-align: left; }
.rich-text-content [style*="text-align: center"] { text-align: center; }
.rich-text-content [style*="text-align: right"] { text-align: right; }
.rich-text-content [style*="text-align: justify"] { text-align: justify; }

/* 首行缩进 */
.rich-text-content [style*="text-indent"] { text-indent: 2em; }

.rich-text-content h1 {
    font-size: 1.8em;
    font-weight: bold;
    margin: 0.8em 0 0.5em;
    padding-bottom: 0.3em;
    border-bottom: 2px solid #eee;
}

.rich-text-content h2 {
    font-size: 1.5em;
    font-weight: bold;
    margin: 0.8em 0 0.5em;
    padding-bottom: 0.2em;
    border-bottom: 1px solid #eee;
}

.rich-text-content h3 {
    font-size: 1.25em;
    font-weight: bold;
    margin: 0.8em 0 0.5em;
}

.rich-text-content h4,
.rich-text-content h5,
.rich-text-content h6 {
    font-size: 1.1em;
    font-weight: bold;
    margin: 0.6em 0 0.4em;
}

/* 图片样式 - 自适应宽度，保留内联样式 */
.rich-text-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 10px auto;
    display: block;
}

/* 居中的图片 */
.rich-text-content p[style*="text-align: center"] img,
.rich-text-content [data-w-e-type="image"][style*="text-align: center"] img {
    margin-left: auto;
    margin-right: auto;
}

/* 表格样式 */
.rich-text-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 15px 0;
    overflow-x: auto;
    display: block;
}

.rich-text-content table td,
.rich-text-content table th {
    border: 1px solid #ccc;
    padding: 10px 12px;
    text-align: left;
}

.rich-text-content table th {
    background: #f5f5f5;
    font-weight: bold;
}

.rich-text-content table tr:hover {
    background: #fafafa;
}

/* 代码块样式 */
.rich-text-content pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: "Consolas", "Monaco", monospace;
    font-size: 13px;
    line-height: 1.5;
    margin: 15px 0;
}

.rich-text-content code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: "Consolas", "Monaco", monospace;
    font-size: 0.9em;
}

.rich-text-content pre code {
    background: transparent;
    padding: 0;
}

/* 引用块样式 */
.rich-text-content blockquote {
    border-left: 4px solid #007bff;
    margin: 1.2em 0;
    padding: 12px 20px;
    background: #f8f9fa;
    color: #666;
    font-style: italic;
}

/* 列表样式 */
.rich-text-content ul,
.rich-text-content ol {
    padding-left: 2em;
    margin: 0.8em 0;
}

.rich-text-content li {
    margin: 0.4em 0;
    line-height: 1.6;
}

/* 链接样式 */
.rich-text-content a {
    color: #007bff;
    text-decoration: none;
}

.rich-text-content a:hover {
    text-decoration: underline;
}

/* 分割线样式 */
.rich-text-content hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 20px 0;
}

/* 视频样式 */
.rich-text-content video {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 10px 0;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .rich-text-content {
        font-size: 14px;
    }
    
    .rich-text-content h1 {
        font-size: 1.5em;
    }
    
    .rich-text-content h2 {
        font-size: 1.3em;
    }
    
    .rich-text-content img {
        margin: 8px 0;
    }
    
    .rich-text-content table {
        font-size: 13px;
    }
    
    .rich-text-content table td,
    .rich-text-content table th {
        padding: 6px 8px;
    }
}
