:root{
  --bg:#0b1020;
  --glass:rgba(255,255,255,.06);
  --glass2:rgba(0,0,0,.45);
  --border:rgba(255,255,255,.14);
  --muted:rgba(255,255,255,.72);
  --gold:#d4b46a;
  --gold2:#f2e3b8;

  --serif:'Cormorant Garamond', serif;
  --sans:'Manrope', system-ui;

  --ease:cubic-bezier(.22,1,.36,1);
}

*{box-sizing:border-box;margin:0;padding:0}
body{
  font-family:var(--sans);
  background:var(--bg);
  color:#fff;
  overflow:hidden;
}

a{color:inherit;text-decoration:none}

/* ===== HEADER ===== */
.pdf-header{
  height:64px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:0 14px;
  background:var(--glass2);
  backdrop-filter:blur(12px);
  border-bottom:1px solid rgba(255,255,255,.08);
}

.back-btn{
  font-weight:900;
  opacity:.95;
}

.header-center{
  flex:1;
  text-align:center;
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
}
#catTitle{
  font-family:var(--serif);
  font-weight:700;
  letter-spacing:.8px;
  font-size:20px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.header-sub{
  font-size:12px;
  color:var(--muted);
  font-weight:700;
  letter-spacing:.3px;
}

.header-actions{
  display:flex;
  align-items:center;
  gap:8px;
}

.icon-btn{
  width:40px;
  height:40px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
  color:#fff;
  cursor:pointer;
  font-weight:900;
  transition:.25s var(--ease);
}
.icon-btn:hover{transform:translateY(-1px);background:rgba(255,255,255,.09)}

.menu-toggle{display:none}

/* ===== BOOK WRAPPER ===== */
.book-wrapper{
  display:flex;
  justify-content:center;
  align-items:center;
  height:calc(100vh - 64px - 76px);
  perspective:2000px;
  padding:10px 0;
}

.book{
  position:relative;
  width:92vw;
  max-width:860px;
  height:100%;
}

/* ===== PAGE ===== */
.page{
  position:absolute;
  inset:0;
  background:#fff;
  border-radius:12px;
  box-shadow:0 30px 90px rgba(0,0,0,.45);
  transform-origin:left center;
  transition:transform .85s var(--ease);
  backface-visibility:hidden;
  overflow:hidden;
}

.page canvas{
  width:100%;
  height:100%;
  display:block;
}

.page.flipped{ transform:rotateY(-180deg); z-index:1; }

/* watermark */
.watermark{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:46px;
  font-weight:900;
  color:rgba(0,0,0,.08);
  transform:rotate(-25deg);
  pointer-events:none;
  text-align:center;
  white-space:pre-line;
}

/* page number overlay */
.page-num{
  position:absolute;
  right:12px;
  bottom:12px;
  z-index:3;
  padding:8px 12px;
  border-radius:999px;
  background:rgba(0,0,0,.35);
  backdrop-filter:blur(10px);
  border:1px solid rgba(255,255,255,.18);
  color:#fff;
  font-weight:900;
  font-size:12px;
  letter-spacing:.4px;
}

/* ===== CONTROLS ===== */
.pdf-controls-wrapper{
  position:relative;
  z-index:20;
}

.pdf-controls{
  height:76px;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:18px;
  background:var(--glass2);
  backdrop-filter:blur(10px);
  border-top:1px solid rgba(255,255,255,.08);
}

.pdf-controls button{
  padding:10px 16px;
  border-radius:999px;
  border:none;
  font-weight:900;
  cursor:pointer;
}
.pdf-controls span{
  font-weight:900;
  letter-spacing:.4px;
}

/* ===== WHATSAPP ===== */
.wa-float{
  position:fixed;
  right:18px;
  bottom:88px;
  padding:12px 16px;
  border-radius:999px;
  background:linear-gradient(135deg,#25D366,#1fb756);
  color:#081015;
  font-weight:900;
  box-shadow:0 20px 70px rgba(0,0,0,.4);
  z-index:40;
}

/* ===== LOADER ===== */
.pdf-loader{
  position:fixed;
  inset:0;
  z-index:999;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(212,180,106,.18), transparent 55%),
    radial-gradient(900px 500px at 80% 10%, rgba(30,42,90,.35), transparent 60%),
    var(--bg);
  display:flex;
  align-items:center;
  justify-content:center;
}

.loader-box{
  width:min(380px, 92vw);
  text-align:center;
  padding:28px 26px 30px;
  border-radius:24px;
  background:var(--glass);
  backdrop-filter:blur(14px);
  border:1px solid rgba(255,255,255,.14);
  box-shadow:0 30px 120px rgba(0,0,0,.6);
}

.loader-title{
  font-family:var(--serif);
  font-size:28px;
  font-weight:700;
  letter-spacing:1px;
  color:#fff;
}

.loader-sub{
  margin-top:6px;
  font-size:14px;
  color:rgba(255,255,255,.75);
  font-weight:700;
}

/* progress bar */
.progress-wrap{
  margin-top:20px;
  width:100%;
  height:10px;
  border-radius:999px;
  background:rgba(255,255,255,.12);
  overflow:hidden;
}

