* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f5f5;
    padding-bottom: 60px;
}

.page {
    display: none;
    padding: 15px;
    min-height: calc(100vh - 60px);
}

.page.active {
    display: block;
}

/* 轮播图 */
.banner-container {
    margin: -15px -15px 15px;
    overflow: hidden;
}

.banner-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.banner-slider img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* 公告栏 */
.announcement-bar {
    background: #fff3cd;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 5px;
    font-size: 14px;
    color: #856404;
}

/* 筛选器 */
.merchant-filter,
.group-filter {
    background: white;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 5px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.merchant-filter select,
.group-filter select {
    flex: 1;
    min-width: 120px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.merchant-filter label,
.group-filter label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

/* 商家列表 */
.merchant-list {
    display: grid;
    gap: 15px;
}

.merchant-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.merchant-card:active {
    transform: scale(0.98);
}

.merchant-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #333;
}

.merchant-card .info {
    font-size: 14px;
    color: #666;
    margin: 5px 0;
}

.merchant-card .badge {
    display: inline-block;
    padding: 3px 8px;
    background: #007bff;
    color: white;
    border-radius: 3px;
    font-size: 12px;
    margin-top: 8px;
}

/* 拼团列表 */
.group-list {
    display: grid;
    gap: 15px;
}

.group-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.group-card:active {
    transform: scale(0.98);
}

.group-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.group-card .content {
    padding: 15px;
}

.group-card h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: #333;
}

.group-card .merchant-name {
    font-size: 13px;
    color: #999;
    margin-bottom: 10px;
}

.group-card .price {
    font-size: 24px;
    color: #ff4444;
    font-weight: bold;
}

.group-card .info {
    font-size: 13px;
    color: #666;
    margin-top: 8px;
}

.group-card .progress {
    margin-top: 10px;
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
}

.group-card .progress-bar {
    height: 100%;
    background: #28a745;
    transition: width 0.3s;
}

/* 个人中心 */
.profile-header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-right: 15px;
}

.user-info {
    flex: 1;
}

.user-info div:first-child {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.user-info div:last-child {
    font-size: 14px;
    color: #999;
}

.balance-section {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.balance-section h3 {
    font-size: 16px;
    margin-bottom: 10px;
}

.balance-section select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

.balance-display {
    font-size: 32px;
    color: #ff4444;
    font-weight: bold;
    text-align: center;
    padding: 20px 0;
}

#roleContent {
    background: white;
    padding: 15px;
    border-radius: 8px;
}

.role-section {
    margin-bottom: 20px;
}

.role-section h3 {
    font-size: 16px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s;
}

.btn:active {
    background: #0056b3;
}

.btn-success {
    background: #28a745;
}

.btn-success:active {
    background: #1e7e34;
}

.btn-danger {
    background: #dc3545;
}

.btn-danger:active {
    background: #bd2130;
}

.btn-small {
    display: inline-block;
    width: auto;
    padding: 6px 12px;
    font-size: 14px;
    margin: 5px 5px 5px 0;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    display: flex;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #999;
    font-size: 14px;
    transition: color 0.2s;
}

.nav-item.active {
    color: #007bff;
}

/* 表单 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-tip {
    padding: 10px;
    background: #e7f3ff;
    border-left: 3px solid #007bff;
    font-size: 13px;
    color: #666;
    margin-top: 10px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
}

.modal-header .close {
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.modal-header .close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.modal-footer .btn {
    margin-top: 0;
}

/* 商品列表 */
.product-list {
    display: grid;
    gap: 10px;
}

.product-item {
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-item .info {
    flex: 1;
}

.product-item .name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.product-item .price {
    color: #ff4444;
    font-size: 14px;
}

.product-item .actions {
    display: flex;
    gap: 5px;
}

/* 拼团列表（管理） */
.group-manage-list {
    display: grid;
    gap: 10px;
}

.group-manage-item {
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 5px;
}

.group-manage-item .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.group-manage-item .name {
    font-size: 16px;
    font-weight: bold;
}

.group-manage-item .status {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
}

.status-pending {
    background: #ffc107;
    color: white;
}

.status-approved {
    background: #28a745;
    color: white;
}

.status-rejected {
    background: #dc3545;
    color: white;
}

.group-manage-item .info {
    font-size: 14px;
    color: #666;
    margin: 5px 0;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 20px;
    color: #999;
}

.empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 详情页样式 */
.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
}

.detail-section .detail-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.detail-section .detail-item:last-child {
    border-bottom: none;
}

.detail-section .detail-item .label {
    color: #666;
}

.detail-section .detail-item .value {
    color: #333;
    font-weight: 500;
}

.detail-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 15px;
}

/* 响应式 */
@media (max-width: 480px) {
    .modal-content {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
    }

    .merchant-filter,
    .group-filter {
        flex-direction: column;
        align-items: stretch;
    }

    .merchant-filter select,
    .group-filter select {
        width: 100%;
    }
}
