/* =========================================================================
   Concept FlipBook — stiluri proprii, fără dependențe.
   Totul e sub .cfb, ca tema site-ului să nu se amestece și invers.
   ========================================================================= */

.cfb {
  --cfb-bg:        #eef0f3;
  --cfb-panel:     #ffffff;
  --cfb-text:      #111827;
  --cfb-muted:     #6b7280;
  --cfb-line:      #e5e7eb;
  --cfb-accent:    #0f766e;
  --cfb-shadow:    0 10px 30px rgba(0,0,0,.14);
  --cfb-bar:       54px;

  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: var(--cfb-bg);
  color: var(--cfb-text);
  font: 15px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-align: left;
  overflow: hidden;
}
.cfb *, .cfb *::before, .cfb *::after { box-sizing: border-box; }
.cfb[hidden] { display: none !important; }
.cfb .cfb-config { display: none; }

/* ---------- moduri ---------- */
.cfb-wrap { position: relative; width: 100%; max-width: 100%; margin: 1.5em 0; }
.cfb--inline { width: 100%; height: 100%; border-radius: 14px; border: 1px solid var(--cfb-line); }

.cfb--page,
.cfb--lightbox,
.cfb.is-fs {
  position: fixed !important;
  inset: 0;
  width: auto; height: auto;
  margin: 0;
  border-radius: 0;
  border: 0;
  z-index: 2147482000;
}
/* Bannerul de cookie-uri al site-ului trebuie să rămână deasupra paginii proprii. */
.cfb--page { z-index: 9990; }
.cfb.is-native-fs { width: 100%; height: 100%; border-radius: 0; border: 0; }

html.cfb-lock, html.cfb-lock body { overflow: hidden !important; overscroll-behavior: none; }
html.has-cfb-page, body.has-cfb-page { margin: 0; padding: 0; height: 100%; background: #eef0f3; }

.cfb-sr {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; margin: -1px; padding: 0; border: 0;
}

/* ---------- bara de sus ---------- */
.cfb__bar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  height: var(--cfb-bar);
  padding: 0 10px;
  background: var(--cfb-panel);
  border-bottom: 1px solid var(--cfb-line);
  z-index: 30;
}
.cfb__title { flex: 1 1 auto; min-width: 0; }
.cfb__title b { display: block; font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cfb__actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.cfb__sep { width: 1px; height: 24px; background: var(--cfb-line); margin: 0 2px; }

.cfb .cfb__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  flex: 0 0 auto;
  min-width: 40px; height: 40px; margin: 0; padding: 0 10px;
  border: 1px solid var(--cfb-line); border-radius: 10px;
  background: var(--cfb-panel); color: var(--cfb-text);
  font-family: inherit; font-size: 13px; font-weight: 550; line-height: 1; text-decoration: none; text-transform: none; letter-spacing: 0;
  box-shadow: none; cursor: pointer;
  transition: background .15s ease, transform .06s ease;
  -webkit-tap-highlight-color: transparent;
}
.cfb .cfb__btn:hover  { background: color-mix(in srgb, var(--cfb-panel) 90%, var(--cfb-text)); color: var(--cfb-text); }
.cfb .cfb__btn:active { transform: scale(.96); }
.cfb .cfb__btn:focus-visible { outline: 2px solid var(--cfb-accent); outline-offset: 2px; }
.cfb .cfb__btn[disabled] { opacity: .38; cursor: default; }
.cfb .cfb__btn--close { background: var(--cfb-text); border-color: var(--cfb-text); color: var(--cfb-panel); }
.cfb .cfb__btn--close:hover { background: color-mix(in srgb, var(--cfb-text) 85%, #fff); color: var(--cfb-panel); }
.cfb .cfb__btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.cfb .cfb__btn span { display: none; }

.cfb__count {
  min-width: 64px; text-align: center;
  font-variant-numeric: tabular-nums; font-size: 13px; color: var(--cfb-muted); white-space: nowrap;
}

/* ---------- scena ---------- */
.cfb__stage {
  flex: 1 1 auto;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  min-height: 0;
  /* Pe tot ecranul, toate gesturile sunt ale noastre. */
  touch-action: none;
}
/* În pagină, derularea verticală rămâne a browserului; glisarea orizontală e a cărții. */
.cfb--inline:not(.is-fs):not(.is-native-fs) .cfb__stage { touch-action: pan-y; }

.cfb__book { position: relative; }
.cfb__book img { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--cfb-panel); }

/* Săgețile de pe margini (ecrane late). */
.cfb .cfb__edge {
  position: absolute; top: 50%; z-index: 20;
  width: 44px; height: 64px; margin-top: -32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px;
  background: rgba(17,24,39,.06); color: var(--cfb-text);
  cursor: pointer; transition: background .15s ease, opacity .2s ease;
}
.cfb .cfb__edge:hover { background: rgba(17,24,39,.14); }
.cfb .cfb__edge svg { width: 26px; height: 26px; }
.cfb__edge--prev { left: 10px; }
.cfb__edge--next { right: 10px; }
.cfb.is-first .cfb__edge--prev, .cfb.is-last .cfb__edge--next { opacity: 0; pointer-events: none; }

/* ---------- bara de jos, pe ecrane înguste ---------- */
.cfb__dock {
  flex: 0 0 auto;
  display: none; align-items: center; justify-content: center; gap: 10px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--cfb-panel); border-top: 1px solid var(--cfb-line);
}

/* ---------- miniaturi ---------- */
.cfb__thumbs {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 45;
  background: var(--cfb-panel); border-top: 1px solid var(--cfb-line);
  transform: translateY(110%); transition: transform .32s cubic-bezier(.22,.61,.36,1);
  box-shadow: var(--cfb-shadow);
  visibility: hidden;
}
.cfb__thumbs.is-open { transform: none; visibility: visible; }
.cfb__thumbs-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; }
.cfb__thumbs-head b { font-size: 13px; }
.cfb__thumbs-list {
  display: flex; gap: 10px; overflow-x: auto; padding: 4px 12px calc(14px + env(safe-area-inset-bottom));
  scrollbar-width: thin; overscroll-behavior: contain; touch-action: pan-x;
}
.cfb .cfb__thumb {
  flex: 0 0 auto; width: 78px; margin: 0; padding: 0;
  border: 2px solid transparent; border-radius: 8px;
  background: none; cursor: pointer; overflow: hidden; line-height: 0;
}
.cfb__thumb img { width: 100%; height: auto; display: block; border-radius: 6px; background: var(--cfb-bg); }
.cfb__thumb b { display: block; font-size: 11px; line-height: 18px; color: var(--cfb-muted); text-align: center; }
.cfb .cfb__thumb.is-current { border-color: var(--cfb-accent); }
.cfb__thumb.is-current b { color: var(--cfb-accent); }

/* ---------- lupă ---------- */
.cfb__zoom {
  position: fixed; inset: 0; z-index: 2147483000; display: none;
  background: rgba(8,12,20,.94); touch-action: none;
}
.cfb__zoom.is-open { display: block; }
.cfb .cfb__zoom-img {
  position: absolute; top: 50%; left: 50%;
  max-width: 100vw; max-height: 100vh; width: auto; height: auto;
  transform-origin: center center; will-change: transform;
  user-select: none; -webkit-user-drag: none;
}
.cfb__zoom-bar {
  position: absolute; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 8px; border-radius: 14px;
  background: rgba(17,24,39,.9); box-shadow: var(--cfb-shadow);
}
.cfb .cfb__zoom-bar .cfb__btn { background: transparent; border-color: rgba(255,255,255,.22); color: #fff; }
.cfb .cfb__zoom-bar .cfb__btn:hover { background: rgba(255,255,255,.12); }
.cfb .cfb__zoom-close {
  position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px;
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.22); background: rgba(17,24,39,.9); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.cfb__zoom-close svg { width: 20px; height: 20px; }

/* ---------- încărcare, indiciu, mesaj ---------- */
.cfb__loader {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  gap: 10px; color: var(--cfb-muted); font-size: 14px; z-index: 40; background: var(--cfb-bg);
}
.cfb__loader.is-done { display: none; }
.cfb__spin {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--cfb-line); border-top-color: var(--cfb-accent);
  animation: cfb-spin .8s linear infinite;
}
@keyframes cfb-spin { to { transform: rotate(360deg); } }

.cfb__hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 26; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px);
  padding: 9px 16px; border-radius: 999px;
  background: rgba(17,24,39,.82); color: #fff; font-size: 13px; line-height: 1.3;
  pointer-events: none; transition: opacity .35s ease;
}
.cfb__hint.is-gone { opacity: 0; }
.cfb__hint svg { width: 17px; height: 17px; flex: 0 0 auto; animation: cfb-nudge 1.7s ease-in-out infinite; }
@keyframes cfb-nudge { 0%,100% { transform: translateX(4px); } 50% { transform: translateX(-4px); } }

.cfb__toast {
  position: absolute; left: 50%; top: calc(var(--cfb-bar) + 12px); z-index: 50;
  transform: translate(-50%, -8px); opacity: 0; pointer-events: none;
  padding: 8px 14px; border-radius: 10px; background: var(--cfb-text); color: var(--cfb-panel);
  font-size: 13px; transition: opacity .2s ease, transform .2s ease;
}
.cfb__toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- linkuri pe pagini ---------- */
.cfb__links { position: absolute; z-index: 3; pointer-events: none; }
.cfb .cfb__link {
  position: absolute; display: block; pointer-events: auto;
  border-radius: 4px; background: transparent; text-decoration: none;
  outline-offset: 0;
  transition: background .15s ease, box-shadow .15s ease;
}
.cfb .cfb__link:hover, .cfb .cfb__link:focus-visible {
  background: color-mix(in srgb, var(--cfb-accent) 16%, transparent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--cfb-accent) 70%, transparent);
}
.cfb__links.is-hint .cfb__link { animation: cfb-pulse 1.4s ease-out .5s 1; }
@keyframes cfb-pulse {
  0%   { background: transparent; }
  35%  { background: color-mix(in srgb, var(--cfb-accent) 22%, transparent); }
  100% { background: transparent; }
}

/* ---------- lupă pe pagină (doar mouse) ---------- */
.cfbx__pane { cursor: pointer; }
.cfb .cfb__pagezoom {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.5); border-radius: 50%;
  background: rgba(17,24,39,.72); color: #fff;
  cursor: zoom-in; opacity: 0; transition: opacity .18s ease, background .18s ease;
}
.cfb__pagezoom svg { width: 18px; height: 18px; }
.cfb .cfb__pagezoom:hover { background: rgba(17,24,39,.92); }
.cfbx__pane:hover .cfb__pagezoom { opacity: 1; }
.cfbx__pane .cfb__pagezoom[data-i=""] { display: none; }

/* ---------- ecrane înguste ---------- */
.cfb.is-single-page .cfb__edge { display: none; }
@media (max-width: 699px) {
  .cfb__dock { display: flex; }
  .cfb [data-cfb="prev"], .cfb [data-cfb="next"], .cfb [data-cfb="thumbs-btn"], .cfb [data-cfb="zoom-btn"], .cfb__sep, .cfb__edge { display: none !important; }
  .cfb__bar { gap: 6px; padding: 0 8px; }
  .cfb__count { min-width: 50px; font-size: 12px; }
}
@media (min-width: 1100px) {
  .cfb--page .cfb__btn span, .cfb--lightbox .cfb__btn span, .cfb.is-fs .cfb__btn span, .cfb.is-native-fs .cfb__btn span { display: inline; }
  .cfb--page [data-cfb="prev"] span, .cfb--page [data-cfb="next"] span,
  .cfb--lightbox [data-cfb="prev"] span, .cfb--lightbox [data-cfb="next"] span { display: none; }
}
@media (hover: none) { .cfb__pagezoom { display: none !important; } .cfb__edge { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  .cfb__thumbs, .cfb__hint svg, .cfbx, .cfb__links.is-hint .cfb__link { transition: none !important; animation: none !important; }
}

/* =========================================================================
   Motorul de răsfoire — transformări 3D CSS.
   ========================================================================= */
.cfbx {
  position: relative;
  perspective: 1400px;
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
  user-select: none; -webkit-user-select: none;
  transition: transform .5s cubic-bezier(.22,.61,.36,1);
}
.cfbx__pane {
  position: absolute; top: 0; height: 100%;
  overflow: hidden;
  background: var(--cfb-panel);
  box-shadow: 0 6px 22px rgba(0,0,0,.18);
}
.cfbx__pane--left  { left: 0;   width: 50%; }
.cfbx__pane--right { left: 50%; width: 50%; }
/* Cotorul: o umbră discretă pe mijloc, ca două pagini să citească drept o carte. */
.cfbx:not(.is-single):not(.is-closed):not(.is-closed-back) .cfbx__pane--left::after,
.cfbx:not(.is-single):not(.is-closed):not(.is-closed-back) .cfbx__pane--right::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 7%; pointer-events: none; z-index: 2;
}
.cfbx:not(.is-single) .cfbx__pane--left::after  { right: 0; background: linear-gradient(to left, rgba(0,0,0,.14), transparent); }
.cfbx:not(.is-single) .cfbx__pane--right::after { left: 0;  background: linear-gradient(to right, rgba(0,0,0,.14), transparent); }

