/* ============================================================
   common.css - 共享基础样式
   包含 index.html 和 detail.html 都需要的通用样式
   ============================================================ */


/* ==================== CSS 变量 ==================== */

:root {
  --bg: #f5f7fa;
  --card-bg: #fff;
  --text: #1a1a2e;
  --text-secondary: #555;
  --border: #e8ecf1;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --tag-bg: #eff6ff;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --radius: 12px;
  --header-bg: rgba(255,255,255,0.85);
  --layout-max-width: calc(1200px + 170px);
  --max-width: 1200px;
  --sidebar-w: 170px;
}

.dark {
  --bg: #0f0f1a;
  --card-bg: #1a1a2e;
  --text: #e4e4ed;
  --text-secondary: #8888a0;
  --border: #2a2a40;
  --accent: #60a5fa;
  --accent-hover: #3b82f6;
  --accent-light: #172554;
  --tag-bg: #172554;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --header-bg: rgba(15,15,26,0.85);
}


/* ==================== 基础重置 ==================== */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background .3s, color .3s;
  min-height: 100vh;
  scrollbar-gutter: stable;
}

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


/* ==================== 头部导航（共享部分） ==================== */

/* 头部容器：固定定位，不随页面滚动 */
#header-container {
  position: sticky;
  top: 0;
  z-index: 100;
}

.header {
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.header-inner {
  max-width: var(--layout-max-width); margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 16px;
}

.logo { font-size: 22px; font-weight: 700; white-space: nowrap; }
.logo span { color: var(--accent); }

/* 副标题 */
.subtitle { font-size: 14px; color: var(--text-secondary); }

/* 头部操作 */
.header-actions { display: flex; gap: 8px; align-items: center; }

/* 主题按钮 */
.theme-btn {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; cursor: pointer; color: var(--text);
  font-size: 14px;
}
.theme-btn:hover { border-color: var(--accent); }


/* ==================== 模态框通用样式 ==================== */

.modal-overlay { display: none; position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.45); backdrop-filter: blur(4px); justify-content: center; align-items: center; }
.modal-content { width: 90%; max-width: 500px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; padding: 20px; box-shadow: 0 16px 48px rgba(0,0,0,0.2); position: relative; }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 15px; }
.modal-header h3 { font-size: 18px; margin: 0; }
.modal-close { font-size: 24px; cursor: pointer; color: var(--text-secondary); }
.modal-close:hover { color: var(--accent); }
.modal-body { font-size: 14px; color: var(--text); line-height: 1.6; }
.modal-body img { max-width: 100%; border-radius: 8px; margin-top: 10px; }


/* ==================== 页脚 ==================== */

.footer { text-align: center; padding: 30px 20px; margin-top: 40px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 13px; }
.footer .nav-links a:not(:last-child)::after { content: ' | '; color: var(--text-secondary); }


/* ==================== 滚动条美化 ==================== */

/* 全局滚动条：细窄、圆角、使用主题色 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
::-webkit-scrollbar-corner { background: transparent; }

/* Firefox 滚动条 */
html, body, div, pre, textarea {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
html:hover, body:hover, div:hover, pre:hover, textarea:hover {
  scrollbar-color: var(--accent) transparent;
}
