/* ═══════════════════════════════════════════════════════════
   booksbypearlb — Final Production CSS
   Mobile-first · Purple & Pink · Literary Premium
   ═══════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  --p900: #080412;
  --p800: #100820;
  --p700: #180C30;
  --p600: #221440;
  --p500: #2D1B55;
  --p400: #3D2570;
  --p300: #5A3A9A;
  --p200: #8A6CC0;
  --p100: #B8A0DC;
  --p050: #E8DFFF;

  --pink:      #E91E8C;
  --pink-h:    #F03DA0;
  --pink-d:    #B5146C;
  --pink-soft: #F8B4DA;

  --gold:   #F0C040;
  --green:  #4CAF50;
  --red:    #E53935;

  --bg:     var(--p900);
  --surf:   var(--p800);
  --card:   var(--p700);
  --border: rgba(90, 58, 154, 0.28);

  --text:   #F2EAE0;
  --text-2: #C0B0D8;
  --text-3: #7A6898;
  --text-4: #4A3868;

  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans:  'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --r1: 6px;
  --r2: 10px;
  --r3: 16px;
  --r4: 24px;

  --sh-sm: 0 2px 8px rgba(0,0,0,0.4);
  --sh-md: 0 8px 28px rgba(0,0,0,0.5);
  --sh-lg: 0 20px 60px rgba(0,0,0,0.6);
  --sh-pink: 0 8px 28px rgba(233,30,140,0.35);

  --nav-h: 62px;
  --trans: 0.2s ease;
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 80% 40% at 50% -5%, rgba(90,58,154,0.18) 0%, transparent 70%),
    radial-gradient(ellipse 50% 30% at 85% 105%, rgba(233,30,140,0.1) 0%, transparent 60%);
  background-attachment: fixed;
}
img { max-width: 100%; display: block; }
a { color: var(--pink-soft); text-decoration: none; transition: color var(--trans); }
a:hover { color: var(--pink); }
button { cursor: pointer; font-family: var(--sans); }
input, textarea, select { font-family: var(--sans); }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--p800); }
::-webkit-scrollbar-thumb { background: var(--p400); border-radius: 3px; }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 3px; }

/* ── TYPOGRAPHY ─────────────────────────────────────────────── */
.serif   { font-family: var(--serif); }
.italic  { font-style: italic; }
h1,h2,h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; }

/* ══════════════════════════════════════════════════════════════
   NAVIGATION
══════════════════════════════════════════════════════════════ */
.site-header {
  position: sticky; top: 0; z-index: 500;
  height: var(--nav-h);
  background: rgba(8, 4, 18, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}

/* Brand */
.site-brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--serif); font-style: italic; font-size: 1.45rem;
  color: var(--text) !important; flex-shrink: 0; text-decoration: none;
}
.brand-icon { color: var(--pink); font-size: 1.1rem; }
.brand-books { color: var(--text); }
.brand-by    { color: var(--p200); font-size: 1.1rem; }
.brand-pearl { color: var(--pink-soft); }

/* Desktop nav links */
.nav-links {
  display: none;
  align-items: center; gap: 4px;
  flex: 1; justify-content: center;
}
.nav-links a {
  padding: 7px 14px; border-radius: var(--r1);
  color: var(--text-2) !important; font-size: 0.9rem; font-weight: 400;
  transition: background var(--trans), color var(--trans);
  white-space: nowrap;
}
.nav-links a:hover { background: rgba(90,58,154,0.2); color: var(--text) !important; }
.nav-author { color: var(--pink-soft) !important; }
.nav-admin  { color: var(--p100) !important; font-size: 0.82rem; }