.progress-bar{
  height:100%;
  width:0%;
  border-radius:999px;
  background:linear-gradient(90deg, var(--gold), var(--gold2), var(--gold));
  box-shadow:0 0 18px rgba(212,180,106,.55);
  transition:width .25s ease;
}

/* shimmer sweep */
.shimmer-sweep{
  position:relative;
}
.shimmer-sweep::after{
  content:"";
  position:absolute;
  top:-12px;
  left:-40%;
  width:40%;
  height:34px;
  background:linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  transform:skewX(-18deg);
  animation:sweep 1.2s linear infinite;
}
@keyframes sweep{
  from{left:-40%}
  to{left:110%}
}

.progress-text{
  margin-top:12px;
  font-weight:900;
  font-size:14px;
  letter-spacing:.6px;
  color:#fff;
}

.pdf-loader.hide{
  opacity:0;
  pointer-events:none;
  transition:opacity .6s ease;
}

/* ===== THUMB STRIP (DESKTOP) ===== */
.thumb-strip{
  position:fixed;
  top:64px;              /* below header */
  bottom:76px;           /* above controls */
  left:0;

  width:110px;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:10px 8px;

  overflow-y:auto;
  overflow-x:hidden;

  background:var(--glass2);
  backdrop-filter:blur(10px);
  border-right:1px solid rgba(255,255,255,.12);

  z-index:25;
}


.thumb{
  width:100%;
  height:auto;
  border-radius:10px;
  cursor:pointer;
  opacity:.6;
  border:2px solid transparent;
  transition:.25s ease;
}

.thumb:hover{
  opacity:.9;
  transform:scale(1.02);
}

.thumb.active{
  opacity:1;
  border-color:var(--gold);
}

.thumb.active{
  opacity:1;
  border-color:var(--gold);
}

/* ===== DRAWER (MOBILE) ===== */
.drawer{
  position:fixed;
  top:0;
  right:-100%;
  width:78%;
  max-width:340px;
  height:100vh;
  background:#0b1020;
  z-index:80;
  box-shadow:-20px 0 80px rgba(0,0,0,.6);
  transition:right .4s var(--ease);
  display:flex;
  flex-direction:column;
  border-left:1px solid rgba(255,255,255,.10);
}
.drawer.open{ right:0; }

.drawer-head{
  height:60px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 14px;
  background:rgba(0,0,0,.28);
  border-bottom:1px solid rgba(255,255,255,.10);
}
.drawer-title{
  font-weight:900;
  letter-spacing:.6px;
}
.drawer-tabs{
  display:flex;
  gap:10px;
  padding:10px 12px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.tab-btn{
  flex:1;
  padding:10px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
  color:#fff;
  font-weight:900;
  cursor:pointer;
}
.tab-btn.active{
  border-color:transparent;
  background:linear-gradient(135deg, rgba(212,180,106,.35), rgba(212,180,106,.16));
}

.drawer-body{
  flex:1;
  overflow:auto;
  padding:12px;
}

.tab-panel{display:none}
.tab-panel.active{display:block}

.drawer-grid{
  display:grid;
  grid-template-columns:repeat(2, 1fr);
  gap:12px;
}

.drawer-grid canvas{
  width:100%;
  border-radius:10px;
  border:2px solid transparent;
  opacity:.85;
  cursor:pointer;
}
.drawer-grid canvas.active{
  border-color:var(--gold);
  opacity:1;
}

.drawer-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.list-item{
  padding:12px 12px;
  border-radius:16px;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
  cursor:pointer;
  transition:.2s var(--ease);
}
.list-item:hover{transform:translateY(-1px);background:rgba(255,255,255,.08)}

.list-item .top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.list-item .title{
  font-weight:900;
}
.list-item .meta{
  font-size:12px;
  color:var(--muted);
  font-weight:700;
  margin-top:6px;
  line-height:1.45;
}

.search-box{
  display:flex;
  gap:10px;
  margin-bottom:12px;
}
.search-box input{
  flex:1;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
  color:#fff;
  outline:none;
  font-weight:700;
}
.search-box button{
  padding:12px 14px;
  border-radius:14px;
  border:none;
  background:linear-gradient(135deg, rgba(212,180,106,.95), rgba(242,227,184,.95));
  font-weight:900;
  cursor:pointer;
}
.search-hint{
  font-size:12px;
  color:var(--muted);
  font-weight:700;
  margin-bottom:10px;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px){
  .menu-toggle{display:inline-grid; place-items:center;}
  .thumb-strip{display:none !important;}

  /* sticky controls for mobile */
  .pdf-controls-wrapper{
    position:fixed;
    left:0;
    right:0;
    bottom:0;
    padding-bottom:env(safe-area-inset-bottom);
    z-index:30;
  }
  .pdf-controls{
    height:64px;
    gap:14px;
  }
  .pdf-controls button{
    flex:1;
    max-width:120px;
    padding:10px 0;
    font-size:15px;
  }
  .pdf-controls span{
    min-width:76px;
    text-align:center;
    font-size:14px;
  }

  .wa-float{
    bottom:84px; /* above controls */
    right:14px;
    padding:10px 14px;
    font-size:14px;
  }

  .book-wrapper{
    height:calc(100vh - 64px - 64px);
  }
}
