/* ============================================================
   个人智能工作台 - 淡粉色简约圆角卡片 UI
   适配 iPhone 竖屏
   ============================================================ */

:root {
  --pink-50: #FFF5F5;
  --pink-100: #FFE8E8;
  --pink-200: #FFD6D6;
  --pink-300: #F5A0A0;
  --pink-400: #E88080;
  --pink-500: #D96060;
  --text-main: #3D2B2B;
  --text-sub: #8B6B6B;
  --text-light: #B89A9A;
  --card-bg: #FFFFFF;
  --card-shadow: 0 4px 16px rgba(217, 96, 96, 0.08);
  --card-shadow-hover: 0 6px 24px rgba(217, 96, 96, 0.14);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --nav-width: 240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--pink-50);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===== 顶部状态栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(135deg, var(--pink-300), var(--pink-400));
  color: #fff;
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 12px rgba(217, 96, 96, 0.2);
}
.topbar .title { font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }
.topbar .date { font-size: 12px; opacity: 0.9; }
.topbar .menu-btn {
  background: rgba(255,255,255,0.2); border: none; color: #fff;
  width: 36px; height: 36px; border-radius: 50%; font-size: 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* ===== 侧边导航 ===== */
.nav-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.3);
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.nav-overlay.open { opacity: 1; pointer-events: auto; }

.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--nav-width); max-width: 80vw;
  background: #fff; z-index: 201;
  transform: translateX(-100%); transition: transform 0.3s ease;
  box-shadow: 4px 0 24px rgba(0,0,0,0.1);
  padding-top: 16px; overflow-y: auto;
}
.sidebar.open { transform: translateX(0); }

.sidebar .nav-header {
  padding: 16px 20px 24px;
  background: linear-gradient(135deg, var(--pink-100), var(--pink-200));
  margin-bottom: 12px;
}
.sidebar .nav-header h2 { font-size: 18px; color: var(--text-main); margin-bottom: 4px; }
.sidebar .nav-header p { font-size: 12px; color: var(--text-sub); }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  font-size: 15px; color: var(--text-main);
  cursor: pointer; border-left: 3px solid transparent;
  transition: all 0.2s;
}
.nav-item:hover, .nav-item.active {
  background: var(--pink-50); border-left-color: var(--pink-300); color: var(--pink-400);
  font-weight: 600;
}
.nav-item .icon { font-size: 20px; width: 28px; text-align: center; }
.nav-item .en { font-size: 11px; color: var(--text-light); margin-left: auto; }

/* ===== 主内容区 ===== */
.main {
  padding: 12px 14px 80px;
  max-width: 640px; margin: 0 auto;
}

/* ===== 卡片 ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  margin-bottom: 14px;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--card-shadow-hover); }

.card-title {
  font-size: 17px; font-weight: 700; color: var(--text-main);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; padding-bottom: 10px;
  border-bottom: 2px solid var(--pink-100);
}
.card-title .emoji { font-size: 20px; }
.card-title .sub { font-size: 12px; color: var(--text-light); font-weight: 400; margin-left: auto; }

/* 子标题 */
.sub-title {
  font-size: 14px; font-weight: 600; color: var(--pink-400);
  margin: 14px 0 8px; display: flex; align-items: center; gap: 6px;
}