/* User section */
.nav-user { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.user-pill {
  position: relative;
  display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--p300), var(--pink));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 700; color: white;
  box-shadow: 0 2px 10px rgba(233,30,140,0.4);
  flex-shrink: 0;
}
.user-name-text { font-size: 0.85rem; color: var(--text-2); display: none; }
.dropdown {
  display: none; position: absolute; top: calc(100% + 12px); right: 0;
  background: var(--p600); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 8px; min-width: 170px;
  box-shadow: var(--sh-lg); z-index: 100;
}
.user-pill:hover .dropdown { display: block; }
.dropdown a {
  display: block; padding: 9px 13px; border-radius: var(--r1);
  color: var(--text-2) !important; font-size: 0.85rem;
  transition: background var(--trans);
}
.dropdown a:hover { background: rgba(255,255,255,0.06); color: var(--text) !important; }
.dropdown-sep { border-top: 1px solid var(--border); margin: 6px 0; }
.dropdown-danger { color: var(--pink-soft) !important; }
.btn-nav-cta {
  background: linear-gradient(135deg, var(--pink), var(--pink-d));
  color: white !important; padding: 9px 20px; border-radius: 20px;
  font-size: 0.86rem; font-weight: 500; white-space: nowrap;
  box-shadow: var(--sh-pink); transition: all var(--trans);
  display: none;
}
.btn-nav-cta:hover { box-shadow: 0 10px 28px rgba(233,30,140,0.5); transform: translateY(-1px); }
.nav-signin { color: var(--text-2) !important; font-size: 0.9rem; display: none; }

/* Hamburger */
.hamburger {
  width: 38px; height: 38px; border-radius: var(--r1);
  background: transparent; border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 5px; flex-shrink: 0;
}
.hamburger span {
  display: block; width: 18px; height: 2px;
  background: var(--text-2); border-radius: 2px;
  transition: all var(--trans);
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer */
.mobile-nav {
  display: none; position: fixed;
  top: var(--nav-h); right: 0; bottom: 0;
  width: min(300px, 85vw);
  background: var(--p700); border-left: 1px solid var(--border);
  padding: 24px 20px; z-index: 490;
  flex-direction: column; gap: 6px;
  box-shadow: -10px 0 40px rgba(0,0,0,0.5);
  overflow-y: auto;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  display: block; padding: 13px 16px; border-radius: var(--r1);
  color: var(--text-2) !important; font-size: 1rem;
  border-bottom: 1px solid var(--border);
}
.mobile-nav a:hover { background: rgba(90,58,154,0.2); color: var(--text) !important; }
.mobile-nav .nav-author { color: var(--pink-soft) !important; }
.mobile-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 480;
}
.mobile-overlay.open { display: block; }

/* ── MESSAGES ────────────────────────────────────────────────── */
.messages-wrap { padding: 0 20px; }
.message {
  max-width: 1200px; margin: 12px auto 0;
  padding: 13px 18px; border-radius: var(--r2);
  font-size: 0.88rem; border: 1px solid;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.message--success { background: rgba(76,175,80,0.1);  border-color: rgba(76,175,80,0.35);  color: #81c784; }
.message--error   { background: rgba(233,30,140,0.1); border-color: rgba(233,30,140,0.35); color: var(--pink-soft); }
.message--info    { background: rgba(90,58,154,0.15); border-color: var(--border);          color: var(--p100); }
.message-close { background: none; border: none; color: inherit; opacity: 0.5; font-size: 1rem; padding: 0; flex-shrink: 0; }
.message-close:hover { opacity: 1; }

/* ── MAIN ────────────────────────────────────────────────────── */
.site-main { min-height: calc(100vh - var(--nav-h) - 280px); }

/* ══════════════════════════════════════════════════════════════
   HERO
══════════════════════════════════════════════════════════════ */
.hero {
  padding: 60px 20px 56px;
  text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(233,30,140,0.14) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 20% 110%, rgba(90,58,154,0.18) 0%, transparent 60%);
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--pink-soft);
  background: rgba(233,30,140,0.1); border: 1px solid rgba(233,30,140,0.25);
  padding: 6px 16px; border-radius: 20px; margin-bottom: 24px;
}
.hero h1 {
  font-size: clamp(2.6rem, 8vw, 4.8rem);
  font-style: italic; color: var(--text);
  line-height: 1.06; margin-bottom: 20px;
}
.hero h1 em { color: var(--pink-soft); }
.hero-sub {
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  color: var(--text-2); max-width: 500px;
  margin: 0 auto 36px; line-height: 1.85;
}
.hero-search {
  max-width: 460px; margin: 0 auto; position: relative;
}
.hero-search input {
  width: 100%; padding: 14px 50px 14px 20px;
  background: rgba(24,12,48,0.85);
  border: 1px solid rgba(90,58,154,0.45);
  border-radius: 30px; color: var(--text);
  font-size: 0.95rem; outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.hero-search input:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(233,30,140,0.15); }
