/* 中文阅读应用主样式文件 */

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}



/* 横幅渐变背景 */
.banner-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 24px;
    color: white;
    position: relative;
    overflow: hidden;
}

.banner-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0.2;
}

/* 导航按钮样式 */
.nav-button {
    transition: all 0.3s ease;
    border: none;
    outline: none;
    cursor: pointer;
}

.nav-button.active {
    background: #3b82f6;
    color: white;
    transform: scale(1.05);
}

.nav-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 书籍封面样式 */
.book-cover {
    background: linear-gradient(45deg, #f3f4f6, #e5e7eb);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.book-cover:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* 底部导航样式 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 8px 16px;
    z-index: 1000;
}

.nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.bottom-nav-item {
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    color: #9ca3af;
}

.bottom-nav-item.active {
    color: #3b82f6;
}

.bottom-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #3b82f6;
    border-radius: 50%;
}

.bottom-nav-item:hover {
    transform: scale(1.1);
}

.nav-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.nav-text {
    font-size: 12px;
    font-weight: 500;
}

/* 在read页面隐藏底部导航 */
.app-container[data-route="/read"] .bottom-nav {
    display: none !important;
}

/* 在read页面调整页面内容，不需要为底部导航留空间 */
.app-container[data-route="/read"] .page-content {
    padding-bottom: 16px;
}

/* 页面内容容器 */
.page-content {
    padding: 16px;
    padding-bottom: 100px; /* 为底部导航留出空间 */
    min-height: 100vh;
    overflow-y: auto; /* 允许垂直滚动 */
    scroll-behavior: smooth; /* 平滑滚动 */
}

/* 加载动画 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: inline-block;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* 文本样式 */
.text-title {
    font-size: 24px;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 16px;
}

.text-subtitle {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}

.text-body {
    font-size: 16px;
    color: #6b7280;
    line-height: 1.6;
}

.text-small {
    font-size: 14px;
    color: #9ca3af;
}

/* 网格布局 */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* 响应式设计 */
@media (max-width: 375px) {
    .book-cover {
        width: 200px;
        height: 260px;
    }
    
    .page-content {
        padding: 12px;
    }
    
    .card {
        padding: 16px;
    }
}

@media (min-width: 768px) {
    .book-cover {
        width: 280px;
        height: 360px;
    }
    
    .page-content {
        padding: 24px;
        max-width: 768px;
        margin: 0 auto;
    }
}

/* 微信适配 */
.wechat-safe-area {
    padding-bottom: env(safe-area-inset-bottom);
}

/* 加载状态 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #9ca3af;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 工具类 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }

.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.p-8 { padding: 32px; }

.rounded { border-radius: 8px; }
.rounded-lg { border-radius: 12px; }
.rounded-xl { border-radius: 16px; }

.shadow { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); }
.shadow-lg { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15); }

/* ===== 读书页面样式（整合detail.css） ===== */

/* CSS变量定义 */
:root {
  --base-font-size: 14px;
  --font-size-075: calc(var(--base-font-size) * 0.75);
  --font-size-100: calc(var(--base-font-size) * 1.0);
  --font-size-125: calc(var(--base-font-size) * 1.25);
  --font-size-150: calc(var(--base-font-size) * 1.5);
}

/* 移动端检测提示 */
.desktop-notice {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 2rem;
  text-align: center;
}

/* 头部进度条 */
.header-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  z-index: 50;
  padding: 0.5rem 1rem;
}

.progress-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  width: 100%;
}

.progress-bar {
  flex: 1;
  height: 3px;
  background: #e5e5e5;
  border-radius: 1.5px;
  margin: 0 0.75rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #007aff;
  width: 0%;
  transition: width 0.1s ease;
}

.time-display {
  font-size: 0.75rem;
  color: #666;
  font-weight: 500;
}

