/* ================================================================
   CATALOG BOOK (Flipbook) Styles
   ================================================================ */

html.catalog-page {
  scroll-snap-type: none !important;
}

.book-section {
  padding-top: calc(var(--nav-height, 72px) + 2rem);
  padding-bottom: 2rem;
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
}

.book-wrapper {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 2400px;
}

.book-container {
  margin: 0 auto;
}

/* Page flip library overrides */
.stf__parent {
  margin: 0 auto;
}

.stf__wrapper {
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.15),
    0 8px 25px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

[data-theme="dark"] .stf__wrapper {
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 8px 25px rgba(0, 0, 0, 0.3);
}

/* ---- Individual page styling ---- */
.book-page {
  background: #ffffff;
  overflow: hidden;
}

[data-theme="dark"] .book-page {
  background: #1e1e24;
}

.page-content {
  width: 100%;
  height: 100%;
  padding: 1.75rem 1.75rem 2rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* ---- Cover pages ---- */
.page-cover {
  background: linear-gradient(145deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #ffffff;
}

[data-theme="dark"] .page-cover {
  background: linear-gradient(145deg, #0a0a14 0%, #0e1525 50%, #0a2040 100%);
}

.cover-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.cover-logo {
  width: 72px;
  height: 72px;
  margin-bottom: 0.5rem;
  filter: brightness(1.1);
}

.page-cover h1 {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  margin: 0;
  color: #fff;
}

.cover-subtitle {
  font-size: 1.1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
}

.cover-divider {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  margin: 0.75rem 0;
}

.cover-desc {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

.cover-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1rem;
}

.cover-tags span {
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.7);
}

/* Back cover */
.page-back-cover {
  background: linear-gradient(145deg, #0f3460 0%, #16213e 50%, #1a1a2e 100%);
}

.back-cover-company {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin: 0.5rem 0 1.5rem;
}

.back-cover-info {
  text-align: center;
}

.back-cover-info p {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0.3rem 0;
  line-height: 1.6;
}

/* ---- TOC page ---- */
.page-toc {
  padding: 2rem 1.75rem;
  justify-content: center;
}

.page-section-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--brand-primary);
}

.toc-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toc-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.toc-item:hover {
  border-color: var(--brand-primary);
  transform: translateX(4px);
}

.toc-num {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand-primary);
  min-width: 2rem;
}

.toc-info {
  flex: 1;
}

.toc-info strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.toc-info span {
  font-size: 0.82rem;
  color: var(--text-tertiary);
}

.toc-page {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ---- Section start pages ---- */
.page-section-start {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
}

.section-main-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0.75rem 0;
  letter-spacing: -0.02em;
}

.section-main-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 460px;
  line-height: 1.75;
  margin: 0.5rem 0 1rem;
}

.section-spec-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
  max-width: 400px;
  margin-top: 1rem;
}

.section-spec-mini div {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  text-align: center;
}

.section-spec-mini strong {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand-primary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 0.2rem;
}

.section-spec-mini span {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ---- Process flow (book version) ---- */
.process-flow-book {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.pf-step {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  text-align: center;
}

.pf-step strong {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pf-step span {
  font-size: 0.6rem;
  color: var(--text-tertiary);
}

.pf-arrow {
  font-size: 0.85rem;
  color: var(--text-disabled);
}

/* ---- Feature pages ---- */
.feature-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--brand-primary);
  flex-shrink: 0;
}

.book-figure {
  width: 100%;
  overflow: hidden;
  border: none;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.book-figure:hover {
  transform: scale(1.01);
}

.book-figure img {
  width: 100%;
  height: auto;
  display: block;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
}

.feature-list li {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: 0.2rem 0 0.2rem 1.1rem;
  position: relative;
}

.feature-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brand-primary);
}

/* ---- Mobile gallery ---- */
.mobile-gallery {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  justify-content: center;
  align-items: flex-start;
}

.mobile-thumb {
  flex: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.mobile-thumb:hover {
  transform: scale(1.02);
}

.mobile-thumb img {
  width: 100%;
  height: auto;
  display: block;
}

.mobile-thumb figcaption {
  font-size: 0.65rem;
  text-align: center;
  padding: 0.3rem;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
}

/* ---- Feature visual placeholder ---- */
.feature-visual-placeholder {
  width: 100%;
  height: 200px;
  border-radius: 8px;
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  background: var(--bg-secondary);
  gap: 0.5rem;
}

.placeholder-icon {
  font-size: 2.5rem;
}

.feature-visual-placeholder span {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

/* ---- Export formats grid ---- */
.export-formats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.export-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.5rem;
  text-align: center;
}

.export-item strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand-primary);
  margin-bottom: 0.15rem;
}