.hero-search input::placeholder { color: var(--text-3); }
.hero-search-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--pink); border: none; border-radius: 20px;
  padding: 8px 16px; color: white; font-size: 0.82rem; font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════
   CATALOG / BOOK GRID
══════════════════════════════════════════════════════════════ */
.catalog-wrap { max-width: 1200px; margin: 0 auto; padding: 36px 20px 72px; }
.catalog-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 10px;
}
.catalog-title { font-family: var(--serif); font-style: italic; font-size: 1.3rem; color: var(--text-2); }
.catalog-count { font-size: 0.82rem; color: var(--text-3); }

.book-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.book-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r3); overflow: hidden;
  cursor: pointer; transition: transform var(--trans), border-color var(--trans), box-shadow var(--trans);
  text-decoration: none !important; color: inherit; display: block;
}
.book-card:hover {
  border-color: rgba(233,30,140,0.35);
  transform: translateY(-5px);
  box-shadow: var(--sh-lg), 0 0 0 1px rgba(233,30,140,0.1);
}
.book-card:active { transform: translateY(-2px); }

.book-cover { height: 190px; position: relative; overflow: hidden; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s; }
.book-card:hover .book-cover img { transform: scale(1.05); }
.cover-grad {
  width: 100%; height: 100%;
  background: linear-gradient(145deg, var(--p500), var(--p300), var(--pink));
  position: relative;
}
.cover-overlay {
  position: absolute; bottom: 0; left: 0; right: 0; height: 65%;
  background: linear-gradient(transparent, rgba(8,4,18,0.9));
}
.cover-title-text {
  position: absolute; bottom: 12px; left: 13px; right: 13px;
  font-family: var(--serif); font-style: italic;
  color: rgba(255,255,255,0.95); font-size: 0.9rem;
  line-height: 1.25; text-shadow: 0 1px 8px rgba(0,0,0,0.8);
}
.cover-accent { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--pink), var(--p200)); }
.owned-badge {
  position: absolute; top: 10px; right: 10px;
  background: rgba(233,30,140,0.88); color: white;
  border-radius: var(--r1); padding: 3px 8px;
  font-size: 0.58rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.book-body { padding: 13px 14px 15px; }
.book-author { color: var(--p100); font-size: 0.78rem; font-style: italic; margin-bottom: 10px; }
.book-foot { display: flex; justify-content: space-between; align-items: center; }
.book-price { font-family: var(--serif); font-size: 1.05rem; color: var(--text); }
.book-pages { font-size: 0.7rem; color: var(--text-3); }

/* Empty state */
.empty { text-align: center; padding: 72px 0; }
.empty-icon { font-size: 3.5rem; margin-bottom: 18px; opacity: 0.65; }
.empty h2 { font-family: var(--serif); font-style: italic; font-size: 1.7rem; color: var(--text-2); margin-bottom: 10px; }
.empty p  { color: var(--text-3); font-size: 0.95rem; }

/* ══════════════════════════════════════════════════════════════
   BOOK DETAIL
══════════════════════════════════════════════════════════════ */
.detail-page { max-width: 860px; margin: 0 auto; padding: 32px 20px 72px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-3) !important; font-size: 0.85rem; margin-bottom: 28px;
  padding: 8px 0; border: none; background: none;
  transition: color var(--trans);
}
.back-btn:hover { color: var(--text-2) !important; }
.detail-hero { display: flex; flex-direction: column; gap: 24px; margin-bottom: 36px; }
.detail-cover {
  width: 160px; height: 224px; border-radius: var(--r2); overflow: hidden;
  flex-shrink: 0; align-self: center;
  box-shadow: var(--sh-lg), 0 0 0 1px rgba(233,30,140,0.15);
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-cover-grad {
  width: 100%; height: 100%;
  background: linear-gradient(145deg, var(--p500), var(--p300), var(--pink));
  position: relative;
}
.detail-info { flex: 1; }
.detail-title { font-style: italic; font-size: clamp(1.8rem, 5vw, 2.4rem); color: var(--text); margin-bottom: 10px; }
.detail-author { color: var(--p100); font-style: italic; font-size: 1.05rem; margin-bottom: 8px; }
.detail-meta   { color: var(--text-3); font-size: 0.82rem; margin-bottom: 24px; }
.detail-price  { font-family: var(--serif); font-style: italic; font-size: 2.2rem; color: var(--text); margin-bottom: 16px; }
.detail-actions { display: flex; flex-direction: column; gap: 10px; }
.owned-note { color: #81c784; font-size: 0.88rem; display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.security-note { font-size: 0.74rem; color: var(--text-3); text-align: center; margin-top: 4px; }

.sec-divider { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
.sec-label {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--pink-soft); margin-bottom: 14px;
}
.detail-desc { font-family: var(--serif); font-size: 1.12rem; font-weight: 300; line-height: 1.9; color: var(--text); }

.ch-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid rgba(90,58,154,0.18); font-size: 0.88rem;
}
.ch-num { color: var(--text-3); font-size: 0.72rem; width: 20px; flex-shrink: 0; }
.ch-title { flex: 1; color: var(--text-2); }
.ch-title.unlocked { color: var(--text); }

.preview-wrap { position: relative; }
.preview-text { font-family: var(--serif); font-size: 1.05rem; font-weight: 300; line-height: 1.9; color: var(--text-2); max-height: 200px; overflow: hidden; white-space: pre-line; }
.preview-fade { position: absolute; bottom: 0; left: 0; right: 0; height: 90px; background: linear-gradient(transparent, var(--bg)); }

/* ══════════════════════════════════════════════════════════════
   CHECKOUT / PAYMENT
══════════════════════════════════════════════════════════════ */
.checkout-page { max-width: 680px; margin: 0 auto; padding: 36px 20px 80px; }
.checkout-book-card {
  display: flex; gap: 16px; align-items: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 16px; margin-bottom: 28px;
}
.checkout-cover { width: 56px; height: 80px; border-radius: var(--r1); overflow: hidden; flex-shrink: 0; }
.checkout-cover img { width: 100%; height: 100%; object-fit: cover; }
.checkout-cover-grad { width: 100%; height: 100%; background: linear-gradient(145deg, var(--p400), var(--pink)); }
.checkout-book-title { font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--text); margin-bottom: 4px; }
.checkout-book-price { font-family: var(--serif); font-style: italic; font-size: 1.6rem; color: var(--pink-soft); }

