/**
 * BIBLIOTECA PRIME — Enterprise Digital Marketplace Design System
 * Aesthetic Direction: Apple Books + Stripe + Audible + Envato Market
 * WCAG AA Verified Contrast | Strict 2:3 Book Proportions | Zero Horizontal Overflow
 */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
  --bp-font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --bp-font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --bp-font-mono: 'JetBrains Mono', monospace;

  /* Core Brand & Surface Tokens */
  --bp-ink-950: #090d16;
  --bp-ink-900: #0f172a;
  --bp-ink-800: #1e293b;
  --bp-ink-700: #334155;
  --bp-ink-500: #64748b;
  --bp-ink-400: #94a3b8;
  --bp-surface-0: #ffffff;
  --bp-surface-50: #f8fafc;
  --bp-surface-100: #f1f5f9;
  --bp-surface-200: #e2e8f0;
  --bp-surface-300: #cbd5e1;

  /* Conversion & Status Accents */
  --bp-accent: #2563eb;
  --bp-accent-hover: #1d4ed8;
  --bp-accent-soft: #eff6ff;
  --bp-emerald: #059669;
  --bp-emerald-hover: #047857;
  --bp-emerald-soft: #ecfdf5;
  --bp-amber: #d97706;
  --bp-amber-soft: #fffbeb;
  --bp-crimson: #dc2626;

  /* Elevation & Book Realism Shadows */
  --bp-shadow-xs: 0 1px 2px rgba(9, 13, 22, 0.05);
  --bp-shadow-sm: 0 2px 6px -1px rgba(9, 13, 22, 0.07), 0 1px 3px -1px rgba(9, 13, 22, 0.05);
  --bp-shadow-md: 0 10px 25px -5px rgba(9, 13, 22, 0.08), 0 4px 10px -3px rgba(9, 13, 22, 0.04);
  --bp-shadow-lg: 0 20px 40px -12px rgba(9, 13, 22, 0.16);
  --bp-shadow-book: 0 14px 28px -8px rgba(9, 13, 22, 0.28), 0 4px 10px -2px rgba(9, 13, 22, 0.14);
  --bp-shadow-book-hover: 0 22px 42px -10px rgba(9, 13, 22, 0.38), 0 8px 16px -4px rgba(9, 13, 22, 0.2);

  --bp-radius-sm: 6px;
  --bp-radius-md: 10px;
  --bp-radius-lg: 16px;
  --bp-radius-xl: 22px;
  --bp-transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
  font-family: var(--bp-font-sans);
  background-color: var(--bp-surface-50);
  color: var(--bp-ink-900);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--bp-ink-900);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

a {
  transition: var(--bp-transition);
}

/* ==========================================================================
   1. TOP ANNOUNCEMENT & STICKY GLASS HEADER
   ========================================================================== */
.bp-topbar {
  background-color: var(--bp-ink-950);
  color: var(--bp-ink-400);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.bp-topbar strong {
  color: #fff;
  font-weight: 600;
}

.bp-navbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--bp-surface-200);
  padding: 0.75rem 0;
  z-index: 1030;
}

.bp-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.035em;
  color: var(--bp-ink-950);
}

.bp-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--bp-ink-900) 0%, var(--bp-accent) 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.bp-brand span {
  color: var(--bp-accent);
}

.bp-nav-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--bp-ink-700);
  padding: 0.5rem 0.9rem;
  border-radius: var(--bp-radius-sm);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.bp-nav-link:hover,
.bp-nav-link.active {
  color: var(--bp-ink-950);
  background-color: var(--bp-surface-100);
}

.bp-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.95rem;
  border-radius: var(--bp-radius-md);
  text-decoration: none;
  border: 1px solid var(--bp-surface-200);
  background: var(--bp-surface-0);
  color: var(--bp-ink-900);
}

.bp-header-btn:hover {
  border-color: var(--bp-surface-300);
  background: var(--bp-surface-50);
  color: var(--bp-ink-950);
}