.export-item span {
  font-size: 0.68rem;
  color: var(--text-tertiary);
}

/* ---- Tech specs mini ---- */
.tech-specs-mini {
  margin-top: 0.5rem;
}

.tech-specs-mini h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--brand-primary);
}

.ts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.ts-grid div {
  padding: 0.4rem 0.5rem;
  background: var(--bg-secondary);
  border-radius: 4px;
  border: 1px solid var(--border);
}

.ts-grid strong {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  margin-bottom: 0.1rem;
}

.ts-grid span {
  font-size: 0.75rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* ---- Page number ---- */
.page-number {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--text-disabled);
  font-weight: 500;
}

/* ---- Solution badges ---- */
.solution-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  margin-bottom: 0.5rem;
}

.badge-factory { background: rgba(49, 130, 246, 0.1); color: #2563eb; }
.badge-flood { background: rgba(16, 185, 129, 0.1); color: #059669; }
.badge-cctv { background: rgba(245, 158, 11, 0.1); color: #D97706; }
.badge-medical { background: rgba(139, 92, 246, 0.1); color: #7C3AED; }
.badge-stenography { background: rgba(236, 72, 153, 0.1); color: #DB2777; }

[data-theme="dark"] .badge-factory { background: rgba(49, 130, 246, 0.15); color: #60a5fa; }
[data-theme="dark"] .badge-flood { background: rgba(16, 185, 129, 0.15); color: #34d399; }
[data-theme="dark"] .badge-cctv { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
[data-theme="dark"] .badge-medical { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
[data-theme="dark"] .badge-stenography { background: rgba(236, 72, 153, 0.15); color: #f472b6; }

/* ---- Book controls ---- */
.book-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.book-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.book-btn:hover {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
  transform: scale(1.05);
}

.book-page-info {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 70px;
  text-align: center;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
  .book-section {
    padding-top: calc(var(--nav-height, 72px) + 1rem);
    padding-bottom: 1rem;
  }

  .book-wrapper {
    padding: 0 0.5rem;
  }

  .page-content {
    padding: 1.5rem 1.25rem;
  }

  .page-cover h1 {
    font-size: 1.75rem;
  }

  .cover-subtitle {
    font-size: 0.9rem;
  }

  .cover-logo {
    width: 56px;
    height: 56px;
  }

  .section-main-title {
    font-size: 1.4rem;
  }

  .section-main-desc {
    font-size: 0.85rem;
  }

  .section-spec-mini {
    gap: 0.35rem;
  }

  .section-spec-mini div {
    padding: 0.35rem 0.4rem;
  }

  .section-spec-mini strong {
    font-size: 0.6rem;
  }

  .section-spec-mini span {
    font-size: 0.68rem;
  }

  .feature-title {
    font-size: 1.15rem;
  }

  .feature-list li {
    font-size: 0.82rem;
  }

  .mobile-gallery {
    gap: 0.4rem;
  }

  .toc-item {
    padding: 0.6rem 0.75rem;
  }

  .toc-num {
    font-size: 1rem;
  }

  .toc-info strong {
    font-size: 0.8rem;
  }

  .process-flow-book {
    gap: 0.2rem;
  }

  .pf-step {
    padding: 0.3rem 0.4rem;
  }

  .pf-step strong {
    font-size: 0.62rem;
  }

  .pf-step span {
    font-size: 0.55rem;
  }

  .export-formats {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
  }

  .export-item {
    padding: 0.4rem 0.3rem;
  }

  .export-item strong {
    font-size: 0.75rem;
  }

  .export-item span {
    font-size: 0.6rem;
  }

  .feature-visual-placeholder {
    height: 150px;
  }

  .placeholder-icon {
    font-size: 2rem;
  }

  .book-controls {
    margin-top: 1rem;
    gap: 1rem;
  }

  .book-btn {
    width: 38px;
    height: 38px;
  }
}

@media (max-width: 480px) {
  .page-content {
    padding: 1.25rem 1rem;
  }

  .page-cover h1 {
    font-size: 1.5rem;
    letter-spacing: 0.1em;
  }

  .section-main-title {
    font-size: 1.1rem;
  }

  .feature-title {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }


  .ts-grid {
    grid-template-columns: 1fr;
  }
}