.payment-detect-wrap { position: relative; min-height: 200px; }
.payment-detecting {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 40px; color: var(--text-3); font-size: 0.9rem;
}
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid rgba(233,30,140,0.2); border-top-color: var(--pink);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.payment-section { display: none; }
.payment-section.active { display: block; }

.payment-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r3); padding: 24px; margin-bottom: 16px;
}
.payment-box-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.85rem; font-weight: 600; color: var(--text-2);
  margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.payment-flag { font-size: 1.3rem; }

.bank-detail-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(90,58,154,0.15); font-size: 0.9rem; }
.bank-detail-label { color: var(--text-3); font-size: 0.82rem; }
.bank-detail-value { color: var(--text); font-weight: 500; }
.bank-acct { font-size: 1.3rem; font-family: var(--serif); color: var(--pink-soft); letter-spacing: 0.05em; }

.paypal-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.paypal-qr { width: 180px; height: 180px; border-radius: var(--r2); background: white; padding: 8px; }
.paypal-qr img { width: 100%; height: 100%; object-fit: contain; }
.paypal-link { color: var(--pink-soft) !important; font-size: 0.9rem; text-decoration: underline !important; }

.switch-payment { font-size: 0.8rem; color: var(--text-3); text-align: center; margin-top: 8px; }
.switch-payment a { color: var(--pink-soft) !important; }

