/* 商城团购H5样式 - 蓝色主题 */
:root {
    --primary-color: #1677ff;
    --primary-light: #e6f4ff;
    --primary-dark: #0958d9;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --border-color: #e8e8e8;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --error-color: #ff4d4f;
    --gradient-blue: linear-gradient(135deg, #1677ff 0%, #0958d9 100%);
    --gradient-orange: linear-gradient(135deg, #ff9500 0%, #ff6200 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* 底部导航 */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #fff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border-color);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 10px;
    transition: all 0.3s;
}

.tab-item.active {
    color: var(--primary-color);
}

.tab-item .icon {
    font-size: 22px;
    margin-bottom: 2px;
}

/* 页面容器 */
.page-container {
    padding-bottom: 70px;
    min-height: 100vh;
}

/* 头部搜索 */
.header {
    background: var(--gradient-blue);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 99;
}

.search-box {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
}

.search-box .icon {
    color: var(--text-tertiary);
    font-size: 16px;
    margin-right: 8px;
}

/* 通用头部 */
.header {
    background: var(--gradient-blue);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left,
.header-right {
    width: 60px;
    display: flex;
    align-items: center;
}

.header-right {
    justify-content: flex-end;
}

.header-title {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 500;
}

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 13px;
    cursor: pointer;
}

/* 区块样式 */
.section {
    background: var(--card-bg);
    margin: 12px;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* 订单商品项 */
.order-item {
    padding: 12px 0;
}

.order-item-content {
    display: flex;
    gap: 12px;
}

.order-item-image {
    width: 80px;
    height: 80px;
    background: var(--bg-color);
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.order-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.order-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.order-item-info h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

.order-item-category {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.order-item-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.order-item-price span:first-child {
    font-size: 14px;
    color: var(--error-color);
    font-weight: 600;
}

.order-item-total {
    font-size: 16px;
    color: var(--error-color);
    font-weight: 700;
}

/* 表单样式 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-color);
    outline: none;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    background: white;
}

.form-group textarea {
    resize: none;
    min-height: 80px;
}

/* 价格信息 */
.price-info {
    background: var(--primary-light);
    border-radius: 8px;
    padding: 16px;
}

.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.price-item.total {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--primary-color);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.price-item.total span:last-child {
    color: var(--error-color);
    font-size: 20px;
    font-weight: 700;
}

/* 提交按钮区域 */
.submit-section {
    padding: 16px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--border-color);
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--gradient-blue);
    color: white;
}

.btn-primary:active {
    opacity: 0.9;
    transform: scale(0.98);
}

.btn:disabled {
    background: var(--text-tertiary);
    cursor: not-allowed;
}

/* Toast提示 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 商品卡片 */
.goods-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.goods-image {
    width: 100%;
    height: 180px;
    background: var(--bg-color);
    position: relative;
}

.goods-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.goods-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--gradient-orange);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.goods-info {
    padding: 12px;
}

.goods-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.goods-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.goods-price {
    font-size: 18px;
    color: var(--error-color);
    font-weight: 700;
}

.goods-original-price {
    font-size: 12px;
    color: var(--text-tertiary);
    text-decoration: line-through;
}

.goods-sales {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-left: auto;
}

/* 商品列表 */
.goods-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px;
}

/* 分类标签 */
.category-tabs {
    display: flex;
    gap: 8px;
    padding: 12px;
    overflow-x: auto;
    background: white;
    position: sticky;
    top: 56px;
    z-index: 98;
    border-bottom: 1px solid var(--border-color);
}

.category-tab {
    padding: 8px 16px;
    background: var(--bg-color);
    border: none;
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s;
}

.category-tab.active {
    background: var(--primary-color);
    color: white;
}

/* 轮播图 */
.swiper {
    width: 100%;
    height: 200px;
    background: var(--bg-color);
}

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

/* 用户信息卡片 */
.user-card {
    background: var(--gradient-blue);
    padding: 24px 16px;
    color: white;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.user-name {
    font-size: 18px;
    font-weight: 500;
}

.user-phone {
    font-size: 13px;
    opacity: 0.9;
    margin-top: 4px;
}

/* 菜单列表 */
.menu-list {
    background: white;
    margin-top: 12px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-primary);
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-icon {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    color: var(--primary-color);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-text {
    flex: 1;
    font-size: 15px;
}

.menu-arrow {
    color: var(--text-tertiary);
    font-size: 14px;
}

/* 钱包样式 */
.wallet-balance {
    background: var(--gradient-blue);
    padding: 32px 16px;
    text-align: center;
    color: white;
}

.balance-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.balance-amount {
    font-size: 40px;
    font-weight: 700;
}

.wallet-actions {
    display: flex;
    padding: 16px;
    background: white;
    gap: 12px;
}

.wallet-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}

.wallet-btn.primary {
    background: var(--primary-color);
    color: white;
}

.wallet-btn.default {
    background: var(--bg-color);
    color: var(--text-primary);
}

/* 订单列表 */
.order-list {
    padding: 12px;
}

.order-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.order-no {
    font-size: 13px;
    color: var(--text-tertiary);
}

.order-status {
    font-size: 13px;
    color: var(--primary-color);
    font-weight: 500;
}

.order-status.completed {
    color: var(--success-color);
}

.order-status.cancelled {
    color: var(--text-tertiary);
}

.order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.order-total {
    font-size: 14px;
    color: var(--text-secondary);
}

.order-total span {
    color: var(--error-color);
    font-weight: 700;
}

.order-actions {
    display: flex;
    gap: 8px;
}

.order-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 15px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.order-btn.primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 登录注册 */
.login-container {
    min-height: 100vh;
    background: white;
    padding: 40px 24px;
}

.login-logo {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo img {
    width: 80px;
    height: 80px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form input {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    outline: none;
}

.login-form input:focus {
    border-color: var(--primary-color);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: var(--gradient-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    margin-top: 24px;
    cursor: pointer;
}

.login-links {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    font-size: 13px;
}

.login-links a {
    color: var(--primary-color);
    text-decoration: none;
}

/* 佣金页面 */
.commission-header {
    background: var(--gradient-blue);
    padding: 32px 16px;
    text-align: center;
    color: white;
}

.commission-amount {
    font-size: 36px;
    font-weight: 700;
    margin: 8px 0;
}

.commission-stats {
    display: flex;
    justify-content: space-around;
    padding: 16px;
    background: white;
    margin-top: 12px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* 分类页面 */
.category-page {
    display: flex;
    height: 100vh;
}

.category-sidebar {
    width: 90px;
    background: var(--bg-color);
    overflow-y: auto;
}

.category-item {
    padding: 16px 8px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    border-left: 3px solid transparent;
}

.category-item.active {
    background: white;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.category-content {
    flex: 1;
    background: white;
    overflow-y: auto;
    padding: 16px;
}

.category-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.subcategory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.subcategory-item {
    text-align: center;
}

.subcategory-icon {
    width: 60px;
    height: 60px;
    background: var(--bg-color);
    border-radius: 50%;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.subcategory-name {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 商品详情 */
.detail-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 100;
    transition: background 0.3s;
}

.detail-header.scrolled {
    background: white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.detail-header.scrolled .back-btn {
    color: var(--text-primary);
}

.detail-gallery {
    width: 100%;
    height: 375px;
    background: var(--bg-color);
}

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

.detail-info {
    background: white;
    padding: 16px;
}

.detail-price-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
}

.detail-price {
    font-size: 28px;
    color: var(--error-color);
    font-weight: 700;
}

.detail-original-price {
    font-size: 14px;
    color: var(--text-tertiary);
    text-decoration: line-through;
}

.detail-sales {
    margin-left: auto;
    font-size: 13px;
    color: var(--text-tertiary);
}

.detail-title {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-primary);
}

.detail-section {
    background: white;
    margin-top: 12px;
    padding: 16px;
}

.detail-section-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
}

.detail-content {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.detail-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 8px 0;
}

/* 底部操作栏 */
.detail-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: white;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-top: 1px solid var(--border-color);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.detail-footer-left {
    display: flex;
    gap: 16px;
    padding: 0 12px;
}

.footer-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-secondary);
    font-size: 10px;
}

.footer-icon i {
    font-size: 20px;
}

.detail-footer-right {
    flex: 1;
    display: flex;
    gap: 8px;
}

.footer-btn {
    flex: 1;
    height: 40px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.footer-btn.cart {
    background: var(--gradient-orange);
    color: white;
}

.footer-btn.buy {
    background: var(--gradient-blue);
    color: white;
}

/* 购物车 */
.cart-item {
    display: flex;
    padding: 16px;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.cart-checkbox {
    display: flex;
    align-items: center;
    padding-right: 12px;
}

.cart-checkbox input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
}

.cart-image {
    width: 90px;
    height: 90px;
    background: var(--bg-color);
    border-radius: 8px;
    overflow: hidden;
    margin-right: 12px;
}

.cart-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cart-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

.cart-spec {
    font-size: 12px;
    color: var(--text-tertiary);
}

.cart-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-price {
    font-size: 16px;
    color: var(--error-color);
    font-weight: 700;
}

.cart-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-secondary);
}

.qty-input {
    width: 40px;
    text-align: center;
    border: none;
    font-size: 14px;
}

/* 购物车底部 */
.cart-footer {
    position: fixed;
    bottom: 56px;
    left: 0;
    right: 0;
    height: 56px;
    background: white;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-top: 1px solid var(--border-color);
    z-index: 99;
}

.cart-total {
    flex: 1;
    text-align: right;
    margin-right: 12px;
}

.cart-total-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.cart-total-price {
    font-size: 18px;
    color: var(--error-color);
    font-weight: 700;
}

.cart-submit {
    padding: 10px 24px;
    background: var(--gradient-blue);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* 确认订单 */
.address-card {
    background: white;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.address-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 18px;
}

.address-info {
    flex: 1;
}

.address-name {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
}

.address-phone {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-left: 8px;
}

.address-detail {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.address-arrow {
    color: var(--text-tertiary);
}

.order-summary {
    background: white;
    margin-top: 12px;
    padding: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.summary-row.total {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.summary-row.total .price {
    color: var(--error-color);
    font-size: 20px;
}

/* 加载更多 */
.load-more {
    text-align: center;
    padding: 16px;
    font-size: 13px;
    color: var(--text-tertiary);
}

.load-more.error {
    color: var(--error-color);
}

/* 商品列表加载占位 */
.goods-list.loading {
    min-height: 200px;
    position: relative;
}

/* 骨架屏动画 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 错误提示 */
.error-tip {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.error-tip .icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.error-tip p {
    font-size: 14px;
    margin-bottom: 16px;
}

.error-tip .retry-btn {
    display: inline-block;
    padding: 8px 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

/* 空数据提示 */
.empty-tip {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.empty-tip .icon {
    font-size: 64px;
    margin-bottom: 16px;
    display: block;
}

.empty-tip p {
    font-size: 14px;
}
