/* 全局样式 - 微信小程序风格 */
* {
    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: #f5f5f5; /* 微信灰背景 */
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* 页面切换 */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* 登录页面 - 微信风格 */
.login-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.login-header {
    text-align: center;
    padding: 60px 20px 40px;
    background: linear-gradient(135deg, #07c160 0%, #06ad56 100%); /* 微信绿 */
    color: white;
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: 500;
}

.login-header p {
    font-size: 14px;
    opacity: 0.9;
}

.login-form {
    padding: 30px 20px;
    flex: 1;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
    background: #fafafa;
}

.form-group input:focus {
    outline: none;
    border-color: #07c160;
    background: #fff;
}

.code-input-group {
    display: flex;
    gap: 10px;
}

.code-input-group input {
    flex: 1;
}

.hint {
    display: block;
    margin-top: 6px;
    color: #999;
    font-size: 12px;
}

/* 按钮样式 - 微信风格 */
.btn-primary {
    background: #07c160; /* 微信绿 */
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #06ad56;
}

.btn-primary:active {
    background: #059a4d;
    transform: scale(0.98);
}

.btn-secondary {
    background: #fff;
    color: #07c160;
    border: 1px solid #07c160;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-secondary:hover {
    background: #f0f9f4;
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-full {
    width: 100%;
}

.btn-icon {
    background: transparent;
    border: none;
    color: #07c160;
    font-size: 15px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(7, 193, 96, 0.1);
}

/* 登录页脚 */
.login-footer {
    margin-top: 20px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* 会员页面 - 微信风格 */
.member-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    background: #f5f5f5;
    min-height: 100vh;
}

.member-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    position: sticky;
    top: 0;
    z-index: 100;
}

.member-header h2 {
    flex: 1;
    font-size: 17px;
    color: #333;
    font-weight: 500;
}

/* 信息卡片 - 微信风格 */
.info-card {
    background: white;
    margin: 12px;
    border-radius: 8px;
    overflow: hidden;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
    border-bottom: none;
}

.balance-row {
    background: linear-gradient(135deg, #f0f9f4 0%, #e8f5ef 100%);
    padding: 20px 16px;
}

.info-label {
    color: #666;
    font-size: 15px;
}

.info-value {
    color: #333;
    font-size: 15px;
    font-weight: 500;
}

.balance-value {
    color: #07c160;
    font-size: 28px;
    font-weight: 600;
}

/* 消费记录区域 - 微信风格 */
.records-section {
    background: white;
    margin: 12px;
    border-radius: 8px;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.section-header h3 {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.record-count {
    color: #999;
    font-size: 13px;
}

/* 记录列表 - 微信聊天风格 */
.records-list {
    min-height: 100px;
}

.record-item {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.record-item:last-child {
    border-bottom: none;
}

.record-item:active {
    background: #f5f5f5;
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.record-type {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.record-type.recharge {
    background: #e8f5e9;
    color: #07c160;
}

.record-type.consume {
    background: #ffebee;
    color: #fa5151; /* 微信红 */
}

.record-amount {
    font-size: 17px;
    font-weight: 600;
    color: #333;
}

.record-amount.positive {
    color: #07c160;
}

.record-amount.negative {
    color: #fa5151;
}

.record-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #999;
}

.record-balance {
    color: #07c160;
    font-weight: 500;
}

.record-remark {
    margin-top: 6px;
    font-size: 13px;
    color: #666;
}

/* 加载更多 */
.load-more-container {
    padding: 16px 0;
    text-align: center;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

/* 加载状态 */
.loading-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.loading-state .loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    border: 3px solid #f0f0f0;
    border-top-color: #8b7355;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 提示框 - 微信风格 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s;
    text-align: center;
    min-width: 120px;
}

.toast.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.toast.error {
    background: rgba(250, 81, 81, 0.9); /* 微信红 */
}

.toast.success {
    background: rgba(7, 193, 96, 0.9); /* 微信绿 */
}

/* 响应式设计 */
@media (max-width: 480px) {
    .login-container {
        padding: 20px 15px;
    }

    .member-container {
        padding: 15px;
    }

    .info-card,
    .records-section {
        padding: 16px;
    }

    .balance-value {
        font-size: 20px;
    }
}

/* ==================== 全屏加载遮罩 - 微信风格 ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: none; /* 默认隐藏 */
    justify-content: center;
    align-items: center;
    z-index: 99999;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-overlay .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(7, 193, 96, 0.1);
    border-top-color: #07c160; /* 微信绿 */
    border-radius: 50%;
    animation: spin 0.8s ease-in-out infinite;
}
