/**
 * HeJu - 全局样式 + 布局
 */

/* ========== CSS 变量 ========== */
:root {
  --primary: #FF7A6E;
  --primary-light: #FFB4AD;
  --primary-dark: #E5574B;
  --secondary: #4A6FA5;
  --secondary-light: #7A9CC6;
  --bg: #F7F7F8;
  --card-bg: #FFFFFF;
  --text-primary: #1A1A1A;
  --text-secondary: #666666;
  --text-hint: #999999;
  --border: #E8E8E8;
  --success: #4CAF50;
  --danger: #F44336;
  --income-color: #4CAF50;
  --expense-color: #FF7A6E;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);
  --font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  --sidebar-width: 200px;
  --mobile-tab-height: 56px;
}

/* ========== 全局 Reset ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
}

/* ========== App 布局 ========== */
.app {
  display: flex;
  min-height: 100vh;
}

/* ========== 侧边栏（桌面端） ========== */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.sidebar-logo span {
  font-size: 12px;
  color: var(--text-hint);
  font-weight: 400;
  display: block;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background-color 0.15s, color 0.15s;
  font-size: 14px;
  user-select: none;
}

.sidebar-nav-item:hover {
  background-color: var(--bg);
}

.sidebar-nav-item.active {
  color: var(--primary);
  background-color: #FFF0EE;
  font-weight: 600;
}

.sidebar-nav-item .nav-icon {
  width: 24px;
  text-align: center;
  margin-right: 10px;
  font-size: 16px;
}

/* ========== 内容区 ========== */
.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 24px;
  max-width: 800px;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

.section-header {
  margin-bottom: 20px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 12px;
  color: var(--text-hint);
  margin-top: 4px;
}

/* ========== 底部 Tab 栏（移动端） ========== */
.mobile-tabs {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-tab-height);
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.mobile-tabs-inner {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: space-around;
}

.mobile-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  cursor: pointer;
  color: var(--text-hint);
  font-size: 10px;
  user-select: none;
  transition: color 0.15s;
}

.mobile-tab-item .tab-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

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

/* ========== 设置页 ========== */
.settings-section {
  max-width: 500px;
}

.settings-group {
  margin-bottom: 24px;
}

.settings-group-title {
  font-size: 12px;
  color: var(--text-hint);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

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

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

.settings-value {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: right;
}

.settings-value input {
  text-align: right;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 4px 0;
  width: 120px;
  outline: none;
  color: var(--text-primary);
  background: transparent;
}

.settings-value input:focus {
  border-bottom-color: var(--primary);
}

.together-days {
  text-align: center;
  padding: 20px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-radius: var(--radius);
}

.together-days .days-number {
  font-size: 36px;
  font-weight: 700;
}

.together-days .days-label {
  font-size: 12px;
  opacity: 0.9;
}

/* ========== 占位页面 ========== */
.placeholder-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-hint);
}

.placeholder-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.placeholder-text {
  font-size: 16px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .mobile-tabs {
    display: block;
  }

  .content {
    margin-left: 0;
    padding: 16px;
    padding-bottom: calc(var(--mobile-tab-height) + 16px);
    max-width: 100%;
  }

  .section-title {
    font-size: 18px;
  }
}
