/* ===== GAHAR Smart Digital Library — 3D Cover Art, AR/EN Split & Natural Page Flip ===== */
:root {
  --lib-bg: #040914;
  --lib-panel: rgba(11, 22, 40, 0.84);
  --lib-panel-solid: #0b1628;
  --lib-border: rgba(56, 189, 248, 0.22);
  --lib-teal: #006174;
  --lib-cyan: #38bdf8;
  --lib-gold: #fdb81e;
  --lib-emerald: #10b981;
  --lib-text: #f1f5f9;
  --lib-muted: #94a3b8;
}

* { box-sizing: border-box; }

html, body, #root {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--lib-bg);
  color: var(--lib-text);
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  overflow-x: hidden;
}

.glib-shell {
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 55% at 50% 0%, rgba(0, 97, 116, 0.28), transparent 65%),
    radial-gradient(ellipse 60% 45% at 50% 100%, color-mix(in srgb, var(--glow, #fdb81e) 18%, transparent), transparent 70%),
    #040914;
  transition: background 0.5s ease;
}

.glib-stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1px 1px at 18px 28px, rgba(255,255,255,0.45), transparent),
    radial-gradient(1px 1px at 95px 140px, rgba(56,189,248,0.4), transparent),
    radial-gradient(1.5px 1.5px at 165px 65px, rgba(253,184,30,0.45), transparent),
    radial-gradient(1px 1px at 60px 210px, rgba(255,255,255,0.35), transparent);
  background-size: 240px 240px;
  opacity: 0.65;
}

/* ===== Executive Top Bar ===== */
.glib-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px;
  background: rgba(6, 15, 29, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(253, 184, 30, 0.22);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.glib-brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.glib-back-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 99px;
  background: rgba(0, 97, 116, 0.28);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.glib-back-pill:hover {
  background: var(--lib-teal);
  color: #ffffff;
  border-color: var(--lib-gold);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 97, 116, 0.5);
}

.glib-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  padding: 2px;
  box-shadow: 0 0 12px rgba(253, 184, 30, 0.35);
}

.glib-brand-text h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.25;
}

.glib-brand-text span {
  display: block;
  font-size: 11.5px;
  color: var(--lib-gold);
  font-weight: 600;
}

.glib-controls-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
}

.glib-search-box {
  position: relative;
  min-width: 210px;
  max-width: 300px;
  flex: 1;
}

.glib-search-box input {
  width: 100%;
  padding: 8px 36px 8px 30px;
  border-radius: 99px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.glib-search-box input:focus {
  border-color: var(--lib-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

.glib-search-box .glib-search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--lib-muted);
  pointer-events: none;
  display: flex;
}

.glib-search-clear {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--lib-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 5px;
}

.glib-view-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(253, 184, 30, 0.3);
  gap: 3px;
}

