/**************************************
 * 商品详情页样式 - 专业美化版
 * 设计理念：现代、精致、高端
 * PC端：左右布局
 * 移动端：上下布局
 **************************************/

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

/* === 移动端头部 === */
.mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    background: linear-gradient(135deg, #fff 0%, #fafafa 100%);
    border-bottom: 1px solid #e5e5e5;
    padding: 0 15px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.mobile-header h1 {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.mobile-header .back-btn,
.mobile-header .home-btn {
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    font-size: 20px;
    color: #333;
    transition: all 0.3s;
    border-radius: 50%;
}

.mobile-header .back-btn:active,
.mobile-header .home-btn:active {
    background: #f0f0f0;
}

/* === PC端详情容器 === */
.shop-detail-container {
    width: 1200px;
    margin: 30px auto;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

/* === 详情主区域 === */
.detail-wrapper {
    display: flex;
    padding: 30px;
    gap: 40px;
}

/* === 左侧：图片区域 === */
.detail-images {
    width: 500px;
    flex-shrink: 0;
}

.main-image {
    width: 100%;
    height: 500px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    margin-bottom: 15px;
    border: 1px solid #e5e5e5;
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 缩略图 */
.thumb-images {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.thumb-images img {
    width: 90px;
    height: 90px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.thumb-images img:hover {
    border-color: #FD66B5;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(253, 102, 181, 0.3);
}

.thumb-images img.active {
    border-color: #E83191;
    box-shadow: 0 4px 16px rgba(232, 49, 145, 0.4);
}

/* === 右侧：商品信息 === */
.detail-info {
    flex: 1;
    min-width: 0;
}

.goods-title {
    font-size: 28px;
    font-weight: bold;
    color: #222;
    line-height: 1.5;
    margin-bottom: 20px;
    font-family: 'Microsoft YaHei', '微软雅黑', sans-serif;
    letter-spacing: 0.5px;
}

/* 价格区域 - 渐变卡片设计 */
.goods-price-box {
    background: linear-gradient(135deg, #fff5f9 0%, #ffe8f0 100%);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 2px solid #ffd4e5;
    box-shadow: 0 4px 15px rgba(232, 49, 145, 0.1);
    transition: all 0.3s;
}

.goods-price-box:hover {
    border-color: #ffb3d1;
    box-shadow: 0 6px 20px rgba(232, 49, 145, 0.15);
}

.current-price {
    margin-bottom: 15px;
    display: flex;
    align-items: baseline;
}

.current-price .label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.current-price .price {
    font-size: 36px;
    font-weight: bold;
    color: #E83191;
    font-family: 'Arial', 'Helvetica', sans-serif;
    margin-left: 10px;
    text-shadow: 0 2px 4px rgba(232, 49, 145, 0.2);
}

.current-price .original-price {
    font-size: 18px;
    color: #999;
    text-decoration: line-through;
    margin-left: 15px;
    font-weight: normal;
}

.goods-meta {
    display: flex;
    gap: 25px;
    font-size: 14px;
    color: #666;
}

.goods-meta span {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
}

.goods-meta .ico {
    color: #E83191;
    margin-right: 5px;
    font-size: 16px;
}

/* 商品属性 - 优雅的卡片式设计 */
.goods-category,
.goods-delivery {
    padding: 18px 0;
    border-bottom: 1px dashed #e8e8e8;
    display: flex;
    align-items: center;
    transition: all 0.3s;
}

.goods-category:hover,
.goods-delivery:hover {
    background: rgba(232, 49, 145, 0.02);
    padding-left: 5px;
}

.goods-category .label,
.goods-delivery .label,
.goods-quantity .label {
    width: 90px;
    font-size: 15px;
    color: #555;
    flex-shrink: 0;
    font-weight: 500;
}

.goods-category .value,
.goods-delivery .value {
    font-size: 15px;
    color: #333;
    font-weight: 500;
}

/* 数量选择 - 现代化设计 */
.goods-quantity {
    padding: 25px 0;
    display: flex;
    align-items: center;
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s;
}

.quantity-control:hover {
    border-color: #E83191;
    box-shadow: 0 4px 12px rgba(232, 49, 145, 0.15);
}

.qty-btn {
    width: 45px;
    height: 45px;
    border: none;
    background: #fff;
    font-size: 22px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.qty-btn:hover {
    background: linear-gradient(135deg, #E83191 0%, #d52a7f 100%);
    color: #fff;
}

.qty-btn:active {
    transform: scale(0.95);
}

.quantity-control input {
    width: 70px;
    height: 45px;
    text-align: center;
    border: none;
    border-left: 2px solid #e5e5e5;
    border-right: 2px solid #e5e5e5;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    background: #fafafa;
}

/* 操作按钮 - 高级渐变按钮 */
.goods-actions {
    display: flex;
    gap: 15px;
    margin: 30px 0;
}

.goods-actions button {
    flex: 1;
    height: 55px;
    border: none;
    border-radius: 28px;
    font-size: 17px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    letter-spacing: 1px;
}

/* 加入购物车按钮 - 描边设计 */
.btn-cart {
    background: #fff;
    color: #E83191;
    border: 2px solid #E83191;
    box-shadow: 0 4px 15px rgba(232, 49, 145, 0.2);
}

.btn-cart:hover {
    background: linear-gradient(135deg, #fff0f5 0%, #ffe8f0 100%);
    border-color: #d52a7f;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(232, 49, 145, 0.3);
}

.btn-cart:active {
    transform: translateY(0);
}

/* 立即购买按钮 - 渐变设计 */
.btn-buy {
    background: linear-gradient(135deg, #E83191 0%, #d52a7f 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(232, 49, 145, 0.3);
}

.btn-buy:hover {
    background: linear-gradient(135deg, #ff3da1 0%, #e83191 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(232, 49, 145, 0.4);
}

.btn-buy:active {
    transform: translateY(0);
}

.btn-cart .ico,
.btn-buy .ico {
    margin-right: 6px;
    font-size: 18px;
}

/* 商家信息 - 精美卡片设计 */
.seller-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #f0f1f3 100%);
    padding: 25px;
    border-radius: 12px;
    margin-top: 25px;
    border: 1px solid #e8e8e8;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    transition: all 0.3s;
}

.seller-info:hover {
    box-shadow: 0 6px 18px rgba(0,0,0,0.1);
    border-color: #d0d0d0;
}

.seller-info > div {
    margin-bottom: 12px;
    font-size: 15px;
    color: #555;
    display: flex;
    align-items: center;
    transition: all 0.3s;
}

.seller-info > div:hover {
    color: #333;
    transform: translateX(3px);
}

.seller-info > div:last-child {
    margin-bottom: 0;
}

.seller-info .ico {
    margin-right: 10px;
    color: #E83191;
    font-size: 16px;
    width: 24px;
    text-align: center;
}

.seller-name span {
    font-weight: bold;
    color: #222;
    font-size: 16px;
}

.seller-tel a {
    color: #E83191;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.seller-tel a:hover {
    color: #d52a7f;
    text-decoration: underline;
}

/* === 溯源与认证区块 === */
.certificate-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 50px 0;
    margin-top: 30px;
}

.cert-wrapper {
    width: 1200px;
    margin: 0 auto;
    padding: 0 30px;
}

.cert-section-title {
    text-align: center;
    font-size: 28px;
    font-weight: bold;
    color: #222;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.cert-section-title .ico {
    font-size: 32px;
    color: #E83191;
}

/* 卡片容器 */
.cert-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* 单个卡片 */
.cert-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.cert-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

/* 卡片图标 */
.cert-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 24px;
    transition: all 0.3s;
}

.cert-card:hover .cert-card-icon {
    transform: rotate(360deg);
}

/* 卡片内容 */
.cert-card-content {
    flex: 1;
}

.cert-card-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.cert-card-desc {
    font-size: 13px;
    color: #999;
}

/* 卡片箭头 */
.cert-card-arrow {
    font-size: 20px;
    color: #ccc;
    transition: all 0.3s;
}

.cert-card:hover .cert-card-arrow {
    transform: translateX(5px);
}

/* 产品溯源证书卡片 - 粉红主题 */
.cert-card-product .cert-card-icon {
    background: linear-gradient(135deg, #ffe8f0 0%, #ffd4e5 100%);
    color: #E83191;
}

.cert-card-product:hover {
    border-color: #E83191;
}

.cert-card-product:hover .cert-card-arrow {
    color: #E83191;
}

/* 作者会员证卡片 - 蓝色主题 */
.cert-card-member .cert-card-icon {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #1e3a8a;
}

.cert-card-member:hover {
    border-color: #1e3a8a;
}

.cert-card-member:hover .cert-card-arrow {
    color: #1e3a8a;
}

/* 作者详情卡片 - 绿色主题 */
.cert-card-author .cert-card-icon {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #059669;
}

.cert-card-author:hover {
    border-color: #059669;
}

.cert-card-author:hover .cert-card-arrow {
    color: #059669;
}

/* === 商品详情内容区 === */
.detail-content {
    background: #fff;
    margin-top: 30px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.content-wrapper {
    width: 1200px;
    margin: 0 auto;
    padding: 40px;
}

.content-wrapper h2 {
    font-size: 24px;
    font-weight: bold;
    color: #222;
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    font-family: 'Microsoft YaHei', '微软雅黑', sans-serif;
    letter-spacing: 2px;
}

.content-wrapper h2::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -10px;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #E83191 0%, #FD66B5 100%);
    border-radius: 2px;
}

.content-body {
    font-size: 15px;
    line-height: 2;
    color: #555;
    padding: 20px;
    background: #fafafa;
    border-radius: 10px;
    border: 1px solid #f0f0f0;
    text-align: left; /* 确保内容左对齐 */
    white-space: pre-wrap; /* 保留空格和换行符，数据库中的多个空格会完整显示 */
    word-wrap: break-word; /* 长单词换行 */
}

.content-body img {
    max-width: 100%;
    margin: 20px auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* === 移动端底部操作栏 === */
.mobile-bottom-bar {
    display: none;
}

/* === 响应式适配 === */

/* 平板 (768px - 1024px) */
@media (max-width: 1024px) {
    .shop-detail-container {
        width: 750px;
    }
    
    .detail-wrapper {
        padding: 30px;
        gap: 35px;
    }
    
    .detail-images {
        width: 380px;
    }
    
    .main-image {
        height: 380px;
    }
    
    .content-wrapper {
        width: 750px;
        padding: 30px;
    }
    
    .cert-wrapper {
        width: 750px;
    }
    
    .cert-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .goods-title {
        font-size: 24px;
    }
    
    .current-price .price {
        font-size: 30px;
    }
}

/* 移动端 (< 768px) */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }
    
    .shop-detail-container {
        width: 100%;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }
    
    .detail-wrapper {
        flex-direction: column;
        padding: 0;
        gap: 0;
        background: #fff;
    }
    
    .detail-images {
        width: 100%;
    }
    
    .main-image {
        height: 100vw;
        border-radius: 0;
        margin-bottom: 0;
        box-shadow: none;
    }
    
    .main-image::before {
        display: none;
    }
    
    .thumb-images {
        padding: 10px;
        background: #fff;
    }
    
    .thumb-images img {
        width: 70px;
        height: 70px;
    }
    
    .detail-info {
        padding: 15px;
    }
    
    .goods-title {
        font-size: 20px;
        margin-bottom: 15px;
        line-height: 1.4;
    }
    
    .goods-price-box {
        padding: 18px;
        margin-bottom: 20px;
    }
    
    .current-price .price {
        font-size: 28px;
    }
    
    .current-price .original-price {
        font-size: 16px;
    }
    
    .goods-meta {
        gap: 15px;
        font-size: 13px;
    }
    
    .goods-category,
    .goods-delivery {
        padding: 12px 0;
    }
    
    .goods-quantity {
        padding: 18px 0;
    }
    
    .goods-actions {
        display: none; /* PC端按钮在移动端隐藏 */
    }
    
    .seller-info {
        padding: 18px;
        margin-top: 20px;
    }
    
    .certificate-links {
        padding: 18px;
        margin-top: 20px;
    }
    
    .certificate-links h3 {
        font-size: 16px;
        margin-bottom: 15px;
    }
    
    .cert-link {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .content-wrapper {
        width: 100%;
        padding: 20px 15px;
    }
    
    .content-wrapper h2 {
        font-size: 18px;
        margin-bottom: 20px;
    }
    
    .content-wrapper h2::before {
        width: 60px;
        height: 3px;
    }
    
    .content-body {
        font-size: 14px;
        line-height: 1.8;
        padding: 15px;
        text-align: left; /* 移动端也确保左对齐 */
        white-space: pre-wrap; /* 移动端也保留空格和换行符 */
    }
    
    /* 溯源与认证区块 - 移动端 */
    .certificate-section {
        padding: 30px 15px;
    }
    
    .cert-wrapper {
        width: 100%;
        padding: 0;
    }
    
    .cert-section-title {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .cert-section-title .ico {
        font-size: 24px;
    }
    
    .cert-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .cert-card {
        padding: 15px;
    }
    
    .cert-card-icon {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    .cert-card-title {
        font-size: 15px;
    }
    
    .cert-card-desc {
        font-size: 12px;
    }
    
    /* 移动端底部操作栏 */
    .mobile-bottom-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-top: 1px solid #e5e5e5;
        padding: 10px;
        z-index: 999;
        box-shadow: 0 -3px 15px rgba(0,0,0,0.1);
    }
    
    .mobile-bottom-bar .bar-item {
        width: 60px;
        text-align: center;
        font-size: 11px;
        color: #666;
        padding: 5px 0;
        text-decoration: none;
        transition: all 0.3s;
    }
    
    .mobile-bottom-bar .bar-item:active {
        background: #f5f5f5;
        border-radius: 8px;
    }
    
    .mobile-bottom-bar .bar-item .ico {
        font-size: 22px;
        display: block;
        margin-bottom: 3px;
        color: #999;
    }
    
    .mobile-bottom-bar .bar-btn {
        flex: 1;
        height: 42px;
        border: none;
        border-radius: 21px;
        font-size: 15px;
        font-weight: bold;
        margin: 0 5px;
        cursor: pointer;
        transition: all 0.3s;
    }
    
    .mobile-bottom-bar .btn-cart {
        background: #fff;
        color: #E83191;
        border: 2px solid #E83191;
    }
    
    .mobile-bottom-bar .btn-cart:active {
        background: #fff0f5;
    }
    
    .mobile-bottom-bar .btn-buy {
        background: linear-gradient(135deg, #E83191 0%, #d52a7f 100%);
        color: #fff;
    }
    
    .mobile-bottom-bar .btn-buy:active {
        background: linear-gradient(135deg, #d52a7f 0%, #c52070 100%);
    }
    
    body {
        padding-bottom: 70px;
        background: #f5f5f5;
    }
}

/* === 小屏手机优化 (< 480px) === */
@media (max-width: 480px) {
    .goods-title {
        font-size: 18px;
    }
    
    .current-price .price {
        font-size: 24px;
    }
    
    .goods-actions button {
        font-size: 15px;
        height: 50px;
    }
    
    .cert-link {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* === 动画效果 === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.shop-detail-container {
    animation: fadeIn 0.5s ease;
}

/* === 加载状态优化 === */
.main-image img[src=""],
.main-image img:not([src]) {
    background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}