/* ExamBook — port of the WordPress ExamWalletBook reader UI. */
.eb-page-title { font-weight: 700; margin-bottom: 4px; }

.eb-book-card { border-radius: 16px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.eb-book-cover { width: 100%; height: 180px; object-fit: cover; }
.eb-book-cover-fallback {
  height: 180px; display: flex; align-items: center; justify-content: center;
  font-size: 64px; color: #fff;
  background: linear-gradient(135deg, #0b1530, #1a2a6c 55%, #4fc3f7);
}

/* Reader — dark card look like the WP plugin (default bg #121a33). */
.eb-reader { background: #f6f7fb; border-radius: 16px; padding: 18px; }
.eb-book-title { font-weight: 700; }
.eb-counter { text-align: center; color: #666; font-size: 13px; margin-bottom: 10px; }

.eb-panel { display: none; background: var(--eb-card-bg, #121a33); color: var(--eb-card-text, #ffffff); border-radius: 16px; padding: 24px; min-height: 320px; }
.eb-panel.active { display: block; }
.eb-card-title { font-weight: 700; margin-bottom: 14px; }
.eb-card-body { font-size: 16px; line-height: 1.6; }
.eb-card-body img.eb-card-image { max-width: 100%; border-radius: 12px; cursor: zoom-in; }
.eb-card-body img.eb-card-image.eb-zoomed { cursor: zoom-out; max-width: none; width: 100%; }
.eb-card-placeholder {
  min-height: 220px; display: flex; align-items: center; justify-content: center;
  font-size: 72px; border-radius: 12px;
  background: linear-gradient(135deg, #0b1530, #1a2a6c 55%, #4fc3f7);
}
.eb-img-broken { display: none; }
.eb-text { white-space: normal; }
/* Read more (WP .est-readmore): long text bodies clamp until expanded. */
.eb-card-body .eb-text { max-height: 280px; overflow: hidden; }
.eb-card-body .eb-text.eb-expanded { max-height: none; overflow: visible; }
.eb-readmore {
  display: inline-block; margin-top: 10px; padding: 6px 14px; cursor: pointer;
  border-radius: 20px; border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.1); color: #fff; font-size: 13px; font-weight: 700;
}
.eb-readmore:hover { background: rgba(255,255,255,.2); }
/* Language picker (WP est_lang EN/TE toggle) in the reader header. */
.eb-lang-picker { position: relative; flex: 0 0 auto; }
.eb-lang-btn {
  border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.1);
  color: #fff; border-radius: 20px; padding: 8px 14px; cursor: pointer; font-size: 13px; font-weight: 700;
}
.eb-lang-btn:hover { background: rgba(255,255,255,.25); }
.eb-lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  display: flex; flex-direction: column; min-width: 130px;
  background: #101736; border: 1px solid rgba(255,255,255,.25); border-radius: 12px; overflow: hidden;
}
.eb-lang-menu[hidden] { display: none; }
.eb-lang-opt {
  background: none; border: none; color: #fff; text-align: left;
  padding: 10px 14px; cursor: pointer; font-size: 14px;
}
.eb-lang-opt:hover { background: rgba(255,255,255,.12); }
.eb-read-progress { font-size: 12px; }
.eb-split { display: flex; gap: 16px; flex-wrap: wrap; }
.eb-split-img { flex: 1 1 45%; }
.eb-split-text { flex: 1 1 45%; }
.eb-gallery-img { display: none; max-width: 100%; border-radius: 12px; cursor: zoom-in; }
.eb-gallery-img.active { display: block; }
.eb-gallery-nav { margin-top: 10px; text-align: center; color: #fff; }
.eb-video { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 12px; }
.eb-video iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.eb-card-body table { width: 100%; background: #fff; color: #222; border-collapse: collapse; border-radius: 8px; overflow: hidden; }
.eb-card-body table th, .eb-card-body table td { border: 1px solid #ddd; padding: 8px 10px; text-align: left; }
.eb-card-body table th { background: #f0f0f0; }

.eb-card-actions { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.eb-card-actions .btn-outline-success, .eb-card-actions .btn-outline-danger,
.eb-card-actions .btn-outline-warning, .eb-card-actions .btn-outline-info { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.35); }
.eb-card-actions .btn-outline-success.eb-voted { background: #28a745; border-color: #28a745; color: #fff; }
.eb-card-actions .btn-outline-danger.eb-voted { background: #dc3545; border-color: #dc3545; color: #fff; }
.eb-card-actions .btn-warning { color: #212529; }
.eb-views { margin-left: auto; }

.eb-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.eb-dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.eb-dot { width: 10px; height: 10px; border-radius: 50%; border: none; background: #ccc; padding: 0; cursor: pointer; }
.eb-dot.active { background: #6f42c1; }
.eb-dot.locked { background: #dc3545; }

.eb-lock-panel { text-align: center; }
.eb-lock-img { max-width: 100%; border-radius: 12px; margin-bottom: 14px; }
.eb-lock-wrap h4 { margin-bottom: 8px; }

@media (max-width: 576px) {
  .eb-panel { padding: 16px; min-height: 280px; }
  .eb-split-img, .eb-split-text { flex: 1 1 100%; }
  .eb-views { margin-left: 0; }
}

/* One-page full-screen overlay — WP .est-reader behaviour:
 * fixed, 100vw/100dvh, dark gradient, covers header + footer. */
.eb-overlay {
  position: fixed; inset: 0;
  width: 100vw; width: 100dvw;
  height: 100vh; height: 100dvh;
  min-height: 100vh; min-height: 100dvh;
  background:
    radial-gradient(120% 90% at 85% -10%, rgba(79,195,247,.16), rgba(79,195,247,0) 55%),
    radial-gradient(100% 80% at 0% 110%, rgba(126,87,194,.18), rgba(126,87,194,0) 55%),
    linear-gradient(180deg, #0a1128 0%, #050815 60%, #04061a 100%);
  color: #fff;
  z-index: 99999;
  overflow: hidden;
  overscroll-behavior: none;
  box-sizing: border-box;
}
.eb-overlay[hidden] { display: none; }
.eb-overlay-inner {
  height: 100%; max-width: 960px; margin: 0 auto; padding: 16px 20px;
  display: flex; flex-direction: column; box-sizing: border-box;
}
.eb-overlay-top { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }
.eb-close {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.1);
  color: #fff; font-size: 26px; line-height: 1; cursor: pointer; padding: 0;
}
.eb-close:hover { background: rgba(255,255,255,.25); }
.eb-overlay-titles { flex: 1 1 auto; min-width: 0; text-align: center; }
.eb-overlay-book { font-weight: 700; margin: 0; font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eb-overlay .eb-counter { color: rgba(255,255,255,.7); margin: 2px 0 0; }
.eb-overlay-saved-link { flex: 0 0 auto; color: #fff; border-color: rgba(255,255,255,.4); }
.eb-overlay-saved-link:hover { color: #fff; background: rgba(255,255,255,.15); }
.eb-stage { flex: 1 1 auto; min-height: 0; position: relative; margin-top: 14px; }
.eb-overlay .eb-panel {
  position: absolute; inset: 0; min-height: 0; height: 100%;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.eb-overlay-nav { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.eb-overlay-nav .eb-dots .eb-dot { background: rgba(255,255,255,.35); }
.eb-overlay-nav .eb-dots .eb-dot.active { background: #fff; }
.eb-note { flex: 0 0 auto; text-align: center; color: rgba(255,255,255,.75); font-size: 13px; margin: 8px 0 0; min-height: 18px; }
html.eb-locked, body.eb-locked { overflow: hidden; }

@media (max-width: 576px) {
  .eb-overlay-inner { padding: 10px 12px; }
  .eb-overlay-book { font-size: 17px; }
  .eb-overlay-saved-link { display: none; }
  .eb-overlay .eb-panel { padding: 16px; }
  .eb-close { width: 40px; height: 40px; }
}

/* Card animations — port of the WP plugin's .est-book anim-{name} rules.
 * Panel transitions run at --eb-flip-ms (turn_speed_ms); image
 * transitions at --eb-img-ms (fold_speed_ms). All six are the WP
 * transforms, applied to the overlay panels. */
.eb-stage.eb-anim-book3d, .eb-stage.eb-anim-curl,
.eb-stage.eb-anim-flip180, .eb-stage.eb-anim-edge { perspective: 1600px; }
.eb-stage[class*="eb-anim-"] .eb-panel {
  transition: transform var(--eb-flip-ms, 1000ms) ease, opacity var(--eb-flip-ms, 1000ms) ease;
}
.eb-stage.eb-anim-slider .eb-panel.is-enter { transform: translateX(100%); opacity: 0; }
.eb-stage.eb-anim-slider .eb-panel.is-exit { transform: translateX(-100%); opacity: 0; }
.eb-stage.eb-anim-slider.eb-rev .eb-panel.is-enter { transform: translateX(-100%); opacity: 0; }
.eb-stage.eb-anim-slider.eb-rev .eb-panel.is-exit { transform: translateX(100%); opacity: 0; }
.eb-stage.eb-anim-edge .eb-panel { transform-origin: left center; backface-visibility: hidden; }
.eb-stage.eb-anim-edge .eb-panel.is-enter { transform: rotateY(90deg); opacity: 0; }
.eb-stage.eb-anim-edge .eb-panel.is-exit { transform: rotateY(-90deg); opacity: 0; }
.eb-stage.eb-anim-fade .eb-panel.is-enter, .eb-stage.eb-anim-fade .eb-panel.is-exit { opacity: 0; }
.eb-stage.eb-anim-book3d .eb-panel { transform-origin: left center; backface-visibility: hidden; }
.eb-stage.eb-anim-book3d .eb-panel.is-enter { transform: perspective(1400px) rotateY(65deg); opacity: 0; }
.eb-stage.eb-anim-book3d .eb-panel.is-exit { transform: perspective(1400px) rotateY(-160deg); opacity: 0; }
.eb-stage.eb-anim-curl .eb-panel { transform-origin: right center; }
.eb-stage.eb-anim-curl .eb-panel.is-enter { transform: perspective(1400px) rotateY(-25deg) skewY(2deg); opacity: 0; }
.eb-stage.eb-anim-curl .eb-panel.is-exit { transform: perspective(1400px) rotateY(25deg) skewY(-2deg); opacity: 0; }
.eb-stage.eb-anim-flip180 .eb-panel { transform-origin: center center; backface-visibility: hidden; }
.eb-stage.eb-anim-flip180 .eb-panel.is-enter { transform: rotateY(180deg); opacity: 0; }
.eb-stage.eb-anim-flip180 .eb-panel.is-exit { transform: rotateY(-180deg); opacity: 0; }

/* Image animation on the incoming card (WP image_animation, fold speed). */
.eb-stage[data-img-anim] .eb-card-body img {
  transition: transform var(--eb-img-ms, 550ms) ease, opacity var(--eb-img-ms, 550ms) ease;
}
.eb-stage[data-img-anim="slider"] .eb-card-body img.eb-img-enter { transform: translateX(40px); opacity: 0; }
.eb-stage[data-img-anim="edge"] .eb-card-body img.eb-img-enter { transform: rotateY(90deg); opacity: 0; }
.eb-stage[data-img-anim="fade"] .eb-card-body img.eb-img-enter { opacity: 0; }
.eb-stage[data-img-anim="book3d"] .eb-card-body img.eb-img-enter { transform: perspective(1400px) rotateY(65deg); opacity: 0; }
.eb-stage[data-img-anim="curl"] .eb-card-body img.eb-img-enter { transform: perspective(1400px) rotateY(-25deg) skewY(2deg); opacity: 0; }
.eb-stage[data-img-anim="flip180"] .eb-card-body img.eb-img-enter { transform: rotateY(180deg); opacity: 0; }

/* Night mode (WP enable_night_mode / night_dim_images): dim card images. */
.eb-night-btn {
  display:inline-flex; align-items:center; justify-content:center;
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.1);
  color: #fff; font-size: 22px; line-height: 1; cursor: pointer; padding: 0;
}
.eb-night-btn:hover { background: rgba(255,255,255,.25); }
.eb-night-btn.eb-night-on { background: #f5c542; border-color: #f5c542; color: #222; }
.eb-overlay.eb-night .eb-card-body img {
  filter: brightness(.75) sepia(.25);
}
.eb-overlay.eb-night .eb-panel { background: #0a0f24; }

/* ---- WP settings port (ids 293-334): radii, sizes, accent, gradient,
 * image fit, header/footer heights, topics, ads, watermark, night. ---- */
.eb-overlay .eb-panel { border-radius: var(--eb-border-radius, 16px); }
.eb-overlay .eb-card-actions .btn { border-radius: var(--eb-btn-radius, 12px); }
.eb-overlay-nav .btn { font-size: var(--eb-page-arrow-size, 32px); line-height: 1.1; padding: 6px 14px; }
.eb-overlay-nav .eb-dots .eb-dot.active { background: var(--eb-accent, #4fc3f7); }
.eb-overlay-top { min-height: var(--eb-header-h, 54px); }
.eb-overlay-nav { min-height: var(--eb-footer-h, 62px); }
.eb-brand { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.6); }
.eb-brand-icon { width: 22px; height: 22px; object-fit: contain; }
.eb-header-links { display: flex; gap: 12px; font-size: 13px; }
.eb-header-links a { color: rgba(255,255,255,.8); text-decoration: none; }
.eb-header-links a:hover { color: #fff; text-decoration: underline; }

/* Topic chips + lesson chips (WP est_topic / est_lesson). */
.eb-topics, .eb-lesson-label { flex: 0 0 auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.eb-lesson-label { margin-top: 8px; }
.eb-topic-chip, .eb-lesson-chip {
  border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.08);
  color: #fff; border-radius: var(--eb-tabs-radius, 0); font-size: var(--eb-tab-text-size, 13px);
  padding: 6px 12px; cursor: pointer;
  /* The chips are created by JS with no whitespace text nodes between
     them, so the container gap is their only spacing. This margin keeps
     them apart even if the flex gap ever fails to apply. */
  margin: 0 4px 4px 0;
}
.eb-topic-chip:hover, .eb-lesson-chip:hover { background: rgba(255,255,255,.18); }
.eb-topic-chip.active, .eb-lesson-chip.active { background: var(--eb-accent, #4fc3f7); border-color: var(--eb-accent, #4fc3f7); color: #06202f; font-weight: 700; }

/* Card gradient (WP enable_card_gradient + gradient_1/2/3 + angle). */
.eb-overlay-inner.eb-gradient .eb-panel {
  background:
    linear-gradient(var(--eb-grad-angle, 135deg),
      var(--eb-grad-1, #0b1530),
      var(--eb-grad-2, #1a2a6c) 55%,
      var(--eb-grad-3, #4fc3f7));
}
.eb-overlay-inner.eb-gradient .eb-panel::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: var(--eb-card-bg, #121a33);
  opacity: calc(1 - var(--eb-grad-opacity, 15) / 100);
  pointer-events: none;
}
.eb-overlay-inner.eb-gradient .eb-panel > * { position: relative; }

/* Image fit (WP image_fit_mode). */
.eb-card-body img.eb-card-image, .eb-card-body img.eb-gallery-img { object-fit: var(--eb-img-fit, contain); }
.eb-card-body img.eb-card-image { max-height: 52vh; width: 100%; }

/* Watermark (WP watermark_*): logo on every card, corner per anchor. */
.eb-watermark { position: absolute; z-index: 3; pointer-events: none; opacity: var(--eb-wm-opacity, 10%); }
.eb-watermark img { width: var(--eb-wm-w, 56px); height: var(--eb-wm-h, 56px); object-fit: contain; transform: rotate(var(--eb-wm-rotate, 0deg)); }

/* Ad card (WP ad_enable / ad_interval / ad_image / ad_link). */
.eb-ad-panel { display: flex; align-items: center; justify-content: center; text-align: center; }
.eb-ad-panel.active { display: flex; }
.eb-ad-wrap { max-width: 420px; }
.eb-ad-img { max-width: 100%; border-radius: 12px; }
.eb-ad-label { color: rgba(255,255,255,.55); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; margin-top: 8px; }

/* Premium lock panel. */
.eb-premium-panel .eb-premium-badge {
  display: inline-block; background: #f5c542; color: #222; font-weight: 700;
  border-radius: 20px; padding: 4px 14px; margin-bottom: 12px; font-size: 13px;
}
.eb-premium-price { font-size: 26px; font-weight: 700; }
.eb-premium-panel .btn { margin: 4px; }

/* Night mode details (WP night_overlay_color/opacity, night_dim_images). */
.eb-overlay.eb-night .eb-stage::before {
  content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: var(--eb-night-overlay, #ffcc9a);
  opacity: calc(var(--eb-night-overlay-opacity, 10%) / 100);
}
.eb-overlay.eb-night.eb-night-dim .eb-card-body img { filter: brightness(.75) sepia(.25); }
.eb-overlay.eb-night .eb-panel { background: #0a0f24; }

/* Background icon (WP bg_icon) behind the cards. */
.eb-overlay.eb-has-bgicon .eb-stage::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: var(--eb-bg-icon) center / contain no-repeat;
  opacity: var(--eb-bg-icon-opacity, .06);
}

@media (max-width: 576px) {
  .eb-header-links { display: none; }
  .eb-brand-text { display: none; }
}

/* Portal card types: list / table / formula (content JSON, rendered
 * server-side by exambook_card_body_html()). */
.eb-list { margin: 0; padding-left: 22px; font-size: 16px; line-height: 1.7; }
.eb-list li { margin-bottom: 6px; }
.eb-table { width: 100%; }
.eb-formula {
  font-size: 22px; font-weight: 700; text-align: center;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px; padding: 16px 12px; margin-bottom: 14px;
  font-family: "Cambria Math", "Times New Roman", serif;
}
.eb-card-caption { margin-top: 12px; color: rgba(255,255,255,.8); font-size: 14px; line-height: 1.5; }
.eb-lock-panel .eb-premium-login { margin-top: 10px; }
.eb-book-card .badge-premium { background: #f5c542; color: #222; }
.eb-book-card .badge-unlocked { background: #28a745; color: #fff; }