.glib-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--lib-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 13px;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.glib-view-btn.active {
  background: linear-gradient(135deg, #006174, #0284c7);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.45);
}

/* ===== Language Segment Bar (Arabic vs English Separation) ===== */
.glib-lang-bar {
  position: relative;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px 4px;
}

.glib-lang-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  border-radius: 99px;
  background: rgba(10, 22, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.glib-lang-btn {
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 99px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s ease;
}

.glib-lang-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.glib-lang-btn.active-all {
  background: linear-gradient(135deg, #006174, #0284c7);
  color: #ffffff;
  box-shadow: 0 2px 12px rgba(2, 132, 199, 0.4);
}

.glib-lang-btn.active-ar {
  background: linear-gradient(135deg, #047857, #10b981);
  color: #ffffff;
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.35);
}

.glib-lang-btn.active-en {
  background: linear-gradient(135deg, #b45309, #f59e0b);
  color: #0b1020;
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.35);
}

/* ===== Category Filter Chips ===== */
.glib-filters-bar {
  position: relative;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 20px 6px;
}

.glib-chip {
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  padding: 5px 12px;
  border-radius: 99px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.glib-chip:hover {
  border-color: var(--lib-cyan);
  color: #ffffff;
}

.glib-chip.active {
  background: rgba(253, 184, 30, 0.16);
  border-color: var(--lib-gold);
  color: var(--lib-gold);
  box-shadow: 0 0 12px rgba(253, 184, 30, 0.18);
}

/* ===== 3D Stage & Real Page-1 Cover Art ===== */
.glib-stage-container {
  position: relative;
  z-index: 5;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 24px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  gap: 18px;
}

.glib-hero-split {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(310px, 1fr) minmax(320px, 1.15fr);
  gap: 26px;
  align-items: center;
  margin-top: 4px;
}

.glib-book-showcase {
  position: relative;
  min-height: 330px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border-radius: 24px;
  background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--glow, #fdb81e) 22%, rgba(15, 23, 42, 0.65)), rgba(6, 15, 29, 0.6));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 24px 60px rgba(0, 0, 0, 0.5);
}

.glib-3d-book {
  --bw: 204px;
  --bh: 288px;
  position: relative;
  width: calc(var(--bw) * 2);
  height: var(--bh);
  perspective: 1800px;
  transform: translateX(calc(var(--bw) * -0.5));
  transition: transform 0.85s cubic-bezier(0.25, 0.85, 0.25, 1);
}

.glib-3d-book.is-ltr-book {
  transform: translateX(calc(var(--bw) * 0.5));
}

.glib-3d-book.is-open,
.glib-3d-book.is-ltr-book.is-open {
  transform: translateX(0);
}

.glib-3d-inner-page {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--bw);
  height: var(--bh);
  padding: 20px 16px;
  border-radius: 6px 0 0 6px;
  background: linear-gradient(270deg, rgba(0,0,0,0.16), transparent 14%), #f8f1e0;
  color: #1e293b;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 8px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.65), 0 0 70px color-mix(in srgb, var(--glow, #fdb81e) 35%, transparent);
}

.glib-3d-book.is-ltr-book .glib-3d-inner-page {
  left: auto;
  right: 0;
  border-radius: 0 6px 6px 0;
  background: linear-gradient(90deg, rgba(0,0,0,0.16), transparent 14%), #f8f1e0;
}

.glib-3d-inner-page small {
  font-size: 11px;
  font-weight: 800;
  color: var(--c2, #006174);
  letter-spacing: 1px;
}

.glib-3d-inner-page h4 {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: #0f172a;
}

.glib-3d-inner-page hr {
  width: 44px;
  border: none;
  border-top: 2px solid var(--c2, #006174);
  margin: 2px auto;
}

.glib-3d-cover {
  all: unset;
  cursor: pointer;
  position: absolute;
  left: 0;
  top: 0;
  width: var(--bw);
  height: var(--bh);
  transform-style: preserve-3d;
  transform-origin: right center;
  transition: transform 0.9s cubic-bezier(0.25, 0.85, 0.25, 1);
}

.glib-3d-book.is-ltr-book .glib-3d-cover {
  left: auto;
  right: 0;
  transform-origin: left center;
}

.glib-3d-book.is-open .glib-3d-cover {
  transform: rotateY(180deg);
}

.glib-3d-book.is-ltr-book.is-open .glib-3d-cover {
  transform: rotateY(-180deg);
}

.glib-3d-front,
.glib-3d-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  overflow: hidden;
}

/* Real PDF Page 1 Front Cover Styling */
.glib-3d-front {
  border-radius: 4px 12px 12px 4px;
  background: #ffffff;
  box-shadow: 0 28px 65px rgba(0,0,0,0.75), 0 0 65px color-mix(in srgb, var(--glow, #fdb81e) 42%, transparent);
}

.glib-3d-book.is-ltr-book .glib-3d-front {
  border-radius: 12px 4px 4px 12px;
}

.glib-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

/* Spine crease & glossy sheen over real cover */
.glib-3d-front::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.28) 0 4%, rgba(255,255,255,0.25) 4% 6%, transparent 9%),
    linear-gradient(135deg, rgba(255,255,255,0.14) 0%, transparent 45%);
}

.glib-3d-book.is-ltr-book .glib-3d-front::after {
  background:
    linear-gradient(270deg, rgba(0,0,0,0.28) 0 4%, rgba(255,255,255,0.25) 4% 6%, transparent 9%),
    linear-gradient(225deg, rgba(255,255,255,0.14) 0%, transparent 45%);
}

.glib-cover-lang-tag {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 2;
  padding: 2px 9px;
  border-radius: 99px;
  background: rgba(4, 9, 20, 0.82);
  border: 1px solid rgba(253, 184, 30, 0.55);
  color: #fdb81e;
  font-size: 10px;
  font-weight: 800;
}

.glib-3d-back {
  transform: rotateY(180deg);
  border-radius: 0 6px 6px 0;
  background: linear-gradient(160deg, var(--c2), #091324);
  justify-content: center;
  gap: 10px;
  padding: 20px 16px;
  color: #f8fafc;
}

.glib-3d-book.is-ltr-book .glib-3d-back {
  transform: rotateY(-180deg);
  border-radius: 6px 0 0 6px;
}

.glib-3d-back small { color: var(--c1); font-weight: 700; }
.glib-3d-back b { font-size: 13px; line-height: 1.6; }
.glib-3d-back em { font-style: normal; font-size: 11px; color: #cbd5e1; }

/* Details Card beside 3D Book */
.glib-detail-card {
  background: var(--lib-panel);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 24px;
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.glib-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.glib-pill {
  padding: 4px 11px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.glib-pill.gold {
  background: rgba(253, 184, 30, 0.15);
  color: var(--lib-gold);
  border-color: rgba(253, 184, 30, 0.35);
}

.glib-pill.emerald {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.glib-detail-title-ar {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.4;
  color: #ffffff;
}

.glib-detail-title-orig {
  margin: 0;
  font-size: 13.5px;
  color: #94a3b8;
  font-weight: 600;
  direction: auto;
  text-align: right;
}

.glib-progress-wrap {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 10px 14px;
}

.glib-progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.glib-progress-track {
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

.glib-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--lib-teal), var(--lib-gold));
  border-radius: 99px;
  transition: width 0.35s ease;
}

.glib-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.glib-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #006174, #0284c7);
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.glib-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(2, 132, 199, 0.55);
}

.glib-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 15px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.75);
  color: #e2e8f0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.glib-btn-secondary:hover {
  border-color: var(--lib-gold);
  color: var(--lib-gold);
}

.glib-btn-secondary.fav-on {
  background: rgba(253, 184, 30, 0.16);
  border-color: var(--lib-gold);
  color: var(--lib-gold);
}

/* ===== 3D Coverflow Shelf Dock with AR/EN Visual Divider ===== */
.glib-coverflow-wrap {
  width: 100%;
  background: rgba(9, 18, 34, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 22px;
  padding: 14px 16px;
}

.glib-coverflow-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 6px;
}

.glib-coverflow-head h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--lib-gold);
}

.glib-nav-arrows {
  display: flex;
  gap: 8px;
}

.glib-arrow-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.9);
  color: #ffffff;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.glib-arrow-btn:hover {
  border-color: var(--lib-gold);
  color: var(--lib-gold);
}

