/* foliate-reader/style.css — FoliateReader UI 样式
 * 从 JS 内联样式抽取（2026-07-31，1.5 任务）
 * 动态属性（display/transform/width/theme swatch 背景）仍由 JS 内联控制
 */

/* ── 主题变量默认值（运行时由 _applyTheme 内联 setProperty 覆盖） ── */
#foliate-reader-overlay {
  --theme-bg: #fff;
  --theme-text: #333;
  --theme-border: #e0e0e0;
  --theme-toolbar: #fafafa;
  --theme-accent: #1a73e8;
}

/* ── 全屏/模态容器 ── */
#foliate-reader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  background: var(--theme-bg, #fff);
  display: none;
  flex-direction: column;
  color: var(--theme-text, #333);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Noto Sans", "Noto Serif", "Source Han Serif SC", Georgia, serif;
}

/* ── 顶栏（工具栏固定定位） ── */
#foliate-reader-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  min-height: 44px;
  border-bottom: 1px solid var(--theme-border, #e0e0e0);
  background: var(--theme-toolbar, #fafafa);
  user-select: none;
  transition: opacity 0.3s ease;
  z-index: 2;
  position: relative;
}

#foliate-reader-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--theme-text, #333);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* 顶栏按钮（默认 16px；lg=18px / sm=13px） */
#foliate-reader-topbar > button {
  background: transparent;
  border: 1px solid var(--theme-border, #ccc);
  color: var(--theme-text, #555);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 4px;
  line-height: 1;
}
#foliate-reader-topbar > button.fr-btn-lg {
  font-size: 18px;
}
#foliate-reader-topbar > button.fr-btn-sm {
  font-size: 13px;
  padding: 4px 12px;
}

/* ── 设置面板（顶栏下方抽屉区） ── */
#foliate-reader-settings {
  display: none;
  padding: 12px 16px;
  background: var(--theme-toolbar, #fafafa);
  border-bottom: 1px solid var(--theme-border, #e0e0e0);
  user-select: none;
  z-index: 2;
}

/* ── TOC 抽屉 ── */
#foliate-reader-toc-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.3);
  z-index: 10;
  display: none;
}

#foliate-reader-toc {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  max-width: 80vw;
  height: 100vh;
  background: var(--theme-toolbar, #fafafa);
  border-right: 1px solid var(--theme-border, #e0e0e0);
  z-index: 11;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

#foliate-reader-toc .fr-toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--theme-border, #e0e0e0);
  font-size: 15px;
  font-weight: 600;
  color: var(--theme-text, #333);
}

#foliate-reader-toc .fr-toc-close {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--theme-text, #555);
  padding: 0 4px;
}

/* ── 搜索面板 ── */
#foliate-reader-search {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 85vw;
  height: 100vh;
  background: var(--theme-toolbar, #fafafa);
  border-left: 1px solid var(--theme-border, #e0e0e0);
  z-index: 11;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

/* ── 批注菜单 ── */
#foliate-reader-annotation-menu {
  position: fixed;
  z-index: 12;
  display: none;
  background: var(--theme-toolbar, #fafafa);
  border: 1px solid var(--theme-border, #e0e0e0);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  padding: 6px 8px;
  user-select: none;
}

/* ── 阅读视图容器 ── */
#foliate-reader-view {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* ── 底栏（工具栏固定定位） ── */
#foliate-reader-bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  min-height: 40px;
  border-top: 1px solid var(--theme-border, #e0e0e0);
  background: var(--theme-toolbar, #fafafa);
  user-select: none;
  transition: opacity 0.3s ease;
  z-index: 2;
  gap: 12px;
}

#foliate-reader-bottombar > button {
  background: transparent;
  border: 1px solid var(--theme-border, #ccc);
  color: var(--theme-text, #555);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}
#foliate-reader-bottombar > button.fr-btn-sm {
  font-size: 13px;
  padding: 4px 12px;
}

/* ── 脚注弹层 ── */
#foliate-footnote-popup {
  position: fixed;
  z-index: 100;
  max-width: 400px;
  width: 80vw;
  background: var(--theme-toolbar, #fafafa);
  border: 1px solid var(--theme-border, #e0e0e0);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--theme-text, #333);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* ── TTS 面板 ── */
#foliate-tts-panel {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--theme-bg, #fff);
  border: 1px solid var(--theme-border, #ccc);
  border-radius: 12px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1001;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  font-size: 14px;
}

/* ── 引用图片生成遮罩 ── */
.fr-quote-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
}

/* ── 词典弹层 ── */
#foliate-dict-popup {
  position: fixed;
  max-width: 360px;
  min-width: 200px;
  background: var(--theme-bg, #fff);
  color: var(--theme-text, #333);
  border: 1px solid var(--theme-border, #ccc);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 2001;
  font-size: 14px;
  line-height: 1.5;
  display: none;
}

#foliate-dict-popup .fr-dict-close {
  position: absolute;
  top: 2px;
  right: 6px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #999;
  line-height: 1;
}