.payment-steps { background: rgba(90,58,154,0.1); border-radius: var(--r2); padding: 18px; margin: 20px 0; }
.payment-step { display: flex; gap: 12px; margin-bottom: 14px; font-size: 0.88rem; color: var(--text-2); }
.payment-step:last-child { margin-bottom: 0; }
.step-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--pink); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; flex-shrink: 0;
}

.wa-btn-ng, .wa-btn-intl {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 15px; border-radius: var(--r2); border: none;
  font-size: 1rem; font-weight: 600; text-decoration: none !important;
  transition: all var(--trans);
}
.wa-btn-ng {
  background: #25D366; color: white;
  box-shadow: 0 6px 20px rgba(37,211,102,0.35);
}
.wa-btn-ng:hover { background: #1fa854; box-shadow: 0 10px 28px rgba(37,211,102,0.5); transform: translateY(-2px); color: white !important; }
.wa-btn-intl {
  background: #25D366; color: white;
  box-shadow: 0 6px 20px rgba(37,211,102,0.35);
}
.wa-btn-intl:hover { background: #1fa854; color: white !important; }
.wa-icon { font-size: 1.3rem; }

/* ══════════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 26px; border-radius: var(--r2);
  font-family: var(--sans); font-size: 0.9rem; font-weight: 500;
  border: none; transition: all var(--trans); text-align: center; line-height: 1;
  cursor: pointer; text-decoration: none !important;
}
.btn-primary {
  background: linear-gradient(135deg, var(--pink), var(--pink-d));
  color: white !important; box-shadow: var(--sh-pink);
}
.btn-primary:hover { box-shadow: 0 12px 32px rgba(233,30,140,0.5); transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: transparent; border: 1px solid rgba(90,58,154,0.5); color: var(--p100) !important; }
.btn-secondary:hover { border-color: var(--pink-soft); color: var(--pink-soft) !important; }
.btn-danger { background: transparent; border: 1px solid rgba(229,57,53,0.5); color: #ef9a9a !important; }
.btn-danger:hover { background: rgba(229,57,53,0.1); }
.btn-full { width: 100%; }
.btn-sm { padding: 9px 18px; font-size: 0.82rem; }
.btn-lg { padding: 16px 32px; font-size: 1rem; }

/* ══════════════════════════════════════════════════════════════
   READER
══════════════════════════════════════════════════════════════ */
body.reader-body { background: #F8F4FF; color: #160A2E; }
body.reader-body .site-header,
body.reader-body .site-footer { display: none; }

.reader-wrap { display: flex; flex-direction: column; height: 100vh; overflow: hidden; background: #F8F4FF; }
.reader-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: #1A0A30; border-bottom: 1px solid rgba(90,58,154,0.3);
  flex-shrink: 0; gap: 12px;
}
.reader-topbar-left, .reader-topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.reader-topbar-center { flex: 1; text-align: center; overflow: hidden; }
.reader-book-name { font-family: var(--serif); font-style: italic; color: var(--text); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-page-info { color: var(--p100); font-size: 0.68rem; }
.reader-btn {
  background: transparent; border: 1px solid rgba(90,58,154,0.35);
  color: var(--p100); padding: 7px 13px; border-radius: var(--r1);
  font-size: 0.8rem; font-family: var(--sans); white-space: nowrap;
  transition: all var(--trans);
}
.reader-btn:hover { border-color: var(--pink-soft); color: var(--pink-soft); }

.reader-progress-bar { height: 3px; background: rgba(90,58,154,0.25); flex-shrink: 0; }
.reader-progress-fill { height: 100%; background: linear-gradient(90deg, var(--pink), var(--pink-soft)); transition: width 0.5s; }

.reader-body-wrap { display: flex; flex: 1; overflow: hidden; }

/* Reader sidebar — hidden on mobile */
.reader-sidebar {
  display: none; width: 250px; flex-shrink: 0;
  background: #120828; border-right: 1px solid rgba(90,58,154,0.25);
  flex-direction: column; overflow: hidden;
}
.reader-sidebar-head { padding: 16px 16px 12px; border-bottom: 1px solid rgba(90,58,154,0.2); }
.sidebar-book-title  { font-family: var(--serif); font-style: italic; color: var(--text); font-size: 0.92rem; line-height: 1.3; }
.sidebar-book-author { color: var(--p100); font-size: 0.72rem; margin-top: 3px; }
.sidebar-progress    { padding: 10px 16px; border-bottom: 1px solid rgba(90,58,154,0.15); }
.sidebar-prog-bar    { height: 4px; background: rgba(90,58,154,0.3); border-radius: 2px; overflow: hidden; }
.sidebar-prog-fill   { height: 100%; background: linear-gradient(90deg, var(--pink), var(--pink-soft)); border-radius: 2px; transition: width 0.5s; }
.sidebar-prog-label  { color: var(--p100); font-size: 0.68rem; margin-top: 5px; }

/* Reader content */
.reader-content-area {
  flex: 1; overflow-y: auto; position: relative;
  -webkit-overflow-scrolling: touch;
}
.reader-watermark {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-38deg);
  pointer-events: none; z-index: 3;
  font-family: var(--serif); font-size: clamp(1.5rem, 4vw, 2.8rem);
  font-weight: 700; color: rgba(90,58,154,0.05);
  white-space: nowrap; user-select: none;
}
.reader-protect-overlay {
  position: absolute; inset: 0; z-index: 6; user-select: none;
  -webkit-user-select: none; cursor: default;
}
.reader-canvas-wrap { display: flex; justify-content: center; padding: 20px 16px 80px; position: relative; z-index: 1; }
#pdf-canvas { display: block; max-width: 100%; border-radius: var(--r1); box-shadow: 0 4px 24px rgba(0,0,0,0.15); }

/* Reader bottom nav */
.reader-bottom-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: #1A0A30; border-top: 1px solid rgba(90,58,154,0.3);
  flex-shrink: 0; gap: 10px;
}
.reader-dots { display: flex; gap: 7px; justify-content: center; }
.reader-dot { height: 6px; border-radius: 3px; cursor: pointer; background: rgba(90,58,154,0.4); transition: all 0.25s; }
.reader-dot.active { background: var(--pink); }
.reader-page-jump { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--p100); }
.reader-page-input {
  width: 50px; padding: 5px 8px; background: rgba(90,58,154,0.2);
  border: 1px solid rgba(90,58,154,0.4); border-radius: var(--r1);
  color: var(--text); font-size: 0.82rem; text-align: center;
}

/* Blur overlay */
.blur-overlay {
  position: fixed; inset: 0; z-index: 900;
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  background: rgba(8,4,18,0.92);
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.blur-overlay.show { display: flex; }
.blur-title { font-family: var(--serif); font-style: italic; font-size: 2rem; color: var(--text); }
.blur-sub   { color: var(--p100); font-size: 0.95rem; }

/* ══════════════════════════════════════════════════════════════
   AUTH PAGES
══════════════════════════════════════════════════════════════ */
.auth-page { max-width: 460px; margin: 48px auto; padding: 0 20px; }
.auth-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r3); padding: 36px 32px;
  box-shadow: var(--sh-lg);
}
.auth-icon  { font-size: 2rem; margin-bottom: 14px; }
.auth-title { font-style: italic; font-size: 1.9rem; color: var(--text); margin-bottom: 8px; }
.auth-sub   { color: var(--text-2); font-size: 0.9rem; margin-bottom: 26px; line-height: 1.75; }
.auth-foot  { margin-top: 20px; text-align: center; font-size: 0.85rem; color: var(--text-2); }
.auth-foot a { color: var(--pink-soft) !important; }
.forgot-link { float: right; font-size: 0.8rem; color: var(--pink-soft) !important; margin-top: -20px; margin-bottom: 10px; display: block; }