.glib-coverflow-strip {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 10px 6px 12px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  align-items: stretch;
}

.glib-shelf-divider {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(0, 97, 116, 0.2);
  border: 1px dashed rgba(253, 184, 30, 0.45);
  color: var(--lib-gold);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  writing-mode: horizontal-tb;
  min-width: 92px;
  gap: 4px;
}

.glib-mini-book {
  flex: 0 0 152px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.88);
  border-radius: 16px;
  padding: 9px;
  cursor: pointer;
  text-align: right;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
  font-family: inherit;
}

.glib-mini-book:hover {
  transform: translateY(-5px);
  border-color: rgba(56, 189, 248, 0.55);
}

.glib-mini-book.active {
  transform: translateY(-6px) scale(1.03);
  border-color: var(--lib-gold);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), 0 0 18px rgba(253, 184, 30, 0.3);
}

.glib-mini-cover-img-wrap {
  position: relative;
  height: 158px;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(0,0,0,0.45);
}

.glib-mini-cover-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.glib-mini-lang-chip {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 9.5px;
  font-weight: 800;
  background: rgba(4, 9, 20, 0.84);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.22);
}

.glib-mini-title {
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #ffffff;
}

.glib-mini-meta {
  font-size: 10.5px;
  color: var(--lib-muted);
  display: flex;
  justify-content: space-between;
  margin-top: auto;
}

/* ===== Smart Grid View with Separated Arabic & English Sections ===== */
.glib-grid-wrapper {
  position: relative;
  z-index: 5;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 22px 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.glib-section-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.glib-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(11, 22, 40, 0.78);
  border-right: 4px solid var(--lib-emerald);
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  border-left: 1px solid rgba(255,255,255,0.06);
}