.cfbx.is-single .cfbx__pane--left  { display: none; }
.cfbx.is-single .cfbx__pane--right { left: 0; width: 100%; }

.cfbx.is-closed .cfbx__pane--left       { visibility: hidden; }
.cfbx.is-closed                         { transform: translateX(-25%); }
.cfbx.is-closed-back .cfbx__pane--right { visibility: hidden; }
.cfbx.is-closed-back                    { transform: translateX(25%); }
.cfbx.is-single { transition: none; transform: none !important; }

.cfbx__leaf {
  position: absolute; top: 0; height: 100%; width: 50%;
  transform-style: preserve-3d; will-change: transform; z-index: 5;
}
.cfbx.is-single .cfbx__leaf { width: 100%; }
.cfbx__leaf--fwd  { left: 50%; transform-origin: left center; }
.cfbx__leaf--back { left: 0;   transform-origin: right center; }
.cfbx.is-single .cfbx__leaf--fwd,
.cfbx.is-single .cfbx__leaf--back { left: 0; transform-origin: left center; }

.cfbx__face {
  position: absolute; inset: 0; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--cfb-panel);
}
.cfbx__face--back { transform: rotateY(180deg); }
.cfbx__shade {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(to left, rgba(0,0,0,.28), rgba(0,0,0,0) 42%);
}
.cfbx__leaf--back .cfbx__shade { background: linear-gradient(to right, rgba(0,0,0,.28), rgba(0,0,0,0) 42%); }
.cfbx__cast {
  position: absolute; top: 0; height: 100%; width: 50%;
  pointer-events: none; z-index: 4; opacity: 0;
  background: linear-gradient(to right, rgba(0,0,0,.35), rgba(0,0,0,0) 55%);
}
.cfbx.is-single .cfbx__cast { width: 100%; }

.cfbx img {
  display: block; width: 100%; height: 100%; max-width: none; object-fit: contain;
  margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none;
  -webkit-touch-callout: none; -webkit-user-drag: none; user-select: none; -webkit-user-select: none;
}

/* ---------- copertă (modul buton) ---------- */
.cfb-cover { margin: 1.5em 0; }
.cfb-cover__btn {
  display: inline-flex; flex-direction: column; align-items: center; gap: 10px;
  max-width: 320px; padding: 0; margin: 0;
  border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
}
.cfb-cover__btn img {
  display: block; width: 100%; height: auto; border-radius: 6px;
  box-shadow: 0 10px 28px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.1);
  transition: transform .25s ease, box-shadow .25s ease;
}
.cfb-cover__btn:hover img { transform: translateY(-3px) rotate(-.6deg); box-shadow: 0 16px 36px rgba(0,0,0,.22), 0 3px 8px rgba(0,0,0,.12); }
.cfb-cover__label { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- fără JavaScript ---------- */
.cfb-noscript { padding: 16px; overflow: auto; }
.cfb-noscript img { display: block; max-width: 100%; height: auto; margin: 0 auto 12px; }
