/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基础变量 */
:root {
    --primary-color: #00ccff;
    --primary-dark: #0099cc;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --bg-primary: #0a0a0a;
    --bg-secondary: #1e1e1e;
    --bg-card: #1a1a1a;
    --border-radius: 12px;
    --shadow: 0 4px 12px rgba(0, 204, 255, 0.15);
    --glow: 0 0 10px rgba(0, 204, 255, 0.5);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
}

/* 登录/注册页面样式 */
.login-container,
.register-container {
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    justify-content: center;
}

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

.logo h1 {
    font-size: 28px;
    color: var(--primary-color);
    font-weight: 600;
}

.form-group {
    width: 100%;
    margin-bottom: 20px;
}

.form-group input {
    width: 100%;
    padding: 15px;
    background-color: var(--bg-secondary);
    border: 1px solid rgba(0, 204, 255, 0.2);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

.form-group input:focus {
    border-color: var(--primary-color);
    box-shadow: var(--glow);
}

/* 主要按钮样式 */
.primary-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all 0.6s ease;
    z-index: -1;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(0, 204, 255, 0.7);
}

.primary-btn:hover::before {
    left: 100%;
}

.primary-btn:active {
    transform: translateY(0);
}

.switch-mode {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.switch-mode a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

/* 主应用样式 */
#main-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-container {
    flex: 1;
    padding: 20px;
    padding-bottom: 80px; /* 为TabBar留出空间 */
}

/* ===== 弹窗组件样式 ===== */

/* 弹窗遮罩层 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

/* 基础弹窗容器 */
.modal-container {
    width: 90%;
    max-width: 320px;
    background-color: var(--bg-secondary);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease-out;
    transform-origin: center;
}