.glib-section-header.en-sec {
  border-right-color: var(--lib-gold);
}

.glib-section-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.glib-section-count {
  padding: 3px 11px;
  border-radius: 99px;
  background: rgba(255,255,255,0.08);
  font-size: 12px;
  font-weight: 700;
  color: var(--lib-gold);
}

.glib-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}

.glib-grid-card {
  background: var(--lib-panel);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 20px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.glib-grid-card:hover {
  transform: translateY(-4px);
  border-color: var(--lib-cyan);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
}

.glib-grid-top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.glib-grid-thumb {
  width: 82px;
  height: 116px;
  flex-shrink: 0;
  border-radius: 6px 10px 10px 6px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
  position: relative;
}

.glib-grid-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.glib-grid-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,0.22) 0 5%, transparent 10%);
}

.glib-grid-info {
  flex: 1;
  min-width: 0;
}

.glib-grid-info h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
  color: #ffffff;
}

.glib-grid-info p {
  margin: 0;
  font-size: 11.5px;
  color: var(--lib-muted);
  direction: auto;
  text-align: right;
}

.glib-grid-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.glib-grid-actions .glib-btn-primary {
  flex: 1;
  padding: 8px 12px;
  font-size: 12.5px;
}

.glib-grid-actions .glib-btn-secondary {
  padding: 8px 11px;
  font-size: 12px;
}

/* ===== Smart PDF Reader Studio + Realistic Natural Page Turn ===== */
.glib-reader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: #050a14;
}

.glib-reader-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 18px;
  background: rgba(10, 22, 42, 0.96);
  border-bottom: 1px solid rgba(253, 184, 30, 0.25);
  z-index: 10;
}

.glib-reader-left,
.glib-reader-right,
.glib-reader-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.glib-reader-title {
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.glib-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.glib-tool-btn:hover:not(:disabled) {
  border-color: var(--lib-cyan);
  color: #ffffff;
}

.glib-tool-btn.active {
  background: rgba(253, 184, 30, 0.16);
  border-color: var(--lib-gold);
  color: var(--lib-gold);
}

.glib-tool-btn.danger {
  border-color: rgba(244, 63, 94, 0.45);
  background: rgba(244, 63, 94, 0.14);
  color: #fda4af;
}

.glib-tool-btn.danger:hover {
  background: rgba(244, 63, 94, 0.28);
  color: #ffffff;
}

.glib-tool-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.glib-zoom-pill {
  font-size: 12px;
  font-weight: 700;
  color: var(--lib-gold);
  min-width: 46px;
  text-align: center;
}

.glib-reader-body {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
  overflow: hidden;
}

.glib-drawer {
  width: 290px;
  flex-shrink: 0;
  background: rgba(9, 18, 34, 0.96);
  border-left: 1px solid rgba(56, 189, 248, 0.22);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 14px;
  gap: 12px;
}

.glib-drawer h4 {
  margin: 0;
  font-size: 13px;
  color: var(--lib-gold);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 8px;
}

.glib-outline-item {
  width: 100%;
  text-align: right;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: #e2e8f0;
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: border-color 0.2s;
}

.glib-outline-item:hover {
  border-color: var(--lib-cyan);
  color: #ffffff;
}

.glib-stage-pdf {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 18px 16px;
  gap: 12px;
  perspective: 2200px;
}

.glib-book-open-frame {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  transform-style: preserve-3d;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.78);
  border-radius: 10px;
  background: #e2e8f0;
  padding: 4px;
}

.glib-spread {
  position: relative;
  display: flex;
  gap: 0;
  align-items: flex-start;
  justify-content: center;
  transform-style: preserve-3d;
}

/* Realistic Book Spine Shadow down the center */
.glib-spread.has-two::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 27px;
  left: 50%;
  width: 34px;
  transform: translateX(-50%);
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(15,23,42,0.16) 44%, rgba(15,23,42,0.34) 50%, rgba(15,23,42,0.16) 56%, rgba(0,0,0,0) 100%);
  z-index: 4;
}

.glib-pdf-page {
  position: relative;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: filter 0.2s ease;
}

.glib-pdf-page:hover {
  filter: brightness(0.99);
}