/* Form fields */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.78rem; font-weight: 500; color: var(--p100); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 12px 15px;
  background: rgba(8,4,18,0.7); border: 1px solid rgba(90,58,154,0.4);
  border-radius: var(--r1); color: var(--text);
  font-size: 0.95rem; outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.form-input:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(233,30,140,0.12); }
.form-input::placeholder { color: var(--text-4); }
.form-hint { font-size: 0.76rem; color: var(--text-3); margin-top: 4px; display: block; }
.form-error { font-size: 0.76rem; color: var(--pink-soft); margin-top: 4px; }

/* Crispy form overrides */
label { color: var(--p100) !important; font-size: 0.78rem !important; font-weight: 500 !important; margin-bottom: 6px !important; display: block !important; }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100% !important; padding: 12px 15px !important;
  background: rgba(8,4,18,0.7) !important; border: 1px solid rgba(90,58,154,0.4) !important;
  border-radius: var(--r1) !important; color: var(--text) !important;
  font-size: 0.95rem !important; outline: none !important;
  transition: border-color var(--trans), box-shadow var(--trans) !important;
  font-family: var(--sans) !important;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--pink) !important;
  box-shadow: 0 0 0 3px rgba(233,30,140,0.12) !important;
}
input::placeholder, textarea::placeholder { color: var(--text-4) !important; }
.mb-3 { margin-bottom: 16px !important; }
.form-text, .helptext { color: var(--text-3) !important; font-size: 0.76rem !important; margin-top: 4px !important; display: block !important; }
.invalid-feedback, .errorlist { color: var(--pink-soft) !important; font-size: 0.76rem !important; list-style: none !important; margin-top: 4px !important; }
input[type=checkbox] { width: auto !important; accent-color: var(--pink); margin-right: 8px; }
input[type=file] { background: rgba(90,58,154,0.1) !important; border: 2px dashed rgba(90,58,154,0.4) !important; padding: 16px !important; border-radius: var(--r2) !important; cursor: pointer !important; color: var(--p100) !important; }
input[type=file]:hover { border-color: var(--pink) !important; }