/* 内容区域 */
.content-area {
  margin-top: 4rem;
  padding: 1rem;
  padding-bottom: 6rem;
  overflow-y: auto;
  max-height: calc(100vh - 8rem);
  scroll-behavior: smooth;
}

/* 句子块样式 */
.sentence-block {
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.sentence-block {
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
  position: relative;
}

.sentence-block.highlight::before {
  content: '';
  position: absolute;
  top: -0.5rem;
  left: -0.5rem;
  right: -0.5rem;
  bottom: -0.5rem;
  background: rgba(0, 122, 255, 0.1);
  border-radius: 8px;
  z-index: -1;
}

/* 字符块样式 */
.char-block {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin: 0 1px;
  position: relative;
}

.char-pinyin {
  font-size: 0.6rem;
  color: #666;
  line-height: 1;
  margin-bottom: 2px;
  transition: opacity 0.3s ease;
}

.char-hanzi {
  font-size: 1.2rem;
  line-height: 1.2;
  color: #333;
}

/* 底部控制栏样式 */
.bottom-controls {
  position: fixed;
  bottom: 1rem;
  left: 0;
  right: 0;
  height: 4rem;
  display: grid;
  grid-template-columns: 2fr auto 1fr auto 1fr auto 2fr;
  align-items: center;
  z-index: 1000;
  padding: 0;
}

/* 播放按钮样式 */
.play-button {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: #007AFF;
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
  flex-shrink: 0;
  justify-self: center;
  grid-column: 4 / 5;
}

.play-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 122, 255, 0.4);
}

/* 回退按钮样式 */
.backward-button {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #333333;
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(51, 51, 51, 0.3);
  flex-shrink: 0;
  justify-self: center;
  grid-column: 2 / 3;
}

.backward-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(51, 51, 51, 0.4);
}

/* 设置按钮样式 */
.settings-button {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #333333;
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(51, 51, 51, 0.3);
  flex-shrink: 0;
  justify-self: center;
  grid-column: 6 / 7;
}

.settings-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(51, 51, 51, 0.4);
}

/* 设置菜单 */
.settings-menu {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 0.5rem;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.settings-menu.show {
  opacity: 1;
  visibility: visible;
}

.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.menu-item:hover {
  background: #f5f5f5;
}

.arrow {
  color: #999;
}

/* 字体大小菜单 */
.font-size-menu {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 0.5rem;
  z-index: 200;
}

.font-size-header {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-bottom: 1px solid #e5e5e5;
  margin-bottom: 0.5rem;
}

.back-btn {
  background: none;
  border: none;
  padding: 0.25rem;
  margin-right: 0.5rem;
  cursor: pointer;
  color: #666;
}

.font-size-title {
  font-weight: 600;
  color: #333;
}

.font-size-option {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s ease;
  text-align: center;
}

.font-size-option:hover {
  background: #f5f5f5;
}

.font-size-option.active {
  background: #007aff;
  color: white;
}

/* 速度菜单 */
.speed-menu {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 0.5rem;
  z-index: 200;
}

.speed-header {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-bottom: 1px solid #e5e5e5;
  margin-bottom: 0.5rem;
}

.speed-title {
  font-weight: 600;
  color: #333;
}

.speed-option {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s ease;
  text-align: center;
}

.speed-option:hover {
  background: #f5f5f5;
}

.speed-option.active {
  background: #007aff;
  color: white;
}

/* 通知样式 */
.speed-notification,
.font-size-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 1rem 2rem;
  border-radius: 8px;
  z-index: 300;
}

.seek-notification {
  position: fixed;
  bottom: 8rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 1rem;
  border-radius: 8px;
  z-index: 300;
  text-align: center;
}

.seek-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* 字体大小类 */
.font-size-080 { font-size: 0.8rem; }
.font-size-100 { font-size: 1rem; }
.font-size-120 { font-size: 1.2rem; }
.font-size-140 { font-size: 1.4rem; }
.font-size-160 { font-size: 1.6rem; }