.glib-pdf-page canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.glib-pdf-pagenum {
  width: 100%;
  text-align: center;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  border-top: 1px solid #e2e8f0;
}

/* Physical Page-Turn Animations (Natural RTL & LTR Physics) */
@keyframes glibFlipFwdRtl {
  0%   { opacity: 0.35; transform: perspective(2000px) rotateY(42deg) scale(0.98); }
  55%  { opacity: 0.92; transform: perspective(2000px) rotateY(8deg); }
  100% { opacity: 1;    transform: perspective(2000px) rotateY(0deg) scale(1); }
}
@keyframes glibFlipBwdRtl {
  0%   { opacity: 0.35; transform: perspective(2000px) rotateY(-42deg) scale(0.98); }
  55%  { opacity: 0.92; transform: perspective(2000px) rotateY(-8deg); }
  100% { opacity: 1;    transform: perspective(2000px) rotateY(0deg) scale(1); }
}

@keyframes glibLeafTurnRightToLeft {
  0%   { transform: rotateY(0deg); opacity: 0.95; box-shadow: -8px 0 30px rgba(0,0,0,0.35); }
  50%  { transform: rotateY(-95deg); opacity: 0.9; box-shadow: -20px 0 45px rgba(0,0,0,0.45); }
  100% { transform: rotateY(-180deg); opacity: 0; box-shadow: none; }
}

@keyframes glibLeafTurnLeftToRight {
  0%   { transform: rotateY(0deg); opacity: 0.95; box-shadow: 8px 0 30px rgba(0,0,0,0.35); }
  50%  { transform: rotateY(95deg); opacity: 0.9; box-shadow: 20px 0 45px rgba(0,0,0,0.45); }
  100% { transform: rotateY(180deg); opacity: 0; box-shadow: none; }
}

.glib-spread.anim-turn-right {
  animation: glibFlipBwdRtl 0.45s cubic-bezier(0.22, 0.85, 0.36, 1) both;
}

.glib-spread.anim-turn-left {
  animation: glibFlipFwdRtl 0.45s cubic-bezier(0.22, 0.85, 0.36, 1) both;
}

.glib-turning-leaf {
  position: absolute;
  top: 4px;
  bottom: 31px;
  width: calc(50% - 4px);
  pointer-events: none;
  z-index: 8;
  background: linear-gradient(90deg, #f8fafc 0%, #e2e8f0 88%, #cbd5e1 100%);
  backface-visibility: hidden;
  border-radius: 4px;
}

.glib-turning-leaf.from-left {
  left: 4px;
  transform-origin: right center;
  animation: glibLeafTurnLeftToRight 0.48s cubic-bezier(0.25, 0.8, 0.35, 1) forwards;
}

.glib-turning-leaf.from-right {
  right: 4px;
  transform-origin: left center;
  animation: glibLeafTurnRightToLeft 0.48s cubic-bezier(0.25, 0.8, 0.35, 1) forwards;
}

.glib-reader-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(10, 22, 42, 0.96);
  border-top: 1px solid rgba(56, 189, 248, 0.2);
}

.glib-jump-input {
  width: 84px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.9);
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
  text-align: center;
  outline: none;
}

.glib-jump-input:focus {
  border-color: var(--lib-gold);
}

.glib-loader-card {
  margin: 80px auto;
  padding: 30px 36px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #e2e8f0;
}

.glib-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--lib-muted);
  font-size: 15px;
}

@media (max-width: 900px) {
  .glib-hero-split {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .glib-book-showcase {
    min-height: 270px;
  }
  .glib-3d-book {
    --bw: 156px;
    --bh: 222px;
  }
  .glib-reader-title {
    max-width: 180px;
  }
}

@media (max-width: 640px) {
  .glib-topbar {
    padding: 10px 14px;
  }
  .glib-controls-wrap {
    width: 100%;
    justify-content: space-between;
  }
  .glib-search-box {
    max-width: 100%;
    min-width: 140px;
  }
  .glib-drawer {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 20;
    box-shadow: -8px 0 30px rgba(0,0,0,0.6);
  }
  .glib-spread {
    flex-direction: column;
    align-items: center;
  }
  .glib-spread.has-two::after,
  .glib-turning-leaf {
    display: none;
  }
}
