/* 商品详情页 - 扁平化设计风格 */

/* CSS变量定义 */
:root {
    --product-detail-primary-color: #f46969;
    --product-detail-secondary-color: #f45959;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --light-gray: #ecf0f1;
    --medium-gray: #bdc3c7;
    --dark-gray: #7f8c8d;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e8e8e8;
    --border-radius: 8px;
}

/* 全局重置 */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: #fafafa;
    margin: 0;
    padding: 0;
}

/* 容器 */
.product-detail-container {
    min-height: 100vh;
    background: #fff;
}

/* 商品主要区域 */
.product-main-section {
    padding: 0;
    overflow: hidden;
}

.product-main-section .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    overflow: hidden;
}

.product-main-section .row {
    display: flex;
    flex-wrap: wrap;
    margin-right: 0;
    margin-left: 0;
    overflow: hidden;
}

.product-main-section .col-md-6 {
    position: relative;
    width: 100%;
    padding-right: 10px;
    padding-left: 10px;
    min-width: 0; /* 防止flex子元素溢出 */
    overflow: hidden;
}

@media (min-width: 768px) {
    .product-main-section .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .product-main-section .col-md-6:first-child {
        padding-right: 15px;
        padding-left: 0;
    }
    
    .product-main-section .col-md-6:last-child {
        padding-left: 15px;
        padding-right: 0;
    }
}

/* 商品图片区域 */
.product-gallery {
    position: relative;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
}

.main-image {
    position: relative;
    padding: 20px;
    text-align: center;
    overflow: hidden;
}

.main-product-image {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    display: block;
}

/* 商品标签 */
.product-badges {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: white;
}

.badge-coupon {
    background: var(--warning-color);
}

.badge-discount {
    background: var(--accent-color);
}

.badge-tmall {
    background: var(--accent-color);
}

/* 商品信息面板 - 关键修复 */
.product-info-panel {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    height: fit-content;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    word-wrap: break-word;
    word-break: break-word;
}

