/* 
 * Kids Book CMS Theme Styles
 * Designed for readability and ease of use for children.
 */

:root {
  /* 新版糖果色系：更柔和、更现代 */
  --primary-color: #FF7675;   /* 珊瑚红：温暖亲和 */
  --secondary-color: #74B9FF; /* 天空蓝：清新透亮 */
  --accent-color: #55EFC4;    /* 薄荷绿：活力点缀 */
  --success-color: #00B894;   /* 森林绿 */
  --text-main: #2D3436;       /* 深灰：柔和阅读 */
  --text-light: #636E72;      /* 浅灰：辅助信息 */
  --bg-body: #F0F3F7;         /* 现代冷灰白背景 */
  --bg-card: #FFFFFF;         /* 纯白卡片 */
  --border-radius-lg: 16px;   /* 适度圆角 */
  --border-radius-md: 10px;
  --shadow-sm: 0 2px 8px rgba(45, 52, 54, 0.05);
  --shadow-md: 0 8px 24px rgba(45, 52, 54, 0.08);
  --font-base: "Nunito", "Rounded Mplus 1c", "Microsoft YaHei", sans-serif;
  --header-height: 80px;
}

/* Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-base);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 16px;
  padding-top: var(--header-height);
}

a { text-decoration: none; color: inherit; transition: all 0.3s ease; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-radius: 50px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  font-size: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }

.btn-primary { background-color: var(--primary-color); color: #fff; }
.btn-secondary { background-color: var(--secondary-color); color: #fff; }
.btn-outline { border: 2px solid var(--primary-color); color: var(--primary-color); background: transparent; }

.section-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 24px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::before {
  content: '';
  display: block;
  width: 8px;
  height: 32px;
  background: var(--primary-color);
  border-radius: 4px;
}

/* Header */
.site-header {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  padding: 15px 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}
.site-header.compact {
  padding: 8px 0;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo img { height: 50px; }
.main-nav { display: flex; gap: 10px; }
.nav-item {
  padding: 8px 16px;
  border-radius: var(--border-radius-md);
  font-weight: bold;
  color: var(--text-main);
}
.nav-item:hover, .nav-item.active {
  background-color: var(--secondary-color);
  color: #fff;
}
.search-bar {
  display: flex;
  background: var(--bg-body);
  border-radius: 50px;
  padding: 5px 15px;
  border: 2px solid transparent;
}
.search-bar:focus-within { border-color: var(--secondary-color); }
.search-box { position: relative; }
.search-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-md);
  border: 1px solid #eee;
  padding: 8px;
  display: none; /* 初始隐藏，通过JS控制 */
  z-index: 1000;
}
.search-suggest.show { display: block; }
.search-suggest .suggest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-light);
  font-size: 12px;
  padding: 4px 8px;
}
.search-suggest ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.search-suggest li {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.search-suggest li:hover {
  background: #f7f9fc;
}
.search-suggest .suggest-clear {
  color: var(--primary-color);
  cursor: pointer;
  font-weight: bold;
}
.search-input {
  border: none;
  background: transparent;
  padding: 5px;
  outline: none;
  font-size: 14px;
  width: 200px;
}
.search-btn {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
}
.nav-item:focus-visible,
.btn:focus-visible,
.category-card:focus-visible,
.pagination a:focus-visible {
  outline: 3px solid rgba(116,185,255,0.6);
  outline-offset: 3px;
}
.search-suggest .suggest-item.active {
  background: #eaf2ff;
  color: var(--text-main);
  border-radius: 8px;
}

/* Hero Section */
.hero-section {
  padding: 40px 0;
  background: linear-gradient(135deg, #FFEAA7 0%, #ffffff 60%, #74B9FF 100%); /* 梦幻渐变：暖黄->白->蓝 */
  background-size: 200% 200%;
  animation: gradientBG 15s ease infinite;
  border-bottom-left-radius: 40px;
  border-bottom-right-radius: 40px;
  margin-bottom: 40px;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.hero-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
.hero-slider {
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  height: 360px;
  position: relative;
  width: 100%;
  min-width: 0; /* 修复 Grid 布局下的溢出问题 */
}
.hero-slider img { width: 100%; height: 100%; object-fit: cover; }

/* 轮播图标题遮罩：统一从内联样式抽取为类，便于维护 */
.hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  padding: 20px;
}
.hero-overlay-title {
  font-size: 24px;
}

.reading-progress {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: 4px;
  z-index: 100;
  background: transparent;
}
.reading-progress-inner {
  height: 100%;
  width: 0%;
  background: var(--secondary-color);
  transition: width 0.1s linear;
}

.breadcrumb { padding: 20px 0; }
.book-section { margin-top: 60px; }
.book-header-info h1 { font-size: 32px; margin-bottom: 15px; color: var(--text-main); }
.book-header-info .meta { color: var(--text-light); font-size: 14px; }
.book-header-info .meta .sep { margin: 0 10px; }
.btn.btn-disabled { opacity: 0.5; cursor: not-allowed; }
.gallery-wrapper + .reader-content { margin-top: 40px; }

/* Gallery */
.gallery-top {
  height: 500px;
  width: 100%;
  margin-bottom: 20px;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  background: #000;
}
.gallery-thumbs {
  height: 100px;
  box-sizing: border-box;
  padding: 10px 0;
}
.gallery-thumbs .swiper-slide {
  width: 25%;
  height: 100%;
  opacity: 0.4;
  cursor: pointer;
  border-radius: var(--border-radius-md);
  overflow: hidden;
}
.gallery-thumbs .swiper-slide-thumb-active {
  opacity: 1;
  border: 2px solid var(--primary-color);
  /* 轻微高亮边框与柔和外晕，辅助定位当前缩略图 */
  box-shadow: 0 0 0 3px rgba(116,185,255,0.18);
}
.gallery-top .swiper-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.gallery-top #btnFullscreen {
  position: absolute;
  right: 15px;
  top: 15px;
  z-index: 5;
  padding: 6px 10px;
  font-size: 14px;
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
}
/* 计数显示：当前张数/总张数 */
.gallery-counter {
  position: absolute;
  left: 15px;
  top: 15px;
  z-index: 5;
  padding: 6px 10px;
  font-size: 14px;
  border-radius: 16px;
  color: #fff;
  background: rgba(0,0,0,0.35);
  box-shadow: var(--shadow-sm);
}
@media (max-width: 768px) {
  .gallery-top { height: 300px; }
  .gallery-top #btnFullscreen { font-size: 13px; padding: 5px 10px; }
}

.hero-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  /* 为右侧区域添加柔和底板，提升整体感与安全感 */
  background:
    linear-gradient(135deg, rgba(255,234,167,0.18), rgba(116,185,255,0.14)),
    var(--bg-body);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.btn-more {
  margin-left: auto;
  font-size: 14px;
  padding: 5px 15px;
}
.category-card {
  /* 白底略显单一：叠加轻量渐变提升层次 */
  background:
    linear-gradient(135deg, rgba(116,185,255,0.10), rgba(255,118,117,0.06)),
    var(--bg-card);
  border-radius: var(--border-radius-md);
  padding: 20px;
  flex: 1;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  transition: transform 0.3s;
  cursor: pointer;
  border: 2px solid #f1f2f6;
  position: relative; /* 为伪元素提供定位上下文 */
}
.category-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary-color);
}
/* 背景点缀：柔和的角落色块，不抢主视觉 */
.category-card::before {
  content: "";
  position: absolute;
  right: 12px;
  top: 12px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: radial-gradient(32px 32px at 60% 40%, rgba(116,185,255,0.22), transparent 60%),
              radial-gradient(28px 28px at 30% 70%, rgba(255,118,117,0.18), transparent 60%);
  pointer-events: none; /* 仅作装饰，不影响交互 */
  filter: blur(0.3px);
}
.category-card:hover::before {
  /* 悬停时略微增强色块存在感 */
  transform: scale(1.04);
  opacity: 0.95;
}
/* 贴纸装饰：为儿童友好添加趣味图形（按序变化），不依赖结构数据 */
.hero-sidebar .category-card::after {
  content: "★";
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 28px;
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, #74B9FF, #55EFC4);
  box-shadow: var(--shadow-sm);
  opacity: 0.9;
  pointer-events: none;
}
.hero-sidebar .category-card:nth-child(2)::after {
  content: "🍃";
  background: linear-gradient(135deg, #55EFC4, #00B894);
}
.hero-sidebar .category-card:nth-child(3)::after {
  content: "🌙";
  background: linear-gradient(135deg, #5FA8F5, #FF7675);
}

/* 图标轻微摇摆动画：增强趣味但不晃眼 */
@keyframes kids-wiggle {
  0% { transform: rotate(0deg) translateY(0); }
  50% { transform: rotate(6deg) translateY(-1px); }
  100% { transform: rotate(0deg) translateY(0); }
}
.category-card:hover .cat-icon {
  animation: kids-wiggle 0.35s ease;
}

/* 为不同卡片添加微妙的图标描边与光晕差异（按序） */
.hero-sidebar .category-card:nth-child(1) .cat-icon {
  box-shadow: 0 0 0 3px rgba(116,185,255,0.20);
}
.hero-sidebar .category-card:nth-child(2) .cat-icon {
  box-shadow: 0 0 0 3px rgba(85,239,196,0.20);
}
.hero-sidebar .category-card:nth-child(3) .cat-icon {
  box-shadow: 0 0 0 3px rgba(255,118,117,0.20);
}
.cat-icon { font-size: 32px; margin-bottom: 10px; }
.cat-title { font-weight: bold; font-size: 18px; }

/* 分类图标美化：圆形渐变底 + 微动效，适配明暗/护眼模式 */
.category-card .cat-icon {
  /* 固定圆形容器，保证一致的视觉尺寸 */
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 适度缩小图标字号以腾出内边距空间 */
  font-size: 28px;
  line-height: 1; /* 避免 emoji 产生额外行高 */
  /* 渐变底色：使用卡片与主题色构成柔和的光晕 */
  background: radial-gradient(120px 120px at 30% 30%, rgba(255, 118, 117, 0.25), transparent 60%),
              radial-gradient(120px 120px at 70% 70%, rgba(116, 185, 255, 0.25), transparent 60%),
              var(--bg-card);
  box-shadow: 0 10px 24px rgba(45, 52, 54, 0.08);
  border: 2px solid #f1f2f6;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
  will-change: transform;
}
.category-card:hover .cat-icon {
  /* 轻微上浮与放大，突出交互感 */
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 14px 30px rgba(45, 52, 54, 0.12);
  border-color: var(--primary-color);
}
.category-card:focus-within .cat-icon {
  /* 键盘可访问性：获得焦点时提供清晰轮廓 */
  outline: 3px solid rgba(116, 185, 255, 0.6);
  outline-offset: 3px;
}
/* 暗色主题下的图标底色调整：减弱光晕、提高对比 */
html.theme-dark .category-card .cat-icon,
body.theme-dark .category-card .cat-icon {
  background: radial-gradient(120px 120px at 30% 30%, rgba(255, 118, 117, 0.18), transparent 60%),
              radial-gradient(120px 120px at 70% 70%, rgba(95, 168, 245, 0.18), transparent 60%),
              var(--bg-card);
  border-color: #2a2a2a;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}
/* 暗色主题下卡片背景与角落色块适配 */
html.theme-dark .category-card,
body.theme-dark .category-card {
  background:
    linear-gradient(135deg, rgba(95,168,245,0.10), rgba(255,118,117,0.06)),
    var(--bg-card);
  border-color: #2a2a2a;
}
html.theme-dark .category-card::before,
body.theme-dark .category-card::before {
  background: radial-gradient(32px 32px at 60% 40%, rgba(95,168,245,0.22), transparent 60%),
              radial-gradient(28px 28px at 30% 70%, rgba(255,118,117,0.16), transparent 60%);
}
/* 护眼模式下的图标底色：使用更柔和的绿色系光晕 */
html.theme-eye .category-card .cat-icon,
body.theme-eye .category-card .cat-icon {
  background: radial-gradient(120px 120px at 30% 30%, rgba(85, 239, 196, 0.28), transparent 60%),
              radial-gradient(120px 120px at 70% 70%, rgba(116, 185, 255, 0.20), transparent 60%),
              var(--bg-card);
  border-color: #d8eee0;
}
/* 护眼模式下卡片背景与角落色块适配 */
html.theme-eye .category-card,
body.theme-eye .category-card {
  background:
    linear-gradient(135deg, rgba(85,239,196,0.12), rgba(116,185,255,0.08)),
    var(--bg-card);
  border-color: #d8eee0;
}
html.theme-eye .category-card::before,
body.theme-eye .category-card::before {
  background: radial-gradient(32px 32px at 60% 40%, rgba(85,239,196,0.22), transparent 60%),
              radial-gradient(28px 28px at 30% 70%, rgba(116,185,255,0.18), transparent 60%);
}
/* 小屏下适配图标尺寸，保证密度与可触达性 */
@media (max-width: 768px) {
  .category-card .cat-icon {
    width: 48px;
    height: 48px;
    font-size: 24px;
  }
}

/* Book Grid */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}
.book-card {
  background: var(--bg-card);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  position: relative;
  border: 1px solid #eee;
}
.book-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-md);
}
.book-cover-wrapper {
  position: relative;
  padding-top: 133%; /* 3:4 Aspect Ratio */
  overflow: hidden;
}
.book-cover {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.book-card:hover .book-cover { transform: scale(1.05); }
.book-info { padding: 15px; }
.book-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.book-meta {
  font-size: 13px;
  color: var(--text-light);
  display: flex;
  justify-content: space-between;
}
.age-badge {
  background: #e1f5fe;
  color: #0288d1;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 40px 0;
}
.pagination ul, .pagination li {
  display: flex;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none; /* 移除列表前面的点 */
}
.pagination li {
    display: block; /* 确保 li 是块级元素或 flex 容器 */
}
.pagination a, .pagination span {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0 15px;
  border-radius: 50px !important;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid #eee;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  text-decoration: none; /* 移除下划线 */
}
.pagination a:hover, .pagination .active, .pagination span.current {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
  border-radius: 50px !important;
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(255, 118, 117, 0.4);
}
.pagination a:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(255, 118, 117, 0.3);
}
.pagination .disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Footer */
.site-footer {
  background: var(--bg-card);
  padding: 40px 0 20px;
  margin-top: 60px;
  border-top: 4px solid var(--primary-color);
}
.footer-content { text-align: center; color: var(--text-light); }
.footer-links { margin-bottom: 20px; }
.footer-links a { margin: 0 10px; font-weight: bold; }

