/* ============================================================
   books-public.css — the public /books page (resources/views/books/*).

   Ported 1:1 from the approved books.html mockup. Header, breadcrumb,
   footer, dock, toast and the design tokens (--primary, --radius-*, ...)
   come from public-shell.css, so only what is specific to this page lives
   here. Card classes (book-box-card, book-cover-wrap, ...) are deliberately
   the same names the homepage "Books by Our Trainers" strip uses.
   ============================================================ */

html { scroll-behavior: smooth; }

/* ================= HERO BANNER ================= */
.books-banner-wrap {
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 55%, #fef3c7 100%);
  border: 1px solid #fde68a; border-radius: var(--radius-lg);
  padding: 22px 18px; margin: 8px 0 20px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-subtle);
}
@media (min-width: 860px) {
  .books-banner-wrap { padding: 28px 32px; }
  .books-banner-grid {
    display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 32px; align-items: center;
  }
}

.banner-heading-text {
  font-size: clamp(1.5rem, 3.2vw, 2.2rem); font-weight: 800; line-height: 1.2;
  letter-spacing: -0.03em; color: #0f172a; margin-bottom: 6px;
}
.banner-heading-text span.accent-yellow-text { color: #f59e0b; }

.banner-desc-sub {
  font-size: 0.82rem; color: #475569; line-height: 1.45; margin-bottom: 16px; max-width: 480px;
}

.hero-btn-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn-action-yellow {
  background: #f59e0b; color: #0f172a; font-weight: 800; font-size: 0.82rem;
  padding: 9px 18px; border-radius: var(--radius-sm); box-shadow: 0 4px 12px rgba(245, 158, 11, 0.28);
  transition: var(--transition); display: inline-flex; align-items: center; gap: 6px;
}
.btn-action-yellow:hover { background: #d97706; color: #fff; transform: translateY(-1px); }
.btn-action-outline {
  background: #ffffff; border: 1px solid var(--border); color: #0f172a; font-weight: 700;
  font-size: 0.82rem; padding: 9px 16px; border-radius: var(--radius-sm); transition: var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-action-outline:hover { border-color: #0f172a; }

/* Hero right visual with 3 floating pills */
.hero-right-visual-container {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; margin-top: 14px;
}
@media (min-width: 860px) { .hero-right-visual-container { margin-top: 0; flex-direction: row; } }

.tablet-visual-box {
  width: 100%; max-width: 300px; aspect-ratio: 4/3; background: #0f172a;
  border-radius: 12px; padding: 8px; box-shadow: 0 14px 28px -6px rgba(15, 23, 42, 0.18);
  border: 2px solid #334155; position: relative; overflow: hidden;
}
.tablet-grid-inner {
  width: 100%; height: 100%; background: #fff; border-radius: 6px; overflow: hidden;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); gap: 4px; padding: 6px;
}
.mini-book-thumb { background: #f1f5f9; border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.mini-book-thumb img { width: 100%; height: 100%; object-fit: cover; }

.hero-floating-pills-list {
  display: flex; flex-direction: column; gap: 8px; margin-top: 14px; width: 100%;
}
@media (min-width: 860px) {
  .hero-floating-pills-list {
    position: absolute; right: -12px; top: 50%; transform: translateY(-50%);
    width: 210px; margin-top: 0; z-index: 5;
  }
}
.hero-prop-pill {
  background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(8px);
  border: 1px solid rgba(226, 232, 240, 0.9); border-radius: var(--radius-md);
  padding: 7px 10px; box-shadow: 0 4px 14px -2px rgba(15, 23, 42, 0.08);
  display: flex; align-items: center; gap: 8px;
}
.prop-pill-icon {
  width: 26px; height: 26px; border-radius: 50%; background: #eff6ff; color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 0.8rem; flex-shrink: 0;
}
.hero-prop-pill strong { font-size: 0.72rem; font-weight: 800; color: #0f172a; display: block; line-height: 1.1; }
.hero-prop-pill span { font-size: 0.7rem; color: var(--text-muted); line-height: 1.2; display: block; }

/* ================= LISTING TITLE + SEARCH + FILTER TABS + SORT ================= */
.books-list-title { font-size: 1.05rem; font-weight: 800; color: #0f172a; margin-bottom: 10px; }

.books-search-box {
  display: flex; align-items: center; background: #ffffff; border: 1.5px solid var(--border);
  border-radius: var(--radius-full); padding: 8px 14px; gap: 8px; max-width: 420px;
  margin-bottom: 12px; transition: var(--transition);
}
.books-search-box:focus-within { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,0.14); }
.books-search-submit { color: var(--text-subtle); font-size: 1rem; flex-shrink: 0; display: inline-flex; padding: 0; }
.books-search-box input {
  flex: 1; border: none; outline: none; font-size: 16px; font-family: inherit; color: var(--text-main);
  min-width: 0; background: transparent; -webkit-appearance: none; appearance: none;
}
.books-search-box input::-webkit-search-cancel-button,
.books-search-box input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.books-search-clear { color: var(--text-subtle); font-size: 0.95rem; flex-shrink: 0; display: none; }
.books-search-box.has-value .books-search-clear { display: inline-flex; }
.books-search-clear:hover { color: #0f172a; }
@media (min-width: 768px) { .books-search-box input { font-size: 0.85rem; } }

.filter-section-header { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
@media (min-width: 768px) {
  .filter-section-header { flex-direction: row; align-items: center; justify-content: space-between; }
}

.filter-pills-row {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; padding-bottom: 2px;
}
.filter-pills-row::-webkit-scrollbar { display: none; }

.category-filter-tab {
  padding: 6px 14px; border-radius: var(--radius-full); font-size: 0.76rem; font-weight: 700;
  color: var(--text-muted); background: #ffffff; border: 1px solid var(--border);
  cursor: pointer; white-space: nowrap; transition: var(--transition);
}
.category-filter-tab:hover { border-color: #0f172a; color: #0f172a; }
.category-filter-tab.active {
  background: #fef3c7; color: #b45309; border-color: #fde68a; font-weight: 800;
}

.sort-control-lockup { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.sort-control-lockup label { font-size: 0.74rem; color: var(--text-muted); font-weight: 600; }
.sort-native-select {
  background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 5px 10px; font-size: 16px; font-weight: 700; color: #0f172a; outline: none; cursor: pointer;
  font-family: inherit;
}
.filter-format-group { display: inline-flex; align-items: center; gap: 6px 8px; }
@media (min-width: 768px) {
  .sort-native-select { font-size: 0.76rem; }
  .sort-control-lockup { margin-left: auto; }          /* stays on the right even when the category pills are hidden */
  .filter-format-group { margin-right: 6px; }
}

.books-result-meta { font-size: 0.74rem; font-weight: 600; color: var(--text-muted); margin: 2px 0 12px; min-height: 1.1em; }

/* ================= BOOK GRID + CARDS (same look as the homepage strip) ================= */
.books-grid-layout {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px;
  transition: opacity 0.18s ease;
}
@media (min-width: 580px) { .books-grid-layout { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 860px) { .books-grid-layout { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 1100px) { .books-grid-layout { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* While an instant-filter request is in flight. */
.books-grid-layout[aria-busy="true"] { opacity: 0.45; pointer-events: none; }

.book-box-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow: hidden; box-shadow: var(--shadow-subtle); display: flex; flex-direction: column;
  transition: var(--transition); position: relative; min-width: 0;
}
.book-box-card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px -6px rgba(37, 99, 235, 0.14); border-color: #cbd5e1; }

.book-cover-wrap { position: relative; height: 185px; background: #1e1b4b; overflow: hidden; }
.book-cover-wrap img { width: 100%; height: 100%; object-fit: cover; }

/* Placeholder colours while the cover loads / when a book has none (from the mockup). */
.cover-tone-0 { background: #1e3a8a; }
.cover-tone-1 { background: #0f172a; }
.cover-tone-2 { background: #1e1b4b; }
.cover-tone-3 { background: #d97706; }
.cover-tone-4 { background: #334155; }
.cover-tone-5 { background: #ea580c; }

.book-cover-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.85); font-size: 2.6rem;
}

.book-badge-tag {
  position: absolute; top: 6px; left: 6px; background: var(--accent-purple);
  color: #fff; padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; z-index: 2;
}
.book-badge-tag.badge-new { background: var(--accent-green); }

.book-wishlist-toggle {
  position: absolute; top: 6px; right: 6px; z-index: 3;
  width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,0.92);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
  color: var(--text-main); font-size: 0.88rem; box-shadow: 0 2px 4px rgba(0,0,0,0.12);
  transition: var(--transition);
}
.book-wishlist-toggle:hover { color: var(--accent-red); transform: scale(1.1); }
.book-wishlist-toggle.saved { color: var(--accent-red); }

.book-details-box { padding: 10px; display: flex; flex-direction: column; flex: 1; min-width: 0; }
.book-details-box h3 {
  font-size: 0.82rem; font-weight: 700; color: #0f172a; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; margin-bottom: 2px;
}
.book-details-box p.author-line {
  font-size: 0.68rem; color: var(--text-muted); margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Sits where the mockup's star rating row was — books have no rating data, but they do have a topic. */
.book-details-box p.book-category-line {
  display: flex; align-items: center; gap: 3px; font-size: 0.66rem; font-weight: 700; color: #0f172a; margin-bottom: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.book-category-line i { color: var(--accent-amber-text, #b45309); font-size: 0.72rem; }

.book-reward-pill-row {
  display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 8px; flex-wrap: wrap;
}
.format-type-tag {
  font-size: 0.7rem; font-weight: 700; color: var(--primary); background: var(--primary-light);
  padding: 1px 5px; border-radius: 4px; white-space: nowrap;
}
.format-type-tag.fmt-hardcover { color: #d97706; background: #fffbeb; }
.format-type-tag.fmt-ebook { color: #7c3aed; background: #f5f3ff; }
.discount-rate-tag {
  font-size: 0.7rem; font-weight: 700; color: #15803d; background: #f0fdf4; border: 1px solid #bbf7d0;
  padding: 1px 4px; border-radius: 4px; white-space: nowrap;
}

.book-price-row {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border-light);
}
.book-price-stack { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.book-price-row strong { font-size: 0.88rem; font-weight: 800; color: #0f172a; }
.book-mrp { font-size: 0.7rem; font-weight: 500; color: var(--text-subtle); }
.btn-book-buy {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  background: var(--accent-purple); color: #fff !important; font-size: 0.72rem; font-weight: 700;
  padding: 4px 9px; border-radius: var(--radius-xs); transition: var(--transition);
}
.btn-book-buy:hover { background: #6b21a8; transform: translateY(-1px); }
.btn-book-buy.is-disabled { background: #e2e8f0; color: var(--text-muted) !important; cursor: not-allowed; }
.btn-book-buy.is-disabled:hover { background: #e2e8f0; transform: none; }

/* ================= EMPTY STATE ================= */
.books-empty-state { grid-column: 1 / -1; text-align: center; padding: 50px 20px; }
.books-empty-state > i { font-size: 2.2rem; color: var(--text-subtle); display: block; margin-bottom: 10px; }
.books-empty-state h3 { font-size: 1rem; font-weight: 800; color: #0f172a; margin-bottom: 4px; }
.books-empty-state p { font-size: 0.84rem; color: var(--text-muted); margin-bottom: 14px; }

/* ================= VIEW MORE ================= */
.view-more-center-wrap { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; margin: 12px 0 28px; }
.btn-view-more-rounded {
  background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-full);
  padding: 8px 20px; font-size: 0.78rem; font-weight: 700; color: var(--text-main);
  box-shadow: var(--shadow-subtle); display: inline-flex; align-items: center; gap: 6px;
  transition: var(--transition);
}
.btn-view-more-rounded:hover { border-color: #0f172a; background: #f8fafc; }
.btn-view-more-rounded.is-loading { opacity: 0.6; pointer-events: none; }
.books-prev-link { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); display: inline-flex; align-items: center; gap: 2px; }
.books-prev-link:hover { color: var(--primary); }