/* ══════════════════════════════════════════════════════════════
   DASHBOARD
══════════════════════════════════════════════════════════════ */
.page        { max-width: 1200px; margin: 0 auto; padding: 36px 20px 72px; }
.page-narrow { max-width: 760px;  margin: 0 auto; padding: 36px 20px 72px; }
.page-title  { font-style: italic; font-size: clamp(1.9rem, 5vw, 2.5rem); color: var(--text); margin-bottom: 8px; }
.page-sub    { color: var(--text-2); margin-bottom: 32px; font-size: 0.95rem; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 32px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r2); padding: 20px; }
.stat-val   { font-family: var(--serif); font-style: italic; font-size: 2.4rem; color: var(--pink-soft); }
.stat-lbl   { color: var(--text-2); font-size: 0.78rem; margin-top: 4px; }

.book-list-item { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid rgba(90,58,154,0.18); align-items: center; }
.book-list-thumb { width: 50px; height: 70px; border-radius: var(--r1); flex-shrink: 0; overflow: hidden; background: linear-gradient(145deg, var(--p400), var(--pink)); }
.book-list-thumb img { width: 100%; height: 100%; object-fit: cover; }
.book-list-title { font-family: var(--serif); font-style: italic; color: var(--text); font-size: 0.98rem; margin-bottom: 4px; }
.book-list-meta  { font-size: 0.76rem; color: var(--text-3); }
.book-list-price { font-family: var(--serif); font-style: italic; color: var(--pink-soft); font-size: 1rem; }
.book-list-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.live-badge  { color: #81c784; font-size: 0.72rem; }
.draft-badge { color: var(--text-3); font-size: 0.72rem; }

.upload-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r3); padding: 32px 28px; }
.grant-box   { background: rgba(233,30,140,0.06); border: 1px solid rgba(233,30,140,0.2); border-radius: var(--r2); padding: 20px; margin-bottom: 24px; }
.grant-title { font-size: 0.85rem; font-weight: 600; color: var(--pink-soft); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

/* ══════════════════════════════════════════════════════════════
   LIBRARY
══════════════════════════════════════════════════════════════ */
.library-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

/* ══════════════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════════════ */
.site-footer { border-top: 1px solid var(--border); margin-top: 60px; }
.footer-main { max-width: 1200px; margin: 0 auto; padding: 48px 20px 36px; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 36px; }
.footer-logo { font-family: var(--serif); font-style: italic; font-size: 1.5rem; margin-bottom: 12px; }
.footer-about { color: var(--text-3); font-size: 0.88rem; line-height: 1.85; margin-bottom: 16px; }
.footer-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(90,58,154,0.12); border: 1px solid var(--border);
  border-radius: var(--r1); padding: 6px 12px;
  font-size: 0.73rem; color: var(--p100);
}
.footer-col-title { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.24em; text-transform: uppercase; color: var(--pink-soft); margin-bottom: 14px; }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links a { color: var(--text-3) !important; font-size: 0.88rem; transition: color var(--trans); }
.footer-links a:hover { color: var(--p100) !important; }
.footer-info-item { color: var(--text-3); font-size: 0.86rem; }
.footer-bottom { border-top: 1px solid var(--border); padding: 18px 20px; }
.footer-bottom-inner { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; font-size: 0.76rem; color: var(--text-3); }
.footer-quote { font-family: var(--serif); font-style: italic; color: var(--p200); }