/* View Page */
.reader-container {
  max-width: 1000px;
  margin: 40px auto;
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  padding: 40px;
  min-height: 600px;
}
.book-header-info {
  text-align: center;
  margin-bottom: 40px;
  border-bottom: 2px dashed #eee;
  padding-bottom: 20px;
}
.reader-content {
  /* 使用变量控制阅读字号，便于交互调整 */
  font-size: var(--reader-font-size, 20px);
  line-height: 1.8;
  text-align: justify;
}
.reader-content .reading-active {
  /* 当前朗读段落高亮，柔和不刺眼 */
  background: rgba(255, 243, 200, 0.6);
  border-radius: 8px;
  padding: 4px 6px;
  transition: background 0.2s ease;
}
.reader-images img {
  margin: 20px auto;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
}
.reader-controls {
  display: flex;
  /* 修复控件错位：统一左侧对齐，允许自动换行 */
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  /* 防止点击按钮时误选中文本或图片 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
.reader-controls .nav-buttons {
  /* 将上一篇/下一篇导航推到最右侧 */
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 阅读区域图片禁止选中与拖拽 */
.reader-content img,
.swiper-slide img {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-user-drag: none;
}
.reader-voice {
  /* 朗读语速控件与按钮高度对齐 */
  display: inline-flex;
  align-items: center;
  gap: 8px;
}



/* Shared icon size for floating buttons */
.fab-icon {
  font-size: 22px;
  line-height: 1;
  display: inline-block;
}

/* Responsive */
@media (max-width: 768px) {
  /* 布局容器 */
  .container { padding: 0 15px; }
  :root { --header-height: 110px; }
  
  /* 头部导航适配 */
  .header-inner {
    flex-direction: column;
    gap: 15px;
  }
  .main-nav {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 5px; /* 隐藏滚动条占位 */
    -webkit-overflow-scrolling: touch;
  }
  .nav-item {
    flex: 0 0 auto; /* 防止压缩 */
    font-size: 14px;
    padding: 6px 12px;
  }
  .search-box {
    width: 100%;
  }
  .search-bar {
    width: 100%;
  }
  .search-input {
    width: 100%; /* 填满剩余空间 */
    flex: 1;
  }

  /* 首页 Hero 区域 */
  .hero-section { padding: 20px 0; border-radius: 0 0 20px 20px; }
  .hero-grid { grid-template-columns: 1fr; gap: 20px; }
  .hero-slider { height: 200px; border-radius: 12px; }
  
  /* 分类卡片横向排列 */
  .hero-sidebar {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 10px;
  }
  .category-card {
    min-width: 120px;
    flex: 0 0 auto;
    padding: 15px;
  }

  /* 书籍网格 */
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  .book-info { padding: 10px; }
  .book-title { font-size: 14px; }
  
  /* 阅读页适配 */
  .reader-container {
    padding: 20px;
    margin: 20px auto;
  }
  .reader-content {
    font-size: var(--reader-font-size, 18px);
    line-height: 1.6;
    text-align: left; /* 移动端取消两端对齐，避免大间隙 */
  }
  .book-header-info h1 { font-size: 24px !important; }
  
  /* 底部 */
  .footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  /* 超小屏幕适配 */
  .book-grid { gap: 10px; }
  .nav-item { padding: 5px 10px; font-size: 13px; }
}

/* 主题模式：夜间与护眼，通过切换 html/body 类名来覆盖变量 */
html.theme-dark, body.theme-dark {
  --bg-body: #121212;
  --bg-card: #1E1E1E;
  --text-main: #EAEAEA;
  --text-light: #B0B0B0;
  --primary-color: #FF7675;
  --secondary-color: #5FA8F5;
}
html.theme-eye, body.theme-eye {
  --bg-body: #EAF7E9;
  --bg-card: #FFFFFF;
  --text-main: #2D3436;
  --text-light: #4F5B62;
  --primary-color: #00B894;
  --secondary-color: #74B9FF;
}

/* 阅读设置按钮组 */
.reader-settings {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Floating Toolbar */
.floating-toolbar {
    position: fixed;
    right: 40px;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 999;
}

/* Toolbar Menu (Collapsible) */
.toolbar-menu {
    display: none;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom center;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}
.toolbar-menu.visible {
    display: flex;
}
.toolbar-menu.expanded {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Tool Buttons */
.tool-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    border: 2px solid #eee;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-main);
    transition: all 0.3s ease;
}
.tool-btn:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.tool-btn span {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: transform 0.3s ease;
}

/* Toggle Button Specific */
#toolbarToggle.active span {
    transform: rotate(90deg);
}

/* Back to Top integration */
#backToTop {
    display: none;
}
#backToTop.show {
    display: flex;
}
#backToTop svg {
    width: 22px;
    height: 22px;
}
#backToTop svg path {
    stroke: currentColor;
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Gallery Autoplay Controls */
.gallery-controls {
  position: absolute;
  top: auto;
  bottom: 15px;
  right: 15px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.65);
  padding: 6px 15px;
  border-radius: 50px;
  color: #fff;
  font-size: 13px;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: opacity 0.3s;
}
.gallery-top:hover .gallery-controls {
  opacity: 1;
}
.gallery-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  margin: 0;
  font-weight: 500;
  user-select: none;
}
.gallery-controls input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--primary-color);
}
.autoplay-settings {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 12px;
  border-left: 1px solid rgba(255,255,255,0.2);
}
.autoplay-settings input[type="number"] {
  width: 36px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 4px;
  padding: 2px 0;
  text-align: center;
  font-size: 12px;
  -moz-appearance: textfield;
}
.autoplay-settings input[type="number"]::-webkit-outer-spin-button,
.autoplay-settings input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.autoplay-settings input[type="number"]:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(255,255,255,0.25);
}
