/* SpendUp - 移动端优先样式 */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.5;
}

.app {
    min-height: 100vh;
    padding-bottom: 60px;
}

/* 容器 */
.container {
    padding: 16px;
    max-width: 100%;
}

/* 页面 */
.page {
    min-height: 100vh;
    background-color: #f5f5f5;
}

/* 头部 */
.header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
}

.header .back {
    position: absolute;
    left: 16px;
    font-size: 20px;
    color: #333;
    text-decoration: none;
}

.header .btn-add {
    position: absolute;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1890ff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    text-decoration: none;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #1890ff;
    color: white;
}

.btn-primary:active {
    background: #096dd9;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: none;
    border: none;
    color: #1890ff;
    font-size: 14px;
    cursor: pointer;
}

/* 表单 */
.form {
    margin-top: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #666;
}

.form-group input,
.form-group select {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1890ff;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 认证页面 */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 320px;
}

.logo {
    font-size: 32px;
    font-weight: bold;
    color: #1890ff;
    text-align: center;
    margin-bottom: 8px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 32px;
}

.auth-form {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.auth-links {
    text-align: center;
    margin-top: 16px;
}

.auth-links a {
    color: #1890ff;
    text-decoration: none;
}

/* 卡片 */
.card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 交易列表 */
.filter-bar {
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-bar select {
    flex: 1;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

.btn-link {
    color: #1890ff;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}

.transactions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.transaction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 12px;
    border-radius: 8px;
}

.transaction-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border-radius: 8px;
}

.transaction-info {
    flex: 1;
}

.transaction-category {
    font-weight: 500;
}

.transaction-meta {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.transaction-meta span {
    margin-right: 8px;
}

.transaction-amount {
    font-weight: 600;
    font-size: 16px;
}

.transaction-amount.income {
    color: #52C41A;
}

.transaction-amount.expense {
    color: #333;
}

/* 交易操作按钮 */
.transaction-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.btn-edit {
    padding: 4px 8px;
    font-size: 12px;
    background: #1890ff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-delete-small {
    padding: 4px 8px;
    font-size: 12px;
    background: #ff4d4f;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.loading {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

/* 类型选择器 */
.type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.type-btn {
    flex: 1;
    height: 44px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 16px;
    cursor: pointer;
}

.type-btn.active {
    background: #1890ff;
    color: white;
    border-color: #1890ff;
}

/* 统计 */
.period-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.period-btn {
    flex: 1;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

.period-btn.active {
    background: #1890ff;
    color: white;
    border-color: #1890ff;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.stat-card {
    background: white;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
}

.stat-card.income .stat-value {
    color: #52C41A;
}

.stat-card.expense .stat-value {
    color: #FF6B6B;
}

.stat-card.balance .stat-value {
    color: #1890ff;
}

h2 {
    font-size: 16px;
    margin: 16px 0 12px;
}

.chart-container {
    background: white;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
}

/* 家庭成员 */
.invite-code-section {
    text-align: center;
}

.invite-code-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.invite-code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 24px;
    font-weight: bold;
    color: #1890ff;
}

.members-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 12px;
    border-radius: 8px;
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1890ff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.member-info {
    flex: 1;
}

.member-name {
    font-weight: 500;
}

.member-role {
    font-size: 12px;
    color: #999;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: white;
    border-top: 1px solid #eee;
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    text-decoration: none;
    color: #666;
}

.nav-item.active {
    color: #1890ff;
}

.nav-item .icon {
    font-size: 20px;
}

.nav-item .label {
    font-size: 10px;
    margin-top: 2px;
}

/* 提示 */
.hint {
    text-align: center;
    color: #999;
    font-size: 14px;
    margin-top: 16px;
    padding: 0 16px;
}

/* Toast */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1000;
    display: none;
}

.toast.show {
    display: block;
}

/* 平板适配 */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
        margin: 0 auto;
    }

    .stats-overview {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 桌面适配 */
@media (min-width: 1024px) {
    .container {
        max-width: 960px;
    }
}

/* 分类管理 */
.type-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    background: white;
    padding: 8px;
    border-radius: 8px;
}

.type-tab {
    flex: 1;
    height: 40px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 14px;
    cursor: pointer;
}

.type-tab.active {
    background: #1890ff;
    color: white;
}

.categories-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 12px;
    border-radius: 8px;
}

.category-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.category-info {
    flex: 1;
}

.category-name {
    font-weight: 500;
}

.btn-delete {
    padding: 6px 12px;
    font-size: 12px;
    background: #ff4d4f;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-body {
    padding: 16px;
}

/* 图标选择器 */
.icon-selector {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
}

.icon-btn {
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 20px;
    cursor: pointer;
}

.icon-btn.active {
    border-color: #1890ff;
    background: #e6f7ff;
}

/* 颜色选择器 */
.color-selector {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.color-btn {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
}

.color-btn.active {
    border-color: #333;
}

/* 分类层级样式 */
.category-item.parent {
    background: #f9f9f9;
    border-left: 3px solid #1890ff;
}

.category-item.child {
    margin-left: 20px;
    border-left: 2px solid #ddd;
}

.category-indent {
    width: 16px;
}

.category-meta {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.category-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.btn-add-child {
    padding: 6px 12px;
    font-size: 12px;
    background: #52C41A;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* 项目组列表 */
.projects-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.project-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.project-info {
    flex: 1;
}

.project-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.project-description {
    font-size: 12px;
    color: #999;
}

.project-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-enter {
    padding: 8px 16px;
    font-size: 14px;
    background: #1890ff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-edit-small {
    padding: 6px 12px;
    font-size: 12px;
    background: #52C41A;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-delete-small {
    padding: 6px 12px;
    font-size: 12px;
    background: #ff4d4f;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

