/* 全局样式 */
* {
    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: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
}

/* 页面切换 */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* 登录页面 */
.login-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header h1 {
    font-size: 28px;
    color: #333;
    margin-bottom: 10px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

.login-form {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #8b7355;
}

.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: #8b7355;
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: #7a6348;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 115, 85, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: #8b7355;
    border: 2px solid #8b7355;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-secondary:hover {
    background: #f5f0e8;
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-full {
    width: 100%;
}

.btn-icon {
    background: transparent;
    border: none;
    color: #8b7355;
    font-size: 16px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: rgba(139, 115, 85, 0.1);
}

/* 登录页脚 */
.login-footer {
    margin-top: 20px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* 会员页面 */
.member-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.member-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px 0;
}

.member-header h2 {
    flex: 1;
    font-size: 20px;
    color: #333;
}

/* 信息卡片 */
.info-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
    border-bottom: none;
}

.balance-row {
    padding-top: 16px;
    margin-top: 4px;
}

.info-label {
    color: #666;
    font-size: 15px;
}

.info-value {
    color: #333;
    font-size: 15px;
    font-weight: 500;
}

.balance-value {
    color: #8b7355;
    font-size: 24px;
    font-weight: bold;
}

/* 消费记录区域 */
.records-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f5f0e8;
}

.section-header h3 {
    font-size: 18px;
    color: #333;
}

.record-count {
    color: #999;
    font-size: 13px;
}

/* 记录列表 */
.records-list {
    min-height: 100px;
}

.record-item {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.record-item:last-child {
    border-bottom: none;
}

.record-item:hover {
    background: #fafafa;
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.record-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.record-type.recharge {
    background: #e8f5e9;
    color: #2e7d32;
}

.record-type.consume {
    background: #ffebee;
    color: #c62828;
}

.record-amount {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.record-amount.positive {
    color: #2e7d32;
}

.record-amount.negative {
    color: #c62828;
}

.record-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #999;
}

.record-balance {
    color: #8b7355;
    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;
}

.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: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.error {
    background: #d32f2f;
}

.toast.success {
    background: #388e3c;
}

/* 响应式设计 */
@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.75);
    display: flex;
    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;
}

.spinner {
    position: relative;
    width: 60px;
    height: 60px;
}

.spinner::before,
.spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner::before {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(139, 115, 85, 0.3) 0%, transparent 70%);
    animation: pulse 2s ease-in-out infinite;
}

.spinner::after {
    width: 48px;
    height: 48px;
    top: 6px;
    left: 6px;
    border: 3px solid rgba(139, 115, 85, 0.15);
    border-top-color: #8b7355;
    border-right-color: #a89070;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.05); }
}
