/* public/assets/styles/wuweizischool/bookLibrary.css */
/* ==================== 变量定义 ==================== */
:root {
  --sidebar-width: 280px;
  --primary-color: #5d9cec;
  --secondary-color: #a0d468;
  --accent-color: #ffce54;
  --light-bg: #f7fafc;
  --dark-bg: #2d3748;
  --dark-color: #434a54;
  --light-color: #f5f7fa;
}

/* ==================== 基础样式 ==================== */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f8f9fa;
  overflow-x: hidden;
  color: #333;
}

h1 {
  color: var(--dark-color);
  font-weight: 600;
  margin: 1.5rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--accent-color);
  display: inline-block;
}

/* ==================== 布局样式 ==================== */
.app-container {
  display: flex;
  min-height: calc(100vh - 150px);
}

/* 顶部标题区域 */
.text-center.py-4.bg-light.mb-4 {
  border-bottom: 1px solid #e2e8f0;
}

/* 主内容区域 */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  transition: margin-left 0.3s ease;
}

.content-header {
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
}

/* ==================== 侧边栏样式 ==================== */
.sidebar {
  width: var(--sidebar-width);
  background: white;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
}

.sidebar-header {
  padding: 1.2rem;
  border-bottom: 1px solid #e2e8f0;
  background: var(--primary-color);
  color: white;
}

.sidebar-title {
  font-size: 1.5rem;
  margin: 0;
}

.search-box {
  padding: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.search-input {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
}

.categories {
  padding: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.category-title {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--secondary-color);
}

.category-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.category-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  cursor: pointer;
  border-radius: 0.25rem;
  padding-left: 0.5rem;
  transition: background-color 0.2s;
}

.category-item:hover {
  background-color: #edf2f7;
}

.category-item.active {
  background-color: #ebf4ff;
  color: var(--primary-color);
  font-weight: 500;
}

.category-count {
  background: #e2e8f0;
  padding: 0.1rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
}

/* ==================== 书籍容器样式 ==================== */
.book-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 25px;
  margin: 2rem 0;
}

/* 书籍卡片 */
.book-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border-left: 4px solid var(--primary-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.book-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  border-left-color: var(--secondary-color);
}

.book-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--dark-color);
  font-weight: 600;
}

.book-card .author {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
}

.book-card .author i {
  margin-right: 5px;
  color: var(--primary-color);
}

.book-card .description {
  font-size: 0.85rem;
  color: #718096;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

.action-buttons {
  gap: 10px;
  margin-top: auto;
}

.btn-read {
  background-color: var(--primary-color);
  color: white;
  border: none;
}

.btn-read:hover {
  background-color: #4a89dc;
  color: white;
}

.btn-favorite {
  background-color: #ffce54;
  color: #333;
  border: none;
}

.btn-favorite:hover {
  background-color: #f6b93b;
  color: #333;
}

.btn-favorite.active {
  background-color: #ffce54;
  color: #333;
}

.favorite-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: #ffce54;
  color: #333;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* ==================== 管理员面板样式 ==================== */
.admin-panel {
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: white;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.file-upload-container {
  border: 2px dashed #cbd5e0;
  border-radius: 0.5rem;
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: border-color 0.3s;
}

.file-upload-container:hover {
  border-color: var(--primary-color);
}

/* ==================== 阅读器样式 ==================== */
.reader-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  z-index: 2000;
  display: none;
  flex-direction: column;
}

.reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

.reader-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.book-content {
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.6;
  font-size: 18px;
}

/* 阅读器控制栏动画 */
.reader-controls {
  padding: 1rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform: translateY(0);
  opacity: 1;
}

.reader-controls.hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

/* 阅读内容区域点击提示 */
.reader-content::after {
  content: "点击显示/隐藏控制栏";
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.reader-content.show-hint::after {
  opacity: 1;
}

.reader-settings {
  display: flex;
  align-items: center;
}

.font-control button {
  background: none;
  border: 1px solid #e2e8f0;
  padding: 0.25rem 0.5rem;
  margin: 0 0.25rem;
  border-radius: 0.25rem;
  cursor: pointer;
}

.reader-controls .reader-settings {
  flex-wrap: wrap;
  gap: 10px;
}

/* ==================== 书签面板样式 ==================== */
.bookmarks-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 500px;
  max-height: 70vh;
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 3000;
  overflow: hidden;
}

.bookmarks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

.bookmarks-list {
  max-height: calc(70vh - 80px);
  overflow-y: auto;
}

.bookmark-item {
  padding: 1rem;
  border-bottom: 1px solid #e9ecef;
  cursor: pointer;
  transition: background-color 0.2s;
}

.bookmark-item:hover {
  background-color: #f8f9fa;
}

.bookmark-preview {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: #495057;
}

.bookmark-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.delete-bookmark {
  padding: 0.25rem 0.5rem;
}

/* 书签提示 */
.bookmark-hint {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 1000;
}

/* ==================== 阅读器主题 ==================== */
.theme-sepia {
  background-color: #f6f0e1;
  color: #5c4b37;
}

.theme-white {
  background-color: white;
  color: black;
}

.theme-dark {
  background-color: #2c3e50;
  color: #ecf0f1;
}

.theme-night {
  background-color: #1a1a1a;
  color: #c8c8c8;
}

/* ==================== 侧边栏切换按钮 ==================== */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1100;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0.25rem;
  padding: 0.5rem;
  cursor: pointer;
}

/* ==================== 加载动画 ==================== */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e2e8f0;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.pagination-container {
  margin-top: 20px;
}

.editor-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.editor-content {
  background: white;
  padding: 20px;
  border-radius: 8px;
  width: 80%;
  max-width: 800px;
  max-height: 80vh;
  overflow: auto;
}

/* ==================== 章节分析样式 ==================== */
.chapter-analysis {
  background-color: #f8f9fa;
  border-radius: 5px;
  padding: 10px;
  border-left: 4px solid #0d6efd;
}

.chapter-item {
  transition: background-color 0.2s;
}

.chapter-item:hover {
  background-color: #e9ecef;
}

/* ==================== 动画 ==================== */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* ==================== Toast提示 ==================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1050;
}

/* ==================== 响应式设计 ==================== */
/* 响应式设计 */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
    --sidebar-width: 200px;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
  }

  .sidebar-toggle {
    display: block;
  }

  .book-container {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
  }
}

@media (max-width: 768px) {
  .category-item {
    padding: 0.2rem 0;
  }
  .reader-controls {
    flex-direction: column;
    gap: 1rem;
  }

  .reader-settings {
    width: 100%;
    justify-content: center;
  }

  .book-content {
    font-size: 16px;
    padding: 0.5rem;
  }

  .reader-content {
    padding: 1rem;
  }

  .reader-controls .reader-settings {
    justify-content: flex-start;
  }
}

@media (max-width: 576px) {
  .book-container {
    grid-template-columns: 1fr;
  }

  .reader-header,
  .reader-controls {
    padding: 0.75rem;
  }

  .reader-content {
    padding: 0.75rem;
  }

  .book-content {
    font-size: 16px;
    line-height: 1.5;
  }

  .font-control {
    display: flex;
    gap: 0.5rem;
  }

  .toast-container {
    bottom: 10px;
    right: 10px;
    left: 10px;
  }

  .toast {
    width: 100%;
  }
}

/* 平板设备优化 */
@media (min-width: 577px) and (max-width: 992px) {
  .sidebar {
    width: 320px;
  }

  .book-container {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}