/* Contact support */
.support-bar {
  background: rgba(90,58,154,0.1); border-top: 1px solid var(--border);
  padding: 14px 20px; text-align: center;
}
.support-inner { max-width: 1200px; margin: 0 auto; font-size: 0.82rem; color: var(--text-3); display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.support-link { color: var(--pink-soft) !important; display: inline-flex; align-items: center; gap: 5px; }

/* ══════════════════════════════════════════════════════════════
   PASSWORD RESET PAGES
══════════════════════════════════════════════════════════════ */
.reset-page { max-width: 460px; margin: 60px auto; padding: 0 20px; text-align: center; }
.reset-icon  { font-size: 3rem; margin-bottom: 20px; }
.reset-title { font-style: italic; font-size: 2rem; color: var(--text); margin-bottom: 12px; }
.reset-sub   { color: var(--text-2); font-size: 1rem; line-height: 1.8; margin-bottom: 28px; }

/* ══════════════════════════════════════════════════════════════
   MEDIA QUERIES — TABLET & DESKTOP
══════════════════════════════════════════════════════════════ */
@media (min-width: 600px) {
  .book-grid    { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .library-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-hero  { flex-direction: row; }
  .detail-cover { width: 200px; height: 280px; align-self: flex-start; }
  .footer-grid  { grid-template-columns: 1fr 1fr; }
  .user-name-text { display: block; }
  .btn-nav-cta  { display: inline-flex; }
  .nav-signin   { display: block; }
}

@media (min-width: 900px) {
  .hamburger    { display: none; }
  .nav-links    { display: flex; }
  .book-grid    { grid-template-columns: repeat(3, 1fr); gap: 24px; }
  .library-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid  { grid-template-columns: 2fr 1fr 1fr; }
  .reader-sidebar { display: flex; }
  .reader-topbar { padding: 12px 24px; }
  .reader-topbar .reader-btn-prev-top, .reader-topbar .reader-btn-next-top { display: inline-flex; }
  .nav-inner { padding: 0 28px; }
  .catalog-wrap, .hero, .detail-page, .checkout-page, .page, .page-narrow { padding-left: 28px; padding-right: 28px; }
  .messages-wrap { padding: 0 28px; }
  .footer-main  { padding: 56px 28px 40px; }
  .footer-bottom { padding: 20px 28px; }
  .footer-bottom-inner { flex-direction: row; justify-content: space-between; text-align: left; }
  .support-inner { justify-content: flex-start; }
}

@media (min-width: 1200px) {
  .book-grid    { grid-template-columns: repeat(4, 1fr); }
  .library-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── PRINT PROTECTION ───────────────────────────────────────── */
@media print {
  #bpb-reader, .reader-wrap { display: none !important; }
  body::after { content: "Printing is disabled on booksbypearlb.com."; display: block; padding: 4rem; font-size: 1.5rem; text-align: center; }
}

/* ── ANIMATIONS ─────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn 0.4s ease; }

/* ── UTILITIES ──────────────────────────────────────────────── */
.text-center  { text-align: center; }
.text-pink    { color: var(--pink-soft); }
.text-muted   { color: var(--text-3); }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.mt-4 { margin-top: 28px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 20px; }
.mb-4 { margin-bottom: 28px; }
.gap-2 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
