/* Books-specific styles */

/* Hero */
.books-hero { text-align: center; padding: 50px 24px 30px; transition: padding 0.3s; }
.books-hero.compact { padding: 24px 24px 16px; }
.books-hero.compact h1 { font-size: 28px; }
.books-hero.compact > p { display: none; }
.books-hero.compact .books-count { display: none; }
.books-hero h1 { font-family: var(--heading-font); font-size: 38px; font-weight: 400; margin-bottom: 6px; color: var(--text); }
.books-hero > p { color: var(--text-muted); font-size: 15px; }
.books-count { margin-top: 6px; font-size: 14px; }
.books-count strong { font-family: var(--mono-font); color: var(--text-secondary); font-size: 16px; }
.books-search-wrap {
  max-width: 520px; margin: 28px auto 0; display: flex; align-items: center;
  border: 1.5px solid var(--border); border-radius: 28px; padding: 4px 6px 4px 18px;
  background: var(--bg); transition: border-color 0.2s, box-shadow 0.2s;
}
.books-search-wrap:focus-within { border-color: var(--text-muted); box-shadow: 0 2px 16px var(--shadow); }
.books-search-wrap .search-icon { color: var(--text-muted); margin-right: 10px; flex-shrink: 0; }
.books-search-wrap input { flex: 1; border: none; outline: none; font-size: 15px; padding: 12px 4px; background: transparent; color: var(--text); font-family: var(--body-font); }
.books-search-wrap input::placeholder { color: var(--text-muted); }
.books-search-wrap button {
  background: var(--text); color: var(--bg); border: none; padding: 10px 24px;
  border-radius: 22px; font-size: 13px; font-weight: 600; cursor: pointer; transition: opacity 0.2s;
}
.books-search-wrap button:hover { opacity: 0.8; }

/* Subject Grid */
.books-browse { max-width: 900px; margin: 0 auto; padding: 10px 24px 50px; }
.books-browse h2 {
  font-family: var(--heading-font); font-size: 20px; font-weight: 400;
  margin-bottom: 20px; color: var(--text-secondary); text-align: center;
}
.subject-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.subject-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 24px 16px; cursor: pointer; transition: all 0.25s; text-align: center;
  position: relative; overflow: hidden;
}
.subject-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #3366cc, #6b9eff); opacity: 0; transition: opacity 0.25s;
}
.subject-card:hover { border-color: var(--link); transform: translateY(-4px); box-shadow: 0 8px 24px var(--shadow); }
.subject-card:hover::before { opacity: 1; }
.subject-card .icon { font-size: 32px; margin-bottom: 10px; display: block; }
.subject-card h3 { font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: -0.2px; }

/* Search Results */
.search-results { max-width: 800px; margin: 0 auto; padding: 0 24px 50px; }
.search-results h2 {
  font-family: var(--heading-font); font-size: 22px; font-weight: 400;
  margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--border); color: var(--text-secondary);
}
.results-grid { display: flex; flex-direction: column; gap: 12px; }
.result-item {
  padding: 20px 24px; border-radius: 12px; cursor: pointer; transition: all 0.25s;
  background: var(--bg); border: 1px solid var(--border); position: relative; overflow: hidden;
}
.result-item::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--link); opacity: 0; transition: opacity 0.25s;
}
.result-item:hover { border-color: var(--link); box-shadow: 0 4px 16px var(--shadow); transform: translateX(4px); }
.result-item:hover::before { opacity: 1; }
.result-item .book-tag {
  font-size: 11px; color: #fff; background: #3366cc; padding: 3px 12px;
  border-radius: 12px; display: inline-block; margin-bottom: 8px; font-weight: 600;
  letter-spacing: 0.3px;
}
.result-item h3 {
  font-family: var(--heading-font); font-size: 18px; font-weight: 600;
  color: var(--text); margin-bottom: 6px; line-height: 1.3;
}
.result-item:hover h3 { color: var(--link); }
.result-item p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.result-item .chapter-path {
  font-size: 12px; color: var(--text-muted); margin-top: 8px; font-family: var(--mono-font);
  opacity: 0.7;
}

/* Book Layout */
.book-layout { max-width: 1100px; margin: 0 auto; padding: 24px; display: grid; grid-template-columns: 260px 1fr; gap: 28px; }
#book-sidebar { align-self: start; }
.sidebar-sticky {
  position: sticky; top: 70px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px; max-height: calc(100vh - 90px); overflow-y: auto;
}
.book-name {
  font-family: var(--heading-font); font-size: 17px; font-weight: 600; color: var(--text);
  margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid var(--link);
}
#chapter-nav { display: flex; flex-direction: column; gap: 1px; }
#chapter-nav a {
  font-size: 13px; color: var(--text-secondary); padding: 7px 10px;
  text-decoration: none; border-radius: 6px; transition: all 0.15s; line-height: 1.4;
}
#chapter-nav a:hover { background: var(--bg-secondary); color: var(--link); text-decoration: none; }
#chapter-nav a.active { background: #3366cc15; color: var(--link); font-weight: 600; }

#chapter-content {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 36px 44px; min-height: 400px;
}
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--link); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
#chapter-title {
  font-family: var(--heading-font); font-size: 30px; font-weight: 400; color: var(--text);
  border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 20px;
}
#chapter-body { font-size: 15px; line-height: 1.8; color: var(--text); }
#chapter-body p { margin-bottom: 14px; }
#chapter-body h2 {
  font-family: var(--heading-font); font-size: 22px; font-weight: 400;
  border-bottom: 1px solid var(--border); padding-bottom: 4px; margin: 28px 0 14px;
}
#chapter-body h3 { font-family: var(--heading-font); font-size: 17px; font-weight: 600; margin: 20px 0 10px; }

/* Footer */
#footer { background: var(--bg-secondary); border-top: 1px solid var(--border); padding: 28px; text-align: center; margin-top: 50px; }
.footer-inner p { font-size: 13px; color: var(--text-muted); }
.footer-inner a { color: var(--link); text-decoration: none; }
.small { font-size: 11px; margin-top: 4px; }

/* Responsive */
@media (max-width: 900px) {
  .subject-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .subject-grid { grid-template-columns: repeat(2, 1fr); }
  .book-layout { grid-template-columns: 1fr; }
  #book-sidebar { display: none; }
  #chapter-content { padding: 20px; }
}
@media (max-width: 480px) {
  .books-hero h1 { font-size: 28px; }
  .subject-card { padding: 16px 12px; }
  .subject-card .icon { font-size: 26px; }
}