/* 商品标题 */
.product-header {
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

.product-title {
    font-size: 24px;
    font-weight: 600;
    height: auto;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    line-height: 1.4;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.product-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
}

/* 价格区域 */
.price-section {
    margin-bottom: 10px;
    padding: 15px;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.price-main {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    overflow: hidden;
}

.current-price {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-color);
    line-height: 1;
    white-space: nowrap;
}

.original-price {
    font-size: 18px;
    color: var(--text-secondary);
    text-decoration: line-through;
    white-space: nowrap;
}

.discount-rate {
    background: var(--accent-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* 优惠券区域 */
.coupon-section {
    margin-bottom: 24px;
    overflow: hidden;
}

.coupon-card {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #e74c3c 0%, #ff9c92 100%);
    color: white;
    padding: 16px;
    border-radius: var(--border-radius);
    gap: 16px;
    overflow: hidden;
    flex-wrap: wrap;
}

.coupon-icon {
    font-size: 24px;
    opacity: 0.9;
    flex-shrink: 0;
}

.coupon-details {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.coupon-amount {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
    word-wrap: break-word;
}

.coupon-condition {
    font-size: 14px;
    opacity: 0.9;
    word-wrap: break-word;
}

.btn-coupon {
    background: white;
    color: var(--product-detail-primary-color);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

/* 商品属性 */
.product-attributes {
    margin-bottom: 10px;
    overflow: hidden;
}

.attribute-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

.attribute-row:last-child {
    border-bottom: none;
}

.attr-label {
    min-width: 80px;
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}

.attr-value {
    color: var(--text-primary);
    font-weight: 600;
    word-wrap: break-word;
    word-break: break-word;
    flex: 1;
    min-width: 0;
}

/* 店铺信息 */
.shop-section {
    margin-bottom: 10px;
    overflow: hidden;
}

.shop-card {
    display: flex;
    align-items: center;
    background: var(--light-gray);
    padding: 10px;
    padding-left: 20px;
    border-radius: var(--border-radius);
    gap: 16px;
    overflow: hidden;
    flex-wrap: wrap;
}

.shop-icon {
    width: 48px;
    height: 48px;
    background: var(--product-detail-secondary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.shop-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.shop-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    word-wrap: break-word;
    word-break: break-word;
}

.shop-type {
    font-size: 14px;
    color: var(--text-secondary);
}

.btn-shop {
    background: var(--product-detail-secondary-color) !important;
    color: white !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: var(--border-radius) !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

.btn-shop:hover {
    background: var(--product-detail-primary-color) !important;
    color: white !important;
    text-decoration: none !important;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    overflow: hidden;
}

.btn-large {
    flex: 1;
    min-width: 140px;
    max-width: 100%;
}

.btn-primary {
    background: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    color: white !important;
}

.btn-primary:hover {
    background: #c0392b !important;
    color: white !important;
    text-decoration: none !important;
}

.btn-secondary {
    background: var(--product-detail-secondary-color) !important;
    color: white !important;
}

.btn-secondary:hover {
    background: var(--product-detail-primary-color) !important;
}

.btn-outline {
    background: transparent !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-color) !important;
}

.btn-outline:hover {
    background: var(--light-gray) !important;
    border-color: var(--medium-gray) !important;
}

/* 商品详情描述 */
.product-description-section {
    padding: 40px 0;
    background: white;
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 16px;
    margin: 0;
}

.description-content {
    margin: 0 auto;
    padding: 0 20px;
}

.product-detail-images {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.product-detail-images img {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    cursor: pointer;
}

.description-text {
    background: var(--light-gray);
    padding: 24px;
    border-radius: var(--border-radius);
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.detail-link {
    text-align: center;
}

.btn-outline-primary {
    background: transparent;
    color: var(--product-detail-secondary-color);
    border: 2px solid var(--product-detail-secondary-color);
    padding: 12px 24px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-outline-primary:hover {
    background: var(--product-detail-secondary-color);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
}

/* 推荐商品区域 */
.recommended-section {
    padding: 40px 0;
    background: var(--light-gray);
}

.recommended-placeholder {
    background: white;
    padding: 60px 40px;
    border-radius: var(--border-radius);
}

/* 商品不存在页面 */
.product-not-found {
    padding: 80px 0;
    text-align: center;
}

.product-not-found h2 {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
}

.product-not-found p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* 图片模态框 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
}

.image-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-image {
    max-width: 90%;
    max-height: 90%;
    border-radius: var(--border-radius);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    color: var(--text-primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--light-gray);
    transform: scale(1.1);
}

/* 响应式设计 */
@media (max-width: 992px) {
    .product-main-section .container {
        padding: 0 15px;
    }
    
    .product-info-panel {
        margin-top: 20px;
        padding: 20px;
    }
    
    .product-title {
        font-size: 20px;
    }
    
    .current-price {
        font-size: 28px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn-large {
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .product-main-section {
        padding: 20px 0;
    }
    
    .product-info-panel {
        padding: 16px;
    }
    
    .product-title {
        font-size: 18px;
    }
    
    .current-price {
        font-size: 24px;
    }
    
    .coupon-card {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .shop-card {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .attribute-row {
        flex-direction: column;
        gap: 4px;
    }
    
    .attr-label {
        min-width: auto;
        font-size: 14px;
    }
    
    .section-header h2 {
        font-size: 24px;
    }
}

@media (max-width: 576px) {
    .breadcrumb-nav {
        padding: 12px 0;
    }
    
    .breadcrumb {
        font-size: 12px;
    }
    
    .product-main-section .container {
        padding: 0 10px;
    }
    
    .product-info-panel {
        padding: 12px;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .description-content {
        padding: 0 10px;
    }
}

/* 加载动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.product-detail-container > * {
    animation: fadeIn 0.6s ease-out;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--medium-gray);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-gray);
}

/* 焦点状态 */
.btn:focus,
.btn-shop:focus,
.btn-outline-primary:focus {
    outline: 2px solid var(--product-detail-secondary-color);
    outline-offset: 2px;
}

/* 禁用状态 */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}


.qrcode-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}
.qrcode-modal .modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
}
.qrcode-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}
.qrcode-header h3 {
    margin: 10px 0;
    color: #2f3542;
    font-size: 24px;
}
.qrcode-header p {
    color: #6c757d;
    margin-bottom: 25px;
    line-height: 1.6;
}
.qrcode-container {
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px dashed #dee2e6;
}
#qrcode-image {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}
.qrcode-info .product-name {
    font-weight: 600;
    color: #2f3542;
    margin: 15px 0 5px 0;
    font-size: 16px;
}
.qrcode-info .scan-tip {
    color: #6c757d;
    font-size: 14px;
    margin-bottom: 25px;
}
.qrcode-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}
.qrcode-actions .btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.qrcode-actions .btn-primary {
    background: #ff6b35;
    color: white;
}
.qrcode-actions .btn-primary:hover {
    background: #e55a2b;
    transform: translateY(-2px);
}
.qrcode-actions .btn-secondary {
    background: #6c757d;
    color: white;
}
.qrcode-actions .btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}
@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 成功消息样式 */
.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #2ed573;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    z-index: 10002;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(46, 213, 115, 0.3);
    animation: slideInRight 0.3s ease;
}

.success-message.fade-out {
    animation: slideOutRight 0.3s ease;
}

/* 动画效果 */
@keyframes slideInRight {
    from { 
        transform: translateX(100%); 
        opacity: 0; 
    }
    to { 
        transform: translateX(0); 
        opacity: 1; 
    }
}

@keyframes slideOutRight {
    from { 
        transform: translateX(0); 
        opacity: 1; 
    }
    to { 
        transform: translateX(100%); 
        opacity: 0; 
    }
}