* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    background-color: #f8d7da;
    min-height: 100vh;
    position: relative;
    padding-bottom: 70px;
}

/* 顶部标题 */
.app-header {
    background-color: #f8d7da;
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #e6b8bc;
}

.app-header h1 {
    font-size: 24px;
    color: #333;
    font-weight: bold;
}

/* 内容区域 */
.app-content {
    padding: 15px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* 横幅广告 */
.banner {
    margin-bottom: 20px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.banner img {
    width: 100%;
    display: block;
}

/* 功能按钮 */
.function-buttons {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
}

.func-btn {
    flex: 1;
    margin: 0 5px;
    padding: 12px 0;
    background-color: #f5e6e8;
    border: 2px solid #d4a5a9;
    border-radius: 15px;
    font-size: 18px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.func-btn:hover {
    background-color: #e6b8bc;
}

/* 章节标题 */
.section-title {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.cloud-icon {
    font-size: 24px;
    color: #a67c80;
    margin: 0 15px;
}

.section-title h2 {
    font-size: 28px;
    color: #5a3e41;
    font-weight: bold;
}

/* 商品网格 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.product-card {
    background-color: #f5e6e8;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.product-image {
    position: relative;
    height: 180px;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(255, 200, 200, 0.9);
    color: #333;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    writing-mode: vertical-rl;
    text-orientation: upright;
}

.product-info {
    padding: 12px;
}

.product-name {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
}

.product-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.coin-icon {
    color: #f39c12;
    margin-right: 5px;
}

.price {
    font-size: 18px;
    font-weight: bold;
    color: #d9534f;
}

.sales {
    font-size: 14px;
    color: #666;
}

/* 分类页样式 */
.search-bar {
    background-color: #e6b8bc;
    padding: 15px;
    margin: -15px -15px 15px -15px;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    background-color: #f5e6e8;
}

.search-icon {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 18px;
}

.category-container {
    display: flex;
    height: calc(100vh - 180px);
}

.category-sidebar {
    width: 120px;
    background-color: #f8d7da;
    border-right: 1px solid #e6b8bc;
    overflow-y: auto;
}

.category-logo {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #e6b8bc;
}

.category-logo img {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    margin-bottom: 5px;
}

.category-logo p {
    font-size: 14px;
    color: #333;
}

.category-list {
    list-style: none;
}

.category-list li {
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.category-list li.active {
    background-color: #f5e6e8;
    border-left-color: #d9534f;
    font-weight: bold;
}

.category-products {
    flex: 1;
    padding: 0 10px;
    overflow-y: auto;
}

.category-product-card {
    display: flex;
    background-color: #d9888f;
    border-radius: 15px;
    margin-bottom: 15px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.category-product-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.product-thumb {
    width: 100px;
    height: 100px;
    position: relative;
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-tag {
    position: absolute;
    top: 5px;
    left: 5px;
    background-color: rgba(255, 200, 200, 0.9);
    color: #333;
    padding: 3px 6px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: bold;
    writing-mode: vertical-rl;
    text-orientation: upright;
}

.product-details {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-title {
    font-size: 18px;
    color: #fff;
    margin-bottom: 10px;
}

.product-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-meta .price {
    color: #fff;
}

.product-meta .sales {
    color: #f0d0d3;
}

/* 我的页面样式 */
.profile-header {
    text-align: center;
    padding: 30px 0;
    background-color: #f8d7da;
    margin: -15px -15px 0 -15px;
}

.avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 15px;
    border: 3px solid #fff;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.username {
    font-size: 24px;
    color: #fff;
    font-weight: bold;
}

.balance-card {
    background-color: #f5e6e8;
    border-radius: 15px;
    padding: 20px;
    margin: -20px 15px 30px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid #d4a5a9;
}

.balance-info {
    display: flex;
    align-items: center;
}

.coin-icon.large {
    font-size: 36px;
    margin-right: 15px;
}

.balance-amount {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    display: block;
}

.balance-label {
    font-size: 16px;
    color: #666;
    margin-top: 5px;
}

.functions-section {
    background-color: #d4c4c6;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
}

.section-subtitle {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
}

.functions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.function-item {
    text-align: center;
    cursor: pointer;
}

.function-item i {
    font-size: 32px;
    color: #5a3e41;
    margin-bottom: 10px;
}

.function-item p {
    font-size: 14px;
    color: #333;
}

.footer-link {
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background-color: #b3868a;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    border-top: 1px solid #99666b;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    color: #f0d0d3;
    transition: all 0.3s ease;
}

.nav-item.active {
    color: #fff;
}

.nav-item i {
    font-size: 24px;
    margin-bottom: 5px;
}

.nav-item span {
    font-size: 14px;
}

/* 商品详情页样式 */
.detail-header {
    display: flex;
    align-items: center;
    background-color: #fff;
    padding: 15px;
    margin: -15px -15px 15px -15px;
    border-bottom: 1px solid #eee;
}

.back-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #333;
    cursor: pointer;
    margin-right: 15px;
}

.detail-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    flex: 1;
    text-align: center;
    margin-right: 35px;
}

.detail-banner {
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.detail-banner img {
    width: 100%;
    display: block;
}

.price-sales {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 0 10px;
}

.detail-price {
    font-size: 28px;
    font-weight: bold;
    color: #d9534f;
}

.detail-sales {
    font-size: 22px;
    color: #999;
}

.service-section {
    background-color: #fff;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 100px;
}

.service-title {
    font-size: 26px;
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-weight: bold;
}

.service-content {
    font-size: 18px;
    line-height: 2.2;
    color: #333;
}

.service-content p {
    margin-bottom: 20px;
}

/* 详情页底部栏 */
.detail-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background-color: #fff;
    padding: 15px;
    border-top: 1px solid #eee;
    display: none;
}

.contact-btn {
    width: 100%;
    padding: 15px;
    background-color: #fff;
    border: 2px solid #d4a5a9;
    border-radius: 25px;
    font-size: 22px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.contact-btn:hover {
    background-color: #f5e6e8;
}

/* 详情页时隐藏主底部导航 */
.detail-active #main-bottom-nav {
    display: none;
}

.detail-active #detail-bottom-bar {
    display: block;
}

/* 修复后的客服二维码弹窗样式 - 强制居中 */
.service-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    /* 核心：双轴居中，优先级最高 */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    /* 兜底：防止子元素溢出 */
    box-sizing: border-box;
}

/* 兼容 active 类和直接 display 赋值两种显隐方式 */
.service-modal.active,
.service-modal[style*="display: block"] {
    display: flex !important; /* 强制用 flex 布局居中 */
}

.modal-content {
    background-color: #fff;
    border-radius: 15px;
    width: 100%;
    max-width: 320px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    /* 兜底：防止弹窗本身偏移 */
    position: relative;
    top: 0;
    left: 0;
    transform: translate(0, 0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f8d7da;
    border-bottom: 1px solid #e6b8bc;
}

.modal-header h3 {
    font-size: 18px;
    color: #333;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    text-align: center;
}

.qrcode-container {
    margin-bottom: 15px;
}

.wechat-qrcode {
    width: 100%; /* 关键修复：二维码宽度占满容器 */
    max-width: 220px; /* 关键修复：限制二维码最大宽度 */
    height: auto; /* 关键修复：高度自动，保持比例 */
    border-radius: 10px;
    border: 5px solid #f8d7da;
    display: block;
    margin: 0 auto;
}

.service-time {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.service-tip {
    font-size: 14px;
    color: #999;
}

/* 空分类提示 */
.empty-message {
    text-align: center;
    padding: 50px 0;
    color: #999;
    font-size: 18px;
}

/* PC端适配 */
@media (min-width: 768px) {
    .app-container {
        max-width: 800px;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .category-container {
        height: calc(100vh - 160px);
    }
    
    .detail-bottom-bar {
        max-width: 800px;
    }
    
    .modal-content {
        max-width: 350px;
    }
}

@media (min-width: 1024px) {
    .app-container {
        max-width: 1000px;
    }
    
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .detail-bottom-bar {
        max-width: 1000px;
    }
}

/* 商务合作卡片弹窗样式 */
.business-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.business-modal .modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.business-modal .modal-header {
    background: #f8d7da;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.business-modal .modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.business-modal .close-modal {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.business-modal .modal-body {
    padding: 30px 20px;
    text-align: center;
}

.business-modal .wechat-label {
    font-size: 16px;
    color: #666;
    margin-bottom: 15px;
}

.business-modal .wechat-code {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.business-modal .wechat-code span {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    background: #f5f5f5;
    padding: 10px 20px;
    border-radius: 8px;
}

.business-modal .copy-btn {
    background: #f8d7da;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
}

.business-modal .copy-btn:hover {
    background: #f5c6cb;
}

.business-modal .tip {
    font-size: 14px;
    color: #999;
    margin: 0;
}