/* ============================================
   云禾优选 - 产品详情页样式（修正版）
   ============================================ */

/* ========== 页面容器 ========== */
.shop-detail-page {
    background: var(--color-bg);
    min-height: 100vh;
    padding-bottom: 70px; /* 为底部导航留出空间 */
}

/* ========== Swiper 轮播 ========== */
.farm-swiper {
    width: 100%;
    height: 375px;
    background: #fff;
}
.farm-swiper .swiper-slide img {
    width: 100%;
    height: 375px;
    object-fit: cover;
}
.farm-swiper .swiper-button-prev,
.farm-swiper .swiper-button-next {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.85);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.farm-swiper .swiper-button-prev::after,
.farm-swiper .swiper-button-next::after {
    font-size: 0.9rem;
    font-weight: 700;
    color: #333;
}
.farm-swiper .swiper-pagination-bullet-active {
    background: #198754;
}
.swiper-indicator {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 12px;
    z-index: 10;
}
.img-placeholder {
    width: 100%;
    height: 375px;
    background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #2d6a4f;
}
.img-placeholder i { font-size: 5rem; margin-bottom: 0.5rem; }
.img-placeholder p { font-size: 0.9rem; margin: 0; }

/* ========== 修复轮播被生长阶段遮挡 ========== */
.stage-item-thumb,
.stage-item-thumb.has-photo {
    overflow: visible !important;
    z-index: 1;
}

/* ========== 修复轮播点击失效 ========== */
.detail-images-scroll img {
    pointer-events: auto !important;
}

/* 左右箭头 */
.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    border: none;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;

    /* ✅ 改这两行 */
    z-index: 9999;
    pointer-events: auto;
}

.slider-arrow {
    position: absolute;
    z-index: 9999;
    pointer-events: auto;
}

.slider-prev { left: 12px; }
.slider-next { right: 12px; }

/* 圆点 */
.slider-dots {
    position: absolute;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 3;
}

.slider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
}

.slider-dot.active {
    background: #198754;
}

/* ========== 缩略图导航条 ========== */
.farm-thumb-swiper {
    width: 100%;
    height: 60px;
    background: #fff;
    padding: 6px 0;
}
.farm-thumb-swiper .swiper-slide {
    width: 60px;
    opacity: 0.5;
    cursor: pointer;
}
.farm-thumb-swiper .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}
.farm-thumb-swiper .swiper-slide-thumb-active {
    opacity: 1;
    border: 2px solid #198754;
    border-radius: 6px;
}

/* ========== 产品信息 ========== */
.detail-info {
    background: #fff;
    padding: 16px;
    margin-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.detail-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

/* 状态标签 */
.product-status-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
    margin-bottom: 10px;
}

.product-status-tag.on-sale {
    background: #e8f5e9;
    color: #2d6a4f;
    border: 1px solid #c3e6cb;
}

.product-status-tag.growing {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffd8a6;
}

/* 价格区域 */
.price-section {
    margin: 12px 0;
}

.price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.price-label {
    font-size: 0.75rem;
    color: #666;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
}

.price-current {
    font-size: 1.4rem;
    font-weight: 700;
    color: #dc3545;
    display: flex;
    align-items: baseline;
}

.price-current small {
    font-size: 0.7rem;
    font-weight: 400;
    color: #999;
    margin-left: 2px;
}

.price-original {
    font-size: 0.85rem;
    color: #999;
    text-decoration: line-through;
}

.detail-stock {
    font-size: 0.85rem;
    color: #666;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-stock i {
    color: #2d6a4f;
}

/* 农场信息卡片 */
.farm-info-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #2d6a4f;
    font-weight: 600;
    margin-top: 10px;
    border: 1px solid #e8f5e9;
    transition: all 0.2s;
}

.farm-info-card:hover {
    background: #e8f5e9;
    transform: translateY(-1px);
}

.farm-info-card i {
    font-size: 1.2rem;
}

.farm-name {
    flex: 1;
    font-size: 0.9rem;
}

.farm-arrow {
    color: #999;
    font-size: 0.9rem;
}

/* ========== 分区卡片 ========== */
.detail-section {
    background: #fff;
    padding: 16px;
    margin-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.section-header i {
    color: #2d6a4f;
    font-size: 1rem;
}

.section-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

/* 产品描述 */
.detail-desc {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.8;
    white-space: pre-line;
    margin: 0;
}

/* ========== 溯源信息 ========== */
.traceability-info {
    font-size: 0.85rem;
    color: #666;
}

.trace-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.trace-item i {
    color: #999;
    width: 16px;
}

.trace-label {
    color: #999;
}

.trace-code {
    font-weight: 700;
    color: #2d6a4f;
    font-family: monospace;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
}

/* ========== 生长溯源 - 带缩略图 ========== */
.stage-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.85rem;
}

.stage-item-row:last-child {
    border-bottom: none;
}