/* ==========================================================================
   2. HERO & CODECANYON-INSPIRED COMMAND SEARCH
   ========================================================================== */
.bp-hero {
  position: relative;
  background-color: var(--bp-ink-950);
  background-image: 
    radial-gradient(at 20% 0%, rgba(37, 99, 235, 0.28) 0px, transparent 50%),
    radial-gradient(at 80% 10%, rgba(5, 150, 105, 0.18) 0px, transparent 50%),
    linear-gradient(180deg, #090d16 0%, #111827 100%);
  color: #ffffff;
  padding: 3.75rem 0 3.25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.bp-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #93c5fd;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.35rem 0.9rem;
  border-radius: 9999px;
  margin-bottom: 1.25rem;
}

.bp-hero-title {
  color: #ffffff;
  font-size: clamp(2.1rem, 4.2vw, 3.35rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 0.85rem;
}

.bp-hero-subtitle {
  color: #94a3b8;
  font-size: 1.1rem;
  max-width: 640px;
  margin: 0 auto 2rem auto;
  font-weight: 400;
}

.bp-search-container {
  max-width: 820px;
  margin: 0 auto;
  position: relative;
}

.bp-search-box {
  background: #ffffff;
  border-radius: 14px;
  padding: 0.45rem 0.5rem 0.45rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.15);
  transition: var(--bp-transition);
}

.bp-search-box:focus-within {
  box-shadow: 0 20px 50px rgba(37, 99, 235, 0.35), 0 0 0 3px var(--bp-accent);
}

.bp-search-box input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--bp-ink-950);
  background: transparent;
}

.bp-search-box input::placeholder {
  color: var(--bp-ink-400);
}

.bp-search-select {
  border: none;
  outline: none;
  background-color: var(--bp-surface-100);
  color: var(--bp-ink-800);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
}

.bp-search-submit {
  background: var(--bp-accent);
  color: #ffffff;
  border: none;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.7rem 1.6rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: var(--bp-transition);
}

.bp-search-submit:hover {
  background: var(--bp-accent-hover);
  transform: translateY(-1px);
}

.bp-search-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.2rem;
  font-size: 0.82rem;
  color: #94a3b8;
}

.bp-search-tag {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 500;
}

.bp-search-tag:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* Autocomplete Dropdown */
.bp-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--bp-surface-200);
  border-radius: 12px;
  box-shadow: var(--bp-shadow-lg);
  z-index: 1050;
  overflow: hidden;
  display: none;
  text-align: left;
}

.bp-search-dropdown.show {
  display: block;
}

.bp-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.15rem;
  border-bottom: 1px solid var(--bp-surface-100);
  text-decoration: none;
  color: var(--bp-ink-900);
}

.bp-search-item:hover {
  background-color: var(--bp-surface-50);
}

/* Value Proposition Trust Bar */
.bp-trust-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--bp-surface-200);
  padding: 0.9rem 0;
  font-size: 0.85rem;
  color: var(--bp-ink-700);
  font-weight: 600;
}

/* ==========================================================================
   3. STRICT 2:3 BOOK CARDS & EDITORIAL PUBLISHER COVER SYSTEM
   ========================================================================== */
.bp-book-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.35rem 1rem;
}

@media (min-width: 576px) {
  .bp-book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.65rem 1.25rem;
  }
}

@media (min-width: 992px) {
  .bp-book-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.85rem 1.5rem;
  }
}

@media (min-width: 1200px) {
  .bp-book-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 1400px) {
  .bp-book-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

/* Catalog 4-column grid alongside sidebar */
.bp-catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem 1.15rem;
}

@media (min-width: 768px) {
  .bp-catalog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.75rem 1.35rem;
  }
}

@media (min-width: 1200px) {
  .bp-catalog-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2rem 1.5rem;
  }
}

.bp-book-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: transparent;
  position: relative;
}

