/* style.css - 完整样式表 */
:root {
    --primary: #4A90D9;
    --primary-dark: #357ABD;
    --success: #4CAF50;
    --danger: #F44336;
    --warning: #FF9800;
    --bg: #f5f6fa;
    --card-bg: #fff;
    --text: #333;
    --text-light: #777;
    --border: #e0e0e0;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* 导航栏 */
.navbar {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #fff;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 15px rgba(0,0,0,0.3);
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    min-height: 56px;
}
.nav-brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    margin-right: 2rem;
    white-space: nowrap;
}
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
}
.nav-toggle span {
    display: block;
    width: 26px;
    height: 3px;
    background: #fff;
    border-radius: 3px;
    transition: 0.3s;
}
.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}
.nav-link {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
    white-space: nowrap;
}
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}
.nav-user {
    padding: 0.5rem 0.8rem;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    white-space: nowrap;
}
.nav-logout {
    color: #ff6b6b !important;
}

/* 主体 */
.main-container {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

/* 卡片 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.card h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: #444;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.6rem;
}

/* 卡片网格 */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.card-income { border-left: 4px solid var(--success); }
.card-expense { border-left: 4px solid var(--danger); }
.card-net { border-left: 4px solid var(--primary); }
.card-today { border-left: 4px solid var(--warning); }
.card-info { border-left: 4px solid #9C27B0; }

.card-icon { font-size: 2rem; margin-bottom: 0.3rem; }
.card-label { font-size: 0.85rem; color: var(--text-light); margin-bottom: 0.2rem; }
.card-value { font-size: 1.4rem; font-weight: 700; }
.card-value.small { font-size: 1rem; }
.card-value.positive { color: var(--success); }
.card-value.negative { color: var(--danger); }

/* 进度条 */
.progress-bar-container {
    background: #e9ecef;
    border-radius: 20px;
    height: 28px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    transition: width 0.6s ease;
    min-width: 50px;
}
.progress-bar.progress-done {
    background: linear-gradient(90deg, #FFD700, #FFA000);
}

/* 回本卡片 */
.payback-card, .payback-analysis-card {
    border: 2px solid #e8f5e9;
}
.payback-info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
}
.payback-status {
    font-weight: 700;
    color: var(--primary);
}
.payback-highlight {
    text-align: center;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #f9fafb;
    border-radius: 10px;
}
.payback-big-number {
    font-size: 1.3rem;
    font-weight: 700;
}

/* 表格 */
.table-responsive {
    overflow-x: auto;
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.table th {
    background: #f8f9fa;
    padding: 0.7rem 0.8rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}
.table td {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid #eee;
}
.table tr:hover td {
    background: #fafbfc;
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
}
.badge-income { background: #e8f5e9; color: #2e7d32; }
.badge-expense { background: #ffebee; color: #c62828; }
.badge-platform { background: #e3f2fd; color: #1565c0; }

/* 按钮 */
.btn {
    display: inline-block;
    padding: 0.55rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #e9ecef; color: #333; }
.btn-secondary:hover { background: #dee2e6; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #d32f2f; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; border-radius: 6px; }
.btn-block { display: block; width: 100%; }

/* 表单 */
.form-card { border-left: 4px solid var(--primary); }
.record-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.8rem;
}
.form-group { margin-bottom: 0.8rem; }
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    color: #555;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 0.55rem 0.8rem;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border 0.2s;
    background: #fff;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74,144,217,0.1);
}
.form-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

/* 提示 */
.alert {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 500;
}
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-error { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.alert-info { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }
.alert-card { background: #fffde7; border: 1px solid #fff9c4; }
.empty-hint { color: #999; text-align: center; padding: 2rem; }

/* 分页 */
.pagination {
    display: flex;
    gap: 0.3rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* 图表 */
.chart-card .chart-wrapper {
    position: relative;
    height: 350px;
    max-height: 450px;
}
.chart-card canvas {
    max-height: 400px;
}

/* 迷你柱状条 */
.mini-bar-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.mini-bar {
    height: 8px;
    background: var(--danger);
    border-radius: 4px;
    min-width: 2px;
    transition: width 0.4s;
}

/* 折旧卡片 */
.depreciation-card {
    border-left: 4px solid #9C27B0;
}

/* 认证页面 */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}
.auth-container {
    width: 100%;
    max-width: 420px;
}
.auth-card {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    text-align: center;
}
.auth-logo { font-size: 3.5rem; margin-bottom: 0.5rem; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 0.3rem; }
.auth-subtitle { color: #888; margin-bottom: 1.5rem; font-size: 0.9rem; }
.auth-form { text-align: left; }
.auth-form .form-group { margin-bottom: 1rem; }
.auth-form .btn { margin-top: 0.5rem; padding: 0.7rem; font-size: 1rem; }
.auth-switch { margin-top: 1.2rem; font-size: 0.9rem; color: #888; }
.auth-switch a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* 页脚 */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: #aaa;
    font-size: 0.85rem;
}

/* 响应式 */
@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .nav-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        padding: 0.5rem 0 1rem;
        gap: 0.2rem;
    }
    .nav-menu.active { display: flex; }
    .nav-link { width: 100%; text-align: center; padding: 0.6rem; }
    .nav-user { text-align: center; width: 100%; }
    
    .cards-grid { grid-template-columns: 1fr 1fr; }
    .record-form .form-row { grid-template-columns: 1fr; }
    .chart-card .chart-wrapper { height: 250px; }
    .card { padding: 1rem; }
    .card-value { font-size: 1.2rem; }
    .auth-card { padding: 1.5rem; }
    
    .payback-info-row { flex-direction: column; gap: 0.3rem; }
}

@media (max-width: 480px) {
    .cards-grid { grid-template-columns: 1fr; }
    .table { font-size: 0.78rem; }
    .table th, .table td { padding: 0.4rem 0.5rem; }
    .nav-brand { font-size: 1.1rem; }
    h2 { font-size: 1.2rem; }
}