/* ============================================
   common.css - 全站统一基础样式
   ============================================ */
:root {
  --bg: #fff8e1;
  --primary: #5d4037;
  --primary-dark: #3e2723;
  --accent: #ffd54f;
  --text: #263238;
  --text-secondary: #78909c;
  --border: #e0d9d1;
  --card-bg: #ffffff;
  --shadow: rgba(0,0,0,0.04);
  --radius: 12px;
  --transition: all 0.3s ease;
}

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

/* 去除蓝色高亮，改为适配主题色 */
* {
  -webkit-tap-highlight-color: rgba(93, 64, 55, 0.15);
}

/* 确保所有可点击元素无蓝色轮廓 */
a, button, input, textarea, select, [onclick], [role="button"] {
  -webkit-tap-highlight-color: rgba(93, 64, 55, 0.15);
  outline: none;
}

button:focus, a:focus, input:focus, textarea:focus, select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(93, 64, 55, 0.2);
}

body {
  background: var(--bg);
  font-family: "Segoe UI", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  padding-bottom: 6rem;
  position: relative;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem 1rem 6rem;
  position: relative;
}

/* ---- 汉堡菜单按钮 ---- */
.menu-toggle {
  width: 48px;
  height: 48px;
  border: none;
  background: none;
  font-size: 1.8rem;
  color: var(--primary);
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: var(--transition);
  margin-bottom: 0.5rem;
}
.menu-toggle:hover { background: #f8f4ed; }

/* ---- 顶部 Header ---- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.2rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}
.logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
}
.user-info { text-align: right; }
.user-name { font-weight: 600; color: var(--primary); }
.user-id { color: var(--text-secondary); font-size: 0.9rem; }

/* ---- 章节标题 ---- */
.section-title {
  font-size: 1.6rem;
  color: var(--primary);
  margin: 2rem 0 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ---- 侧边栏遮罩 ---- */
.sidebar-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.3);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.sidebar-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ---- 侧边栏 ---- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 280px;
  height: 100vh;
  background: var(--card-bg);
  box-shadow: 0 0 20px rgba(0,0,0,0.1);
  z-index: 999;
  transition: transform 0.3s ease;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  transform: translateX(-100%);
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-title {
  color: var(--primary);
  font-weight: 600;
  font-size: 1.1rem;
}
.sidebar-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.sidebar-menu { padding: 1rem 0; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.5rem;
  color: var(--text);
  text-decoration: none;
  transition: var(--transition);
  font-size: 1rem;
}
.sidebar-item:hover {
  background: #f8f4ed;
  color: var(--primary);
  padding-left: 1.8rem;
}
.sidebar-item.active {
  background: #fff8e1;
  color: var(--primary);
  font-weight: 600;
  border-left: 3px solid var(--accent);
}

/* 侧边栏图标 */
.sidebar-item .nav-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.7;
}
.sidebar-item.active .nav-icon,
.sidebar-item:hover .nav-icon {
  opacity: 1;
}

/* ---- 通用按钮 ---- */
.btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 6px rgba(93, 64, 55, 0.15);
}
.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(93, 64, 55, 0.2);
}

/* ---- 通用卡片 ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 4px 12px var(--shadow);
  border: 1px solid var(--border);
}

/* ---- Footer ---- */
footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

/* ---- 响应式 ---- */
@media (max-width: 600px) {
  .sidebar { width: 240px; }
  .section-title { font-size: 1.4rem; }
}