/* 标签 */
.tag {
  display: inline-block; font-size: 11px;
  padding: 2px 10px; border-radius: 12px;
  background: var(--pink-100); color: var(--pink-400);
  font-weight: 600; margin-right: 6px;
}
.tag.green { background: #E8F5E9; color: #43A047; }
.tag.blue { background: #E3F2FD; color: #1976D2; }
.tag.orange { background: #FFF3E0; color: #F57C00; }
.tag.purple { background: #F3E5F5; color: #8E24AA; }

/* 信息行 */
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px dashed var(--pink-100);
  font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--text-sub); }
.info-row .value { color: var(--text-main); font-weight: 600; }
.info-row .value.bold { color: var(--pink-400); font-weight: 700; }

/* 列表项 */
.list-item {
  padding: 10px 0;
  border-bottom: 1px dashed var(--pink-100);
}
.list-item:last-child { border-bottom: none; }
.list-item .li-title { font-size: 14px; font-weight: 600; color: var(--text-main); margin-bottom: 4px; }
.list-item .li-desc { font-size: 13px; color: var(--text-sub); line-height: 1.5; }
.list-item .li-meta { font-size: 11px; color: var(--text-light); margin-top: 4px; }

/* 输入控件 */
input, textarea, select {
  width: 100%; font-size: 14px; padding: 10px 12px;
  border: 1.5px solid var(--pink-200); border-radius: var(--radius-sm);
  background: var(--pink-50); color: var(--text-main);
  font-family: inherit; outline: none; transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--pink-300); }
textarea { resize: vertical; min-height: 60px; }

.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--text-sub); margin-bottom: 4px; font-weight: 600; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; font-size: 14px; font-weight: 600;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.btn-primary { background: linear-gradient(135deg, var(--pink-300), var(--pink-400)); color: #fff; box-shadow: 0 3px 10px rgba(217,96,96,0.3); }
.btn-primary:active { transform: scale(0.97); }
.btn-ghost { background: var(--pink-100); color: var(--pink-400); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }

/* 模块区块 */
.section { display: none; }
.section.active { display: block; animation: fadeIn 0.4s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tab 切换 */
.tabs {
  display: flex; gap: 6px; margin-bottom: 14px;
  background: #fff; padding: 6px; border-radius: var(--radius-md);
  box-shadow: var(--card-shadow); overflow-x: auto;
}
.tab {
  flex: 1; min-width: max-content; text-align: center;
  padding: 8px 12px; font-size: 13px; font-weight: 600;
  color: var(--text-sub); border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.tab.active { background: var(--pink-300); color: #fff; }

/* 底部 tab bar（移动端快捷栏） */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; display: flex; justify-content: space-around;
  padding: 8px 4px; box-shadow: 0 -2px 16px rgba(217,96,96,0.08);
  z-index: 99; max-width: 640px; margin: 0 auto;
}
.tabbar-item {
  flex: 1; text-align: center; padding: 4px;
  font-size: 10px; color: var(--text-light); cursor: pointer;
}
.tabbar-item .tb-icon { font-size: 20px; display: block; margin-bottom: 2px; }
.tabbar-item.active { color: var(--pink-400); }

/* 提示气泡 */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: rgba(61,43,43,0.9); color: #fff;
  padding: 10px 20px; border-radius: 24px; font-size: 13px;
  z-index: 999; opacity: 0; transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-10px); }

/* 选题卡片 */
.topic-card {
  background: linear-gradient(135deg, #FFF5F5, #FFE8E8);
  border-radius: var(--radius-md); padding: 14px;
  margin-bottom: 10px; border-left: 4px solid var(--pink-300);
}
.topic-card .tc-cat { font-size: 11px; color: var(--pink-400); font-weight: 700; margin-bottom: 4px; }
.topic-card .tc-title { font-size: 15px; font-weight: 700; color: var(--text-main); margin-bottom: 6px; }
.topic-card .tc-row { font-size: 12px; color: var(--text-sub); margin-bottom: 3px; }
.topic-card .tc-row strong { color: var(--text-main); }
.topic-card .tc-tags { margin-top: 6px; }
.topic-card .tc-tags span { font-size: 10px; background: #fff; color: var(--pink-400); padding: 2px 8px; border-radius: 8px; margin-right: 4px; }

/* 单词卡 */
.word-card {
  background: #fff; border-radius: var(--radius-md);
  padding: 14px; margin-bottom: 10px;
  border-left: 3px solid var(--pink-300);
  box-shadow: 0 2px 8px rgba(217,96,96,0.06);
}
.word-card .wc-word { font-size: 16px; font-weight: 700; color: var(--text-main); }
.word-card .wc-phonetic { font-size: 12px; color: var(--text-light); margin-left: 6px; }
.word-card .wc-pos { font-size: 11px; color: var(--pink-400); font-style: italic; margin-left: 6px; }
.word-card .wc-meaning { font-size: 13px; color: var(--text-sub); margin: 4px 0; }
.word-card .wc-scene { font-size: 12px; color: var(--text-main); background: var(--pink-50); padding: 6px 10px; border-radius: 8px; margin-top: 4px; }
.word-card .wc-type { font-size: 10px; color: var(--text-light); margin-top: 4px; }

/* 历史笔记本 */
.note-item {
  background: #FFFCEF; border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 8px;
  border-left: 3px solid #F0D060;
}
.note-item .ni-text { font-size: 13px; color: var(--text-main); }
.note-item .ni-meta { font-size: 10px; color: var(--text-light); margin-top: 4px; display: flex; justify-content: space-between; }

/* 健康子模块统计块 */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat-box {
  background: var(--pink-50); border-radius: var(--radius-md);
  padding: 12px; text-align: center;
}
.stat-box .sb-val { font-size: 22px; font-weight: 800; color: var(--pink-400); }
.stat-box .sb-label { font-size: 11px; color: var(--text-sub); margin-top: 2px; }

/* 经期日历小格 */
.period-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.period-cal .pc-head { font-size: 10px; color: var(--text-light); text-align: center; }
.period-cal .pc-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 11px; border-radius: 50%; color: var(--text-sub);
  background: var(--pink-50);
}
.period-cal .pc-day.period { background: var(--pink-300); color: #fff; font-weight: 700; }
.period-cal .pc-day.predict { background: var(--pink-100); color: var(--pink-400); border: 1px dashed var(--pink-300); }
.period-cal .pc-day.today { outline: 2px solid var(--pink-400); }

/* 空状态 */
.empty { text-align: center; padding: 30px 16px; color: var(--text-light); font-size: 13px; }
.empty .emoji { font-size: 36px; display: block; margin-bottom: 8px; }

/* 删除/编辑小按钮 */
.icon-btn {
  background: none; border: none; font-size: 16px;
  cursor: pointer; padding: 4px; opacity: 0.6;
}
.icon-btn:active { opacity: 1; }

/* 工具栏 */
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

/* 响应式微调 */
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr; }
  .card-title { font-size: 16px; }
}

/* 隐藏滚动条美化 */
::-webkit-scrollbar { width: 0; height: 0; }