.bp-cover-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 6px 10px 10px 6px;
  overflow: hidden;
  background-color: var(--bp-ink-900);
  box-shadow: var(--bp-shadow-book);
  transition: var(--bp-transition);
  margin-bottom: 0.85rem;
  display: block;
  text-decoration: none;
}

/* Realistic Book Spine Crease Lighting Overlay */
.bp-cover-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.22) 0%,
    rgba(255, 255, 255, 0.06) 3.5%,
    rgba(0, 0, 0, 0.18) 5.5%,
    rgba(255, 255, 255, 0.08) 7.5%,
    transparent 14%
  );
  pointer-events: none;
  z-index: 3;
}

.bp-book-card:hover .bp-cover-wrapper {
  transform: translateY(-6px);
  box-shadow: var(--bp-shadow-book-hover);
}

.bp-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Editorial Publisher Cover Generator (Fallback Artwork) */
.bp-editorial-cover {
  width: 100%;
  height: 100%;
  padding: 1.15rem 1rem 1.1rem 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  color: #ffffff;
  overflow: hidden;
}

/* Subtle Geometric Publisher Watermark Inside Cover */
.bp-editorial-cover::before {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;
  bottom: 10px;
  left: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  pointer-events: none;
}

/* Genre-Specific Publisher Palettes */
.bp-palette-obsidian {
  background: radial-gradient(circle at 80% 20%, #334155 0%, #0f172a 65%, #090d16 100%);
}
.bp-palette-emerald {
  background: radial-gradient(circle at 80% 20%, #059669 0%, #064e3b 65%, #022c22 100%);
}
.bp-palette-crimson {
  background: radial-gradient(circle at 80% 20%, #b91c1c 0%, #7f1d1d 65%, #450a0a 100%);
}
.bp-palette-cobalt {
  background: radial-gradient(circle at 80% 20%, #2563eb 0%, #1e3a8a 65%, #172554 100%);
}
.bp-palette-amber {
  background: radial-gradient(circle at 80% 20%, #d97706 0%, #78350f 65%, #451a03 100%);
}
.bp-palette-plum {
  background: radial-gradient(circle at 80% 20%, #9333ea 0%, #581c87 65%, #3b0764 100%);
}
.bp-palette-slate {
  background: radial-gradient(circle at 80% 20%, #475569 0%, #1e293b 65%, #0f172a 100%);
}

.bp-ed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  z-index: 2;
}

.bp-ed-body {
  my: auto;
  z-index: 2;
  padding: 0.5rem 0;
}

.bp-ed-title {
  font-family: var(--bp-font-serif);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.12;
  color: #ffffff;
  margin-bottom: 0.45rem;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.bp-ed-divider {
  width: 28px;
  height: 2px;
  background: rgba(255, 255, 255, 0.45);
  margin: 0.5rem 0;
}

.bp-ed-footer {
  z-index: 2;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Floating Format Badges */
.bp-format-badges {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  display: flex;
  gap: 0.3rem;
  z-index: 4;
}

.bp-pill-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.bp-pill-audio {
  background: rgba(9, 13, 22, 0.88);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.bp-pill-ebook {
  background: rgba(9, 13, 22, 0.82);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Book Card Details Below Cover */
.bp-card-body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.bp-card-category {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bp-accent);
  margin-bottom: 0.2rem;
}

.bp-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--bp-ink-900);
  text-decoration: none;
  line-height: 1.32;
  margin-bottom: 0.2rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bp-card-title:hover {
  color: var(--bp-accent);
}

.bp-card-author {
  font-size: 0.82rem;
  color: var(--bp-ink-500);
  text-decoration: none;
  margin-bottom: 0.65rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bp-card-author:hover {
  color: var(--bp-ink-900);
}

.bp-card-meta-footer {
  margin-top: auto;
  padding-top: 0.6rem;
  border-top: 1px solid var(--bp-surface-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.bp-card-price {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--bp-ink-950);
  font-variant-numeric: tabular-nums;
}

.bp-card-price.is-free {
  color: var(--bp-emerald);
}

.bp-card-cta {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.38rem 0.75rem;
  border-radius: 7px;
  text-decoration: none;
  background-color: var(--bp-surface-100);
  color: var(--bp-ink-900);
  border: 1px solid var(--bp-surface-200);
  white-space: nowrap;
}

.bp-book-card:hover .bp-card-cta {
  background-color: var(--bp-ink-900);
  color: #ffffff;
  border-color: var(--bp-ink-900);
}

/* ==========================================================================
   4. CATEGORY SHOWCASE TILES
   ========================================================================== */
.bp-genre-card {
  background: #ffffff;
  border: 1px solid var(--bp-surface-200);
  border-radius: var(--bp-radius-md);
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: var(--bp-ink-900);
  box-shadow: var(--bp-shadow-xs);
}

.bp-genre-card:hover {
  border-color: var(--bp-accent);
  box-shadow: var(--bp-shadow-md);
  transform: translateY(-2px);
}

/* ==========================================================================
   5. PRODUCT DETAIL PAGE & AUDIBLE CHAPTER PLAYER
   ========================================================================== */
.bp-buy-panel {
  background: #ffffff;
  border: 1px solid var(--bp-surface-200);
  border-radius: var(--bp-radius-lg);
  padding: 1.75rem;
  box-shadow: var(--bp-shadow-md);
  position: sticky;
  top: 96px;
}

.bp-btn-buy {
  background: var(--bp-emerald);
  color: #ffffff;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.9rem 1.4rem;
  border-radius: 10px;
  border: none;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.bp-btn-buy:hover {
  background: var(--bp-emerald-hover);
  color: #ffffff;
  transform: translateY(-1px);
}

.bp-btn-cart {
  background: var(--bp-ink-900);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.8rem 1.4rem;
  border-radius: 10px;
  border: none;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
}

.bp-btn-cart:hover {
  background: var(--bp-ink-800);
  color: #ffffff;
}

.bp-chapter-box {
  background: #ffffff;
  border: 1px solid var(--bp-surface-200);
  border-radius: var(--bp-radius-md);
  overflow: hidden;
}

.bp-chapter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--bp-surface-100);
  transition: background 0.15s ease;
}

.bp-chapter-row:last-child {
  border-bottom: none;
}

.bp-chapter-row:hover,
.bp-chapter-row.is-playing {
  background-color: var(--bp-accent-soft);
}

.bp-play-trigger {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--bp-surface-300);
  background: #ffffff;
  color: var(--bp-ink-900);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--bp-transition);
}

.bp-play-trigger:hover,
.bp-chapter-row.is-playing .bp-play-trigger {
  background: var(--bp-accent);
  color: #ffffff;
  border-color: var(--bp-accent);
}

/* ==========================================================================
   6. ADMIN SAAS DASHBOARD & COVER STUDIO
   ========================================================================== */
.bp-admin-layout {
  min-height: 100vh;
  display: flex;
  background-color: var(--bp-surface-50);
}

.bp-admin-sidebar {
  width: 260px;
  background-color: var(--bp-ink-950);
  color: #94a3b8;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
}

.bp-admin-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.95rem;
  color: #94a3b8;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
  margin-bottom: 0.25rem;
}

.bp-admin-nav-item:hover,
.bp-admin-nav-item.active {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* Footer Styling */
.bp-footer {
  background-color: var(--bp-ink-950);
  color: #94a3b8;
  padding: 4rem 0 2.5rem 0;
  margin-top: 5rem;
}

.bp-footer h6 {
  color: #ffffff;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.1rem;
}

.bp-footer-link {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.88rem;
  display: inline-block;
  padding: 0.2rem 0;
}

.bp-footer-link:hover {
  color: #ffffff;
}