/* 弹窗头部 */
.modal-header {
    padding: 20px 20px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* 弹窗内容 */
.modal-body {
    padding: 20px;
    text-align: center;
}

.modal-message {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

/* 弹窗按钮区域 */
.modal-footer {
    display: flex;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-button {
    flex: 1;
    padding: 16px;
    border: none;
    background-color: transparent;
    color: var(--primary-color);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-button:first-child {
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-button:active {
    background-color: rgba(255, 255, 255, 0.05);
}

/* 成功提示弹窗 */
.success-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(76, 175, 80, 0.95);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    animation: toastAppear 0.3s ease-out;
    min-width: 180px;
    text-align: center;
    font-size: 15px;
}

/* 加载中弹窗 */
.loading-modal {
    background-color: rgba(0, 0, 0, 0.8);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    min-width: 150px;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    color: var(--text-primary);
    font-size: 14px;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: scale(0.9);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes toastAppear {
    from { 
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to { 
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

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

/* TabBar样式 */
.tab-bar,
.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 600px;
    margin: 0 auto;
    height: 60px;
    background-color: var(--bg-secondary);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tab-item::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background-color: var(--primary-color);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

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

.tab-item.active::before {
    width: 40px;
}

.tab-item:hover:not(.active) {
    color: var(--primary-color);
    opacity: 0.8;
}

.tab-item span {
    font-size: 12px;
    margin-top: 4px;
}

/* 图标样式（使用简单的Unicode字符作为示例） */
.icon-home::before { content: "🏠"; }
.icon-device::before { content: "📱"; }
.icon-invite::before { content: "👥"; }
.icon-profile::before { content: "👤"; }

/* 卡片样式 */
.card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 204, 255, 0.2);
    border-color: rgba(0, 204, 255, 0.3);
}

/* 用户信息卡片 */
.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 24px;
}

.user-details h3 {
    font-size: 18px;
    margin-bottom: 5px;
}

.user-details p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 统计数据样式 */
.stats-grid {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

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

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px;
}

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

/* 主要操作按钮 */
.main-action-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    transition: all 0.3s ease;
    box-shadow: var(--glow);
    position: relative;
    overflow: hidden;
}

.main-action-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 204, 255, 0.7), 0 0 30px rgba(0, 204, 255, 0.3);
}

.main-action-btn:active {
    transform: scale(0.98);
}

.main-action-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    transform: rotate(45deg);
    animation: shimmer 2s infinite;
    opacity: 0;
}

.main-action-btn:hover::after {
    opacity: 1;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.main-action-btn::before {
    content: "⚡";
    font-size: 32px;
    margin-bottom: 8px;
}

/* 次要操作按钮组 */
.action-buttons {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    gap: 15px;
}

.secondary-btn {
    width: 120px;
    padding: 15px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius);
    color: var(--primary-color);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.secondary-btn::before {
    margin-right: 8px;
    font-size: 18px;
    transition: transform 0.3s ease;
}

.secondary-btn.recharge::before { content: "💵"; }
.secondary-btn.withdraw::before { content: "🏦"; }

.secondary-btn:hover {
    background-color: var(--primary-color);
    color: var(--bg-primary);
    transform: translateY(-2px);
    box-shadow: var(--glow);
}

.secondary-btn:hover::before {
    transform: scale(1.2) rotate(10deg);
}

.secondary-btn:active {
    transform: translateY(0);
}

/* 收益统计样式 */
.income-stats h2 {
    font-size: 20px;
    margin-bottom: 15px;
}

.income-grid {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.income-item {
    text-align: center;
    flex: 1;
}

.income-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

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

/* 公告栏样式 */
.notice-bar {
    background: linear-gradient(90deg, rgba(0, 204, 255, 0.2), rgba(0, 153, 204, 0.2));
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.notice-bar::before {
    content: "📢";
    margin-right: 10px;
    font-size: 20px;
}

.notice-bar p {
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 500;
}

/* 设备列表样式 */
.device-section h2 {
    font-size: 20px;
    margin-bottom: 15px;
}

.device-item {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-info h3 {
    font-size: 16px;
    margin-bottom: 5px;
}

.device-info p {
    font-size: 14px;
    color: var(--text-secondary);
}

.device-status {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.device-status.active {
    background-color: rgba(0, 204, 255, 0.2);
    color: var(--primary-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .stats-grid,
    .income-grid {
        flex-wrap: wrap;
    }
    
    .stat-item,
    .income-item {
        width: 50%;
        margin-bottom: 15px;
    }
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
}

.loading::after {
    content: "";
    width: 30px;
    height: 30px;
    border: 3px solid rgba(0, 204, 255, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 数据数字增长动画 */
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-value, .income-value {
    animation: countUp 0.5s ease-out;
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 输入框聚焦增强效果 */
.form-group input:focus {
    border-color: var(--primary-color);
    box-shadow: var(--glow);
    transform: scale(1.01);
}

/* 渐入动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-container > * {
    animation: fadeInUp 0.6s ease-out;
}

.content-container > *:nth-child(1) { animation-delay: 0.1s; }
.content-container > *:nth-child(2) { animation-delay: 0.2s; }
.content-container > *:nth-child(3) { animation-delay: 0.3s; }
.content-container > *:nth-child(4) { animation-delay: 0.4s; }

/* 搜索栏样式 */
.search-bar {
    position: relative;
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    background-color: var(--bg-secondary);
    border: 1px solid rgba(0, 204, 255, 0.2);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
}

.search-bar::after {
    content: "🔍";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* 个人中心样式 */
.profile-header {
    position: relative;
    padding: 30px 20px 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    margin-bottom: 20px;
    text-align: center;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--text-primary);
    border: 3px solid var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 32px;
    color: var(--primary-color);
}

.profile-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 5px;
}

.profile-wallet {
    font-size: 14px;
    opacity: 0.9;
}

/* 设置项样式 */
.settings-list {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 20px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.setting-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

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

.setting-label {
    font-size: 16px;
}

.setting-arrow {
    color: var(--text-secondary);
}

/* 邀请页面样式 */
.invite-header {
    text-align: center;
    margin-bottom: 30px;
}

.invite-header h2 {
    font-size: 24px;
    margin-bottom: 15px;
}

.invite-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

.invite-code {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid var(--primary-color);
}

.invite-code h3 {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.code-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: 2px;
    margin-bottom: 15px;
}

.copy-btn {
    padding: 10px 25px;
    background-color: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    color: var(--bg-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.share-options {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
}

.share-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.share-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    font-size: 24px;
}

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

/* 租用页面样式 */
.rent-form {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.rent-form h2 {
    font-size: 20px;
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.form-row .form-group {
    width: 48%;
}

.amount-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.amount-option {
    flex: 1 1 calc(33.333% - 10px);
    padding: 15px;
    background-color: var(--bg-primary);
    border: 1px solid rgba(0, 204, 255, 0.2);
    border-radius: var(--border-radius);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.amount-option:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 204, 255, 0.15);
}

.amount-option.selected {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: rgba(0, 204, 255, 0.05);
    box-shadow: 0 0 10px rgba(0, 204, 255, 0.3);
}

.amount-option.selected::before {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 12px;
    color: var(--primary-color);
}

/* 充值页面样式 */
.payment-methods {
    margin-bottom: 20px;
}

.payment-method {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.payment-method::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background-color: var(--primary-color);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.payment-method:hover {
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.payment-method:hover::after {
    transform: translateX(0);
}

.payment-method.selected {
    border-color: var(--primary-color);
    background-color: rgba(0, 204, 255, 0.05);
}

.payment-method.selected::after {
    transform: translateX(0);
}

.payment-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 20px;
}

.payment-info h3 {
    font-size: 16px;
    margin-bottom: 5px;
}

.payment-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 提现页面样式 */
.withdraw-form .form-group {
    margin-bottom: 20px;
}

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

.withdrawal-record {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 15px;
}

.withdrawal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.withdrawal-amount {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

.withdrawal-status {
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 12px;
    background-color: rgba(0, 204, 255, 0.2);
    color: var(--primary-color);
}

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

/* 退出登录按钮 */
.logout-btn {
    width: 100%;
    padding: 15px;
    background-color: rgba(255, 87, 87, 0.2);
    border: 1px solid #ff5757;
    border-radius: var(--border-radius);
    color: #ff5757;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background-color: #ff5757;
    color: var(--text-primary);
}