/* index.css */

/* ==================== 页面容器 - 核心修改：限制最大宽度并居中 ==================== */
.container {
    width: 100%;
    max-width: 480px;        /* 限制最大宽度，避免PC端过宽 */
    margin: 0 auto;          /* 居中显示 */
    padding: 0 16px;         /* 左右留白 */
    box-sizing: border-box;  /* 确保padding不撑大宽度 */
}

/* ==================== 顶部标题栏 - 增加与轮播图的间距 ==================== */
.header {
    margin-bottom: 12px;     /* 标题与轮播图之间留12px间距 */
}

/* ==================== 轮播图区域 - 整页滑动设计 ==================== */
.swiper {
    width: 100%;
    height: 360px;
    border-radius: 24px;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 
        0 20px 60px rgba(102, 126, 234, 0.3),
        0 8px 25px rgba(0,0,0,0.15);
    touch-action: pan-y;
    user-select: none;
}

.swiper-wrapper {
    display: flex;
    height: 100%;
    width: 100%;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.swiper-slide {
    position: relative;
    width: 100%;
    height: 100%;
    flex: 0 0 100%;
    overflow: hidden;
    cursor: grab;
}

.swiper-slide:active {
    cursor: grabbing;
}

/* 图片样式 - 全屏覆盖 */
.swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    pointer-events: none;
}

/* 渐变遮罩层 */
.swiper-slide::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(to top, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none;
    z-index: 1;
}

/* 分页指示器 */
.swiper-pagination {
    position: absolute;
    bottom: 16px;
    right: 16px;
    left: auto;
    width: auto;
    display: flex;
    gap: 6px;
    z-index: 10;
}

.swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: rgba(255,255,255,0.4);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.2);
}

.swiper-pagination-bullet-active {
    background: #fff;
    transform: scale(1.3);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* 滑动提示 */
.swipe-hint {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    opacity: 0;
    animation: hintPulse 2s ease-in-out 3;
    pointer-events: none;
    z-index: 5;
    border: 1px solid rgba(255,255,255,0.2);
}

.swipe-hint-left {
    left: 16px;
    animation-delay: 0.5s;
}

.swipe-hint-right {
    right: 16px;
    animation-delay: 1s;
}

@keyframes hintPulse {
    0%, 100% { opacity: 0; transform: translateY(-50%) scale(0.8); }
    50% { opacity: 0.8; transform: translateY(-50%) scale(1); }
}

/* ==================== 当前图片描述卡片 ==================== */
.recommend-card {
    background: linear-gradient(135deg, #fff9f0, #fff5e6);
    border-left: 4px solid #ff9f43;
    padding: 18px 20px;
    margin-bottom: 16px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(255,159,67,0.08);
    position: relative;
    overflow: hidden;
    width: 100%;
}

.recommend-card::before {
    content: '"';
    position: absolute;
    top: -10px;
    right: 10px;
    font-size: 60px;
    color: rgba(255,159,67,0.1);
    font-family: Georgia, serif;
    line-height: 1;
}

.recommend-text {
    font-size: 15px;
    font-weight: 500;
    color: #8b4513;
    text-align: center;
    line-height: 1.6;
    min-height: 24px;
    position: relative;
    z-index: 1;
    transition: opacity 0.3s ease;
}

/* ==================== 商家信息卡 ==================== */
.merchant-card {
    width: 100%;
}

/* 【优化】商家名称样式 - 去掉图标，突出显示 */
.merchant-card .merchant-name {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 16px;
    color: #2d3436;
    display: block;
    text-align: center;
    letter-spacing: 1px;
    /* 渐变文字效果 */
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /* 文字阴影增加层次感 */
    text-shadow: none;
    /* 底部装饰线 */
    position: relative;
    padding-bottom: 12px;
}

/* 底部装饰线 */
.merchant-card .merchant-name::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #00b894, #00cec9);
    border-radius: 2px;
}

.merchant-card .flex {
    margin-bottom: 12px;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    width: 100%;
}

.merchant-card .flex:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

.merchant-card .flex i {
    color: #ff9f43;
    width: 20px;
    text-align: center;
    margin-right: 8px;
    flex-shrink: 0;
}

.merchant-card .flex span {
    flex: 1;
    color: #636e72;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-link {
    color: #00b894;
    text-decoration: none;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    transition: all 0.2s;
    background: rgba(0,184,148,0.1);
    font-size: 13px;
    border: 1px solid rgba(0,184,148,0.2);
    flex-shrink: 0;
    margin-left: 8px;
}

.btn-link:hover {
    background: rgba(0,184,148,0.2);
    transform: translateY(-1px);
}

.btn-link:active {
    transform: scale(0.95);
}

/* ==================== 微信二维码卡片 ==================== */
.qrcard {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 24px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
    width: 100%;
}

.qrcard::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0,184,148,0.03) 0%, transparent 70%);
    pointer-events: none;
}