/* 缩略图 */
.stage-item-thumb {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* 缩略图链接 */
.stage-item-thumb a {
    display: block;
    width: 100%;
    height: 100%;
}

.stage-item-thumb a img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stage-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 名称 + 日期 */
.stage-item-info {
    flex: 1;
}

.stage-item-name {
    font-weight: 600;
    color: #333;
    display: block;
}

.stage-item-row.done .stage-item-name {
    color: #52c41a;
}

.stage-item-row.active .stage-item-name {
    color: #1890ff;
}

.stage-item-date {
    font-size: 0.72rem;
    color: #bbb;
    margin-top: 2px;
}

/* 状态标签 */
.stage-item-badge {
    font-size: 0.7rem;
    padding: 2px 10px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-done {
    background: #e8f5e9;
    color: #52c41a;
}

.badge-active {
    background: #e3f2fd;
    color: #1890ff;
}

/* 持续天数 */
.stage-item-days {
    color: #bbb;
}

/* 备注 */
.stage-item-notes {
    display: block;
    font-size: 0.72rem;
    color: #999;
    margin-top: 4px;
    line-height: 1.4;
}

/* 缩略图可点击 */
.stage-item-thumb.has-photo {
    cursor: pointer;
    position: relative;
}
.photo-count-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #2d6a4f;
    color: #fff;
    font-size: 0.55rem;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #fff;
}

/* 图片预览弹窗 */
.photo-viewer {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
}
.photo-viewer-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9);
}
.photo-viewer-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
}
.photo-viewer-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 2;
}
.photo-viewer-title {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 16px;
}
.photo-viewer-images {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    max-width: 100%;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
}
.photo-viewer-images::-webkit-scrollbar { display: none; }
.photo-viewer-images img {
    max-height: 60vh;
    max-width: 90vw;
    scroll-snap-align: center;
    border-radius: 8px;
    flex-shrink: 0;
}

/* 查看照片详情链接 */
.stage-detail-link {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 0.7rem;
    color: #2d6a4f;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 12px;
    background: #e8f5e9;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 4px;
}

/* ========== 底部操作栏 ========== */
.detail-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    display: flex;
    height: 52px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bn-left {
    flex: 2;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.bn-right {
    flex: 1;
    display: flex;
}

.bn-right .bn-follow {
    width: 100%;
    height: 100%;
    border: none;
    background: #198754;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.bn-right .bn-follow:active {
    background: #146c43;
}

.bn-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #b0b0b0;
    font-size: 0.7rem;
    gap: 2px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    min-width: 44px;
    padding: 4px;
}

.bn-item i {
    font-size: 1.2rem;
    -webkit-text-stroke: 1px #b0b0b0;
    color: transparent;
}

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
    .shop-detail-page {
        padding-bottom: 60px;
    }
    
    .detail-images-scroll img {
        max-height: 70vh;
    }
} /* ✅ 这里添加了闭合大括号 */

/* ========== Toast样式 ========== */
.detail-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
    max-width: 90%;
    text-align: center;
}

.detail-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.detail-toast.hide {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-20px);
}

.detail-toast.success {
    background: #2d6a4f;
    border-left: 4px solid #1b4332;
}

.detail-toast.error {
    background: #dc3545;
    border-left: 4px solid #c82333;
}

.detail-toast.info {
    background: #17a2b8;
    border-left: 4px solid #138496;
}

/* 按钮状态 */
.bn-buy.loading {
    opacity: 0.7;
    pointer-events: none;
}

.bn-buy.success {
    background: #28a745 !important;
    animation: pulse 0.5s ease;
}

#shareOverlay {
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========== 图片加载动画 ========== */
@keyframes shine {
    to {
        background-position-x: -200%;
    }
}

.product-image:not(.loaded) {
    background: linear-gradient(110deg, #f0f7f3 8%, #e5f0eb 18%, #f0f7f3 33%);
    background-size: 200% 100%;
    animation: 1.5s shine linear infinite;
}

.product-image.loaded {
    animation: none;
    background: #f5f5f5;
}

/* ========== 时间线动画 ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stage-row.animate {
    animation: fadeInUp 0.5s ease forwards;
}

/* 为每个阶段项添加延迟动画 */
.stage-row:nth-child(1) { animation-delay: 0.1s; }
.stage-row:nth-child(2) { animation-delay: 0.2s; }
.stage-row:nth-child(3) { animation-delay: 0.3s; }
.stage-row:nth-child(4) { animation-delay: 0.4s; }
.stage-row:nth-child(5) { animation-delay: 0.5s; }
.stage-row:nth-child(6) { animation-delay: 0.6s; }

/* ========== 按钮脉冲动画 ========== */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

/* ========== 购物车角标动画 ========== */
@keyframes badgeBounce {
    0% { transform: scale(0.5); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ========== 移动端Toast调整 ========== */
@media (max-width: 768px) {
    .detail-toast {
        top: 10px;
        padding: 10px 16px;
        font-size: 0.9rem;
        max-width: calc(100% - 20px);
    }
}