/* ===== 商家详情页容器 ===== */
#pageMerchant {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg, #F8F5F2);
    z-index: 100;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ===== 顶部导航（透明浮层） ===== */
.merchant-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: transparent;
    z-index: 200;
    transition: background 0.3s;
    pointer-events: none;
}

.merchant-header > * {
    pointer-events: auto;
}

/* ✅ 滚动后变实底 */
.merchant-header.solid {
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
}

.back-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 22px;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.back-btn:active {
    background: rgba(0, 0, 0, 0.6);
}

.merchant-header.solid .back-btn {
    background: var(--color-bg);
    color: var(--color-text);
}

.merchant-title {
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    flex: 1;
    text-align: center;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    transition: color 0.3s;
}

.merchant-header.solid .merchant-title {
    color: var(--color-text);
    text-shadow: none;
}

/* ✅ 收藏按钮 */
.merchant-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.favorite-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.merchant-header.solid .favorite-btn {
    background: var(--color-bg);
}

/* ===== 顶部大图容器（不限制高度，让缩略图能显示） ===== */
#galleryContainer {
    position: relative;
    width: 100%;
    padding: 0 16px;
    background: var(--color-bg);
    box-sizing: border-box;
    /* ✅ 不设 aspect-ratio，不设 overflow: hidden */
}

/* ===== 大图（3/4 竖长图） ===== */
.gallery-main {
    width: 100%;
    aspect-ratio: 3/4;              /* ✅ 图片比例 3:4 */
    position: relative;
    border-radius: 16px;            /* ✅ 圆角 */
    overflow: hidden;
    background: var(--color-bg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ✅ 顶部渐变遮罩，让按钮看得清 */
.gallery-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
    z-index: 2;
    pointer-events: none;
}

/* ✅ 底部渐变遮罩，让卡片过渡自然 */
.gallery-main::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to top, var(--color-bg), transparent);
    z-index: 2;
    pointer-events: none;
}

/* ✅ 计数器 */
.gallery-counter {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 16px;
    z-index: 5;
}

/* ===== 缩略图（在大图下面） ===== */
.gallery-thumbnails {
    display: flex;
    gap: 8px;
    padding: 12px 0 0;              /* ✅ 缩略图和图片的间距 */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.gallery-thumbnails::-webkit-scrollbar {
    display: none;
}

.gallery-thumb {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
    background: var(--color-bg);
}

.gallery-thumb:active {
    transform: scale(0.95);
}

.gallery-thumb.active {
    border-color: var(--color-primary);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== 商家信息卡片（浮在大图上） ===== */
.merchant-info {
    position: relative;
    margin: -12px 16px 0;           /* ✅ 只叠 12px */
    padding: 16px 16px 14px;
    background: var(--color-bg-card);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    z-index: 10;
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.merchant-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

/* ✅ 价格标签 */
.merchant-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark, #E55A2B) 100%);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
    flex-shrink: 0;
}

.rating-value {
    font-size: 16px;
}

/* ✅ meta 标签 */
.merchant-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.meta-tag {
    font-size: 12px;
    color: var(--color-text-secondary);
    background: var(--color-bg);
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
}

/* ✅ 标签 */
.merchant-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

.merchant-tags .tag {
    font-size: 12px;
    color: var(--color-primary);
    background: var(--color-primary-light, #FFE8DD);
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
}

/* ===== 商家详情段落 ===== */
.merchant-detail-section {
    padding: 0 16px;
    margin: 16px 0;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    margin: 16px 0 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.merchant-detail-text {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.8;
    background: var(--color-bg-card);
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===== 评价区 ===== */
.reviews-section {
    padding: 0 16px 100px;
}

#reviewsList {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.review-item {
    background: var(--color-bg-card);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    border-left: 3px solid transparent;
    transition: transform 0.2s;
}

.review-item:active {
    transform: scale(0.99);
}

.review-item.highlight {
    border-left-color: var(--color-primary);
    background: var(--color-primary-light, #FFF5F0);
}

.review-item .review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.review-item .reviewer {
    font-weight: 600;
    color: var(--color-text);
    font-size: 14px;
}

.review-item .review-content {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin: 4px 0 0;
}

.review-item .review-time {
    font-size: 11px;
    color: var(--color-text-light);
}

/* ===== 底部联系按钮（悬浮 + 渐变） ===== */
#contactButton {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px 20px;
    background: linear-gradient(to top, var(--color-bg-card) 70%, transparent);
    z-index: 100;
}

#contactBtn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #0088cc 0%, #006699 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 136, 204, 0.35);
    transition: transform 0.15s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#contactBtn:active {
    transform: scale(0.97);
    box-shadow: 0 3px 12px rgba(0, 136, 204, 0.5);
}