/* 科技未来感主题 - Cyberpunk/Sci-Fi Style */

/* 基础变量 */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-card-hover: rgba(30, 41, 59, 0.9);
    --neon-blue: #00d4ff;
    --neon-purple: #a855f7;
    --neon-green: #22c55e;
    --neon-pink: #ec4899;
    --neon-orange: #f97316;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: rgba(100, 116, 139, 0.3);
    --glow-blue: 0 0 20px rgba(0, 212, 255, 0.3);
    --glow-purple: 0 0 20px rgba(168, 85, 247, 0.3);
    --glow-green: 0 0 20px rgba(34, 197, 94, 0.3);
    --gradient-main: linear-gradient(135deg, #00d4ff, #a855f7);
    --gradient-card: linear-gradient(145deg, rgba(17, 24, 39, 0.9), rgba(30, 41, 59, 0.7));
    --radius: 16px;
    --radius-sm: 10px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding-bottom: 80px;
    -webkit-font-smoothing: antialiased;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(0, 212, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(168, 85, 247, 0.08) 0%, transparent 50%);
}

/* ==================== 底部导航栏 ==================== */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 14, 23, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 70px;
    border-top: 1px solid var(--border);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    transition: all 0.3s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.tab-item.active {
    color: var(--neon-blue);
}

.tab-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: var(--neon-blue);
    border-radius: 0 0 4px 4px;
    box-shadow: var(--glow-blue);
}

.tab-item i {
    font-size: 22px;
    margin-bottom: 4px;
    transition: all 0.3s;
}

.tab-item.active i {
    filter: drop-shadow(0 0 8px var(--neon-blue));
}

.tab-item span {
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* ==================== 头部区域 ==================== */
.header {
    background: linear-gradient(180deg, rgba(0, 212, 255, 0.15), transparent);
    padding: 20px 16px 24px;
    position: relative;
    border-bottom: 1px solid var(--border);
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-main);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: var(--glow-blue);
}

.user-greeting {
    font-size: 14px;
    color: var(--text-secondary);
}

.user-greeting strong {
    color: var(--neon-blue);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 20px;
    color: #f87171;
    text-decoration: none;
    font-size: 12px;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
}

/* 收支汇总卡片 */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.summary-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
    transition: all 0.3s;
}

.summary-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--neon-blue);
    box-shadow: var(--glow-blue);
}

.summary-card .label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.summary-card .amount {
    font-size: 18px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.summary-card .amount.income {
    color: var(--neon-green);
    text-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.summary-card .amount.expense {
    color: var(--neon-pink);
    text-shadow: 0 0 10px rgba(236, 72, 153, 0.5);
}

/* ==================== 通用卡片 ==================== */
.card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 12px 16px;
    backdrop-filter: blur(10px);
    overflow: hidden;
    transition: all 0.3s;
}

.card:hover {
    border-color: rgba(0, 212, 255, 0.3);
    box-shadow: var(--glow-blue);
}

.card-header {
    padding: 16px;
    font-weight: 600;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
}

.card-header i {
    color: var(--neon-blue);
    margin-right: 8px;
}

.card-body {
    padding: 16px;
}

/* ==================== 筛选栏 ==================== */
.filter-bar {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.filter-chip.active {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(168, 85, 247, 0.2));
    color: var(--neon-blue);
    border-color: var(--neon-blue);
    box-shadow: var(--glow-blue);
}

.filter-chip:active {
    transform: scale(0.95);
}

/* ==================== 查询开关 ==================== */
.toggle-filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.toggle-switch.active {
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    border-color: var(--neon-blue);
    box-shadow: var(--glow-blue);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s;
}

.toggle-switch.active::after {
    left: 22px;
}

/* ==================== 交易记录列表 ==================== */
.transaction-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    transition: all 0.3s;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.transaction-item:hover {
    background: rgba(0, 212, 255, 0.05);
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 20px;
    transition: all 0.3s;
}

.transaction-icon.expense {
    background: rgba(236, 72, 153, 0.15);
    color: var(--neon-pink);
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.transaction-icon.income {
    background: rgba(34, 197, 94, 0.15);
    color: var(--neon-green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.transaction-info {
    flex: 1;
    min-width: 0;
}

.transaction-info .category {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.transaction-info .desc {
    font-size: 12px;
    color: var(--text-muted);
}

.transaction-amount {
    font-size: 16px;
    font-weight: 700;
    margin-left: 12px;
    font-family: 'JetBrains Mono', monospace;
}

.transaction-amount.expense {
    color: var(--neon-pink);
}

.transaction-amount.income {
    color: var(--neon-green);
}

.transaction-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 8px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
    color: var(--neon-blue);
}

.empty-state p {
    margin-bottom: 16px;
}

/* ==================== 语音按钮 ==================== */
.voice-btn {
    position: fixed;
    right: 20px;
    bottom: 90px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-main);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: none;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
}

.voice-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 212, 255, 0.6);
}

.voice-btn.listening {
    animation: pulse 1.5s infinite;
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
    box-shadow: 0 0 30px rgba(236, 72, 153, 0.6);
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 20px rgba(236, 72, 153, 0.4); }
    50% { transform: scale(1.1); box-shadow: 0 0 40px rgba(236, 72, 153, 0.6); }
    100% { transform: scale(1); box-shadow: 0 0 20px rgba(236, 72, 153, 0.4); }
}

/* 浮动添加按钮 */
.fab {
    position: fixed;
    right: 20px;
    bottom: 90px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-main);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: none;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
    text-decoration: none;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 212, 255, 0.6);
}

/* ==================== 表单样式 ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transition: all 0.3s;
    -webkit-appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--neon-blue);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15), var(--glow-blue);
    background: rgba(255, 255, 255, 0.08);
}

.form-input::placeholder {
    color: var(--text-muted);
}

textarea.form-input {
    min-height: 100px;
    resize: vertical;
}

select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* 类型选择器 */
.type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.type-btn {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-secondary);
}

.type-btn.expense.active {
    border-color: var(--neon-pink);
    background: rgba(236, 72, 153, 0.15);
    color: var(--neon-pink);
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.2);
}

.type-btn.income.active {
    border-color: var(--neon-green);
    background: rgba(34, 197, 94, 0.15);
    color: var(--neon-green);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.2);
}

.type-btn:active {
    transform: scale(0.98);
}

/* 分类网格 */
.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
}

.category-item.selected {
    border-color: var(--neon-blue);
    background: rgba(0, 212, 255, 0.1);
    color: var(--neon-blue);
    box-shadow: var(--glow-blue);
}

.category-item:active {
    transform: scale(0.95);
}

.category-item i {
    font-size: 24px;
    margin-bottom: 4px;
}

.category-item span {
    font-size: 11px;
    text-align: center;
}

/* ==================== 按钮样式 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    letter-spacing: 0.5px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--gradient-main);
    color: white;
    width: 100%;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 25px rgba(0, 212, 255, 0.5);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* ==================== 统计页面 ==================== */
.stat-card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 12px 16px;
}

.chart-container {
    position: relative;
    height: 250px;
    margin: 16px 0;
}

.stat-list {
    margin-top: 16px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item .name {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.stat-item .name .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.stat-item .value {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

/* 统计视图切换 */
.scope-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.scope-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.3s;
}

.scope-tab.active {
    background: var(--gradient-main);
    color: white;
    box-shadow: var(--glow-blue);
}

/* ==================== 家庭管理 ==================== */
.member-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.member-item:last-child {
    border-bottom: none;
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-main);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-weight: 600;
}

.member-info {
    flex: 1;
}

.member-name {
    font-weight: 500;
    color: var(--text-primary);
}

.member-role {
    font-size: 12px;
    color: var(--text-muted);
}

.invite-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--neon-blue);
    text-shadow: var(--glow-blue);
    background: rgba(0, 212, 255, 0.1);
    padding: 16px;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 1px dashed var(--neon-blue);
}

/* ==================== 日期选择器 ==================== */
.date-range {
    display: flex;
    gap: 8px;
    align-items: center;
}

.date-input {
    flex: 1;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    -webkit-appearance: none;
}

.date-input:focus {
    border-color: var(--neon-blue);
    box-shadow: var(--glow-blue);
}

/* ==================== 提示消息 ==================== */
.toast-msg {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 12px 24px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--neon-blue);
    border-radius: 10px;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s;
    box-shadow: var(--glow-blue);
}

.toast-msg.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==================== 语音识别面板 ==================== */
.voice-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 14, 23, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--neon-blue);
    padding: 24px 16px;
    transform: translateY(100%);
    transition: transform 0.3s;
    z-index: 1100;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

.voice-panel.show {
    transform: translateY(0);
}

.voice-status {
    text-align: center;
    margin-bottom: 16px;
}

.voice-status .icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-main);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 28px;
    animation: pulse 1.5s infinite;
}

.voice-status .text {
    color: var(--text-secondary);
    font-size: 14px;
}

.voice-result {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    min-height: 60px;
    color: var(--text-primary);
    font-size: 16px;
    text-align: center;
}

.voice-actions {
    display: flex;
    gap: 10px;
}

.voice-actions .btn {
    flex: 1;
}

/* ==================== 加载状态 ==================== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    margin: 12px auto;
    border: 3px solid var(--border);
    border-top-color: var(--neon-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== 辅助类 ==================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.p-4 { padding: 16px; }
.hidden { display: none !important; }

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neon-blue);
}