.qr-wrapper {
    position: relative;
    width: 160px;
    height: 160px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 
        0 8px 32px rgba(0,0,0,0.12),
        0 2px 8px rgba(0,0,0,0.08),
        inset 0 0 0 1px rgba(255,255,255,0.5);
    background: #fff;
    margin-bottom: 16px;
    padding: 10px;
    transition: transform 0.3s ease;
}

.qr-wrapper:hover {
    transform: translateY(-4px);
}

.qrcard img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.qrcard img[src]:not([src=""]) {
    opacity: 1;
}

.qr-loading {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #b2bec3;
    font-size: 12px;
    z-index: 1;
    border-radius: 8px;
    gap: 8px;
}

.qr-loading::before {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid #dfe6e9;
    border-top-color: #00b894;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.qrcard-text {
    font-size: 14px;
    color: #636e72;
    text-align: center;
    line-height: 1.8;
    font-weight: 500;
}

.qrcard-text strong {
    color: #2d3436;
    font-weight: 600;
}

/* ==================== 特色标签 - 关键优化区域 ==================== */

/* 标签外层包装 - 确保底部间距 */
.tags-wrapper {
    width: 100%;
    margin-bottom: 20px; /* 与卡片间距一致 */
}

/* 标签容器 - 多重防护防止被导航栏遮挡 */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px;
    width: 100%;
    min-height: fit-content;
    align-items: flex-start;
    /* 关键优化：大幅增加底部外边距，确保不被固定导航栏遮挡 */
    margin-bottom: 0; /* 由 wrapper 控制间距 */
}

.tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa, #f1f3f4);
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 14px;
    color: #636e72;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0,0,0,0.06);
    cursor: default;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.4;
    height: auto;
    min-height: 36px;
}

.tag:hover {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,184,148,0.25);
    border-color: transparent;
}

/* ==================== 底部安全区域 - 防止固定导航栏遮挡内容 ==================== */
.bottom-safe-area {
    width: 100%;
    height: 80px; /* 基础高度：导航栏高度 */
    /* 关键：支持 iPhone 刘海屏安全区域 */
    height: calc(80px + env(safe-area-inset-bottom, 0px));
    height: calc(80px + constant(safe-area-inset-bottom, 0px)); /* iOS 11.0 兼容 */
    flex-shrink: 0;
}

/* ==================== 底部导航栏样式 - 使用margin居中，避免transform偏差 ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;                 /* 左边界对齐视口 */
    right: 0;                /* 右边界对齐视口 */
    width: 100%;             /* 默认全宽 */
    max-width: 480px;        /* 与 .container 的 max-width 一致 */
    margin: 0 auto;          /* 水平居中关键 */
    height: 60px;
    padding-left: 16px;      /* 左右留白与内容区一致 */
    padding-right: 16px;
    /* 支持 iPhone 底部安全区域 */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-bottom: constant(safe-area-inset-bottom, 0px);
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    border-top: 1px solid rgba(0,0,0,0.05);
    box-sizing: border-box;  /* 确保padding计入总宽度 */
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: #999;
    text-decoration: none;
    font-size: 12px;
    transition: all 0.2s;
}

.nav-item i {
    font-size: 20px;
    margin-bottom: 4px;
}

.nav-item.active {
    color: #00b894;
}

.nav-item:active {
    transform: scale(0.9);
}

/* ==================== 通用卡片样式 ==================== */
.card {
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

/* ==================== 响应式优化 ==================== */
@media (max-width: 480px) {
    .container {
        max-width: 100%;    /* 小屏幕时恢复全宽 */
        padding: 0 16px;    /* 保留左右边距 */
    }
    
    .swiper {
        height: 300px;
        border-radius: 20px;
    }
    
    .tags {
        padding: 16px;
        gap: 8px;
    }
    
    .tag {
        padding: 8px 14px;
        font-size: 13px;
        min-height: 32px;
    }
    
    .qr-wrapper {
        width: 140px;
        height: 140px;
    }
    
    .bottom-safe-area {
        height: 70px;
        height: calc(70px + env(safe-area-inset-bottom, 0px));
    }
    
    .bottom-nav {
        max-width: 100%;     /* 小屏幕时导航栏全宽 */
        height: 50px;
        padding-left: 16px;
        padding-right: 16px;
        /* 支持 iPhone 底部安全区域 */
        padding-bottom: env(safe-area-inset-bottom, 0px);
        padding-bottom: constant(safe-area-inset-bottom, 0px);
    }
    
    /* 【优化】小屏幕商家名称 */
    .merchant-card .merchant-name {
        font-size: 20px;
    }
}

/* 超小屏幕适配 */
@media (max-width: 320px) {
    .container {
        padding: 0 12px;      /* 超小屏幕稍微减小边距 */
    }
    
    .tags {
        padding: 12px;
        gap: 6px;
    }
    
    .tag {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .bottom-nav {
        padding-left: 12px;
        padding-right: 12px;
        /* 支持 iPhone 底部安全区域 */
        padding-bottom: env(safe-area-inset-bottom, 0px);
        padding-bottom: constant(safe-area-inset-bottom, 0px);
    }
    
    /* 【优化】超小屏幕商家名称 */
    .merchant-card .merchant-name {
        font-size: 18px;
    }
}