/* ==========================================================================
   OIC Statements — Reader / Flipbook Styles
   ========================================================================== */

.oic-reader {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: #0c1114;
  color: #e6ebee;
  overflow: hidden;
}
/* Top toolbar */
.oic-reader__bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--oic-sp-4);
  padding: var(--oic-sp-3) var(--oic-sp-5);
  background: rgba(12, 17, 20, 0.92);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  z-index: var(--oic-z-overlay-ui);
}
.oic-reader__title { font-weight: 700; font-size: var(--oic-fs-lg); }
.oic-reader__pages { color: #9fb0ba; font-size: var(--oic-fs-sm); }
.oic-reader__tools { display: flex; align-items: center; gap: var(--oic-sp-2); }
.oic-reader__tool { width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.12); background: transparent; color: #e6ebee; cursor: pointer; display: grid; place-items: center; }
.oic-reader__tool:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* GTranslate widget inside reader toolbar — keep it compact and dark-themed */
.oic-reader__gtranslate { display: flex; align-items: center; }
.oic-reader__gtranslate select,
.oic-reader__gtranslate .gt-lang-code { background: rgba(255,255,255,0.07); color: #e6ebee; border: 1px solid rgba(255,255,255,0.15); border-radius: 8px; font-size: .75rem; padding: 2px 6px; cursor: pointer; }
.oic-reader__gtranslate select:focus { outline: none; border-color: rgba(255,255,255,0.3); }

/* Stage */
.oic-reader__stage {
  flex: 1; position: relative;
  display: grid; place-items: center;
  padding: var(--oic-sp-5);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  /* Zoom transform applied via JS applyZoom() */
  transform-origin: 50% 50%;
  transition: transform 0.18s ease;
}
#oic-flipbook {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  box-shadow: var(--oic-shadow-lg);
}

/* Fixed-geometry page (source of truth for PDF too) */
.oic-page {
  position: relative;
  width: 420px; height: 594px;     /* A4 aspect ratio (210:297), scaled to 420px */
  box-sizing: border-box;
  overflow: hidden;
  /* White fallback — per-page inline styles override the background; the active
     layout container (.lay) owns the padding so full-bleed layouts can ignore it.
     A scaled .oic-page__scale wrapper (added in reader.js) renders the layout at
     true printable geometry so text/image ratios match the PDF + builder. */
  background: #ffffff;
  color: #2a3640;
}
.oic-page__num { position: absolute; bottom: 14px; inset-inline-start: 24px; font-size: 0.8rem; color: var(--oic-text-muted); z-index: 3; }

/* Per-page dividers (editor-controlled) */
.oic-page__divider { margin: 6px 0 14px; }
.oic-page__divider--line { height: 3px; width: 60px; border-radius: 3px; }
.oic-page__divider--dots { letter-spacing: 6px; font-size: 1rem; }
.oic-page__divider--ornament { font-size: 1.5rem; line-height: 1; }

/* Per-page engagement overlay — removed; replaced by .oic-engage-bar */
.oic-page__overlay { display: none; }

/* ---- Per-page engagement bar (inside each .oic-page) -------------------- */
/* A compact strip at the very bottom of every non-hard page.                 */
.oic-page-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 6px;
  /* Gradient fade so the bar doesn't hard-cut over content */
  background: linear-gradient(to bottom, transparent 0%, rgba(10,15,20,0.78) 100%);
  z-index: 10;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
/* Always show the bar when page is visible (StPageFlip page is shown) */
.oic-page-bar.is-visible {
  opacity: 1;
  pointer-events: auto;
}
/* Also show on hover for the fallback linear layout */
.oic-page:hover .oic-page-bar {
  opacity: 1;
  pointer-events: auto;
}

.oic-page-bar__btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.88);
  cursor: pointer;
  padding: 3px 6px;
  border-radius: var(--oic-radius-pill);
  font-size: 0.72rem;
  font-family: inherit;
  line-height: 1;
  transition: background .13s, transform .12s;
  white-space: nowrap;
}
.oic-page-bar__btn:hover {
  background: rgba(255,255,255,0.15);
  transform: translateY(-1px);
}
.oic-page-bar__btn.is-active {
  background: color-mix(in srgb, var(--oic-primary) 35%, transparent);
  color: #7ee8d6;
}
.oic-page-bar__btn .oic-reaction__emoji { font-size: 0.88rem; }
.oic-page-bar__btn .oic-reaction__count {
  font-size: 0.65rem;
  opacity: 0.82;
  min-width: 8px;
}
.oic-page-bar__comment-count {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--oic-accent);
  color: #fff;
  border-radius: var(--oic-radius-pill);
  padding: 0 4px;
  min-width: 14px;
  line-height: 1.5;
  display: inline-block;
  text-align: center;
}
.oic-page-bar__sep {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.18);
  margin: 0 2px;
  flex-shrink: 0;
}

/* ---- Old single floating bar (removed, kept for safety) ---- */
.oic-engage-bar { display: none; }

/* Reaction pill / comment badge — replaced by .oic-engage-bar */
.oic-reaction-pill { display: none; }
.oic-comment-badge { display: none; }

/* .oic-reaction used by engagement bar buttons */
.oic-reaction {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px 7px;
  border-radius: var(--oic-radius-pill);
  font-size: 0.78rem;
  line-height: 1;
  color: var(--oic-text);
  transition: transform var(--oic-dur) var(--oic-ease), background-color var(--oic-dur) var(--oic-ease);
}
.oic-reaction:hover { transform: translateY(-1px); background: rgba(15, 123, 107, 0.08); }
.oic-reaction.is-active { background: color-mix(in srgb, var(--oic-primary) 14%, transparent); color: var(--oic-primary); font-weight: 700; }
.oic-reaction__emoji { font-size: 0.95rem; }

/* Thumbnail filmstrip */
.oic-reader__filmstrip {
  display: flex; gap: var(--oic-sp-2);
  padding: var(--oic-sp-3) var(--oic-sp-5);
  background: rgba(12, 17, 20, 0.92);
  border-top: 1px solid rgba(255,255,255,0.08);
  overflow-x: auto;
}
.oic-thumb {
  position: relative;
  height: 72px;
  aspect-ratio: 210 / 297;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  flex: 0 0 auto;
  opacity: 0.65;
  overflow: hidden;
  background: #fff;
  padding: 0;
}
.oic-thumb.is-active, .oic-thumb:hover { border-color: var(--oic-accent); opacity: 1; }
.oic-thumb__fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: #1f2a30; color: #9fb0ba; font-size: 0.8rem;
}

/* Inline annotation highlight + marker */
.oic-highlight { background: color-mix(in srgb, var(--oic-accent) 35%, transparent); border-radius: 3px; cursor: pointer; }
.oic-annotation-marker {
  position: absolute; inset-inline-end: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--oic-accent); color: #1d2327;
  display: grid; place-items: center; font-size: 0.7rem; cursor: pointer;
  z-index: var(--oic-z-overlay-ui);
}

/* Selection popover */
.oic-selection-popover {
  position: absolute; z-index: var(--oic-z-popover);
  display: none; gap: 4px;
  background: var(--oic-secondary); color: #fff;
  border-radius: var(--oic-radius); padding: 6px;
  box-shadow: var(--oic-shadow-lg);
}
.oic-selection-popover.is-open { display: flex; }
.oic-selection-popover button { background: transparent; border: none; color: #fff; padding: 6px 10px; border-radius: var(--oic-radius-sm); cursor: pointer; font-size: 0.85rem; }
.oic-selection-popover button:hover { background: rgba(255,255,255,0.15); }

@media (max-width: 720px) {
  .oic-page { width: 320px; height: 453px; }
  .oic-reader__title { font-size: var(--oic-fs-base); }
}

/* ---- OIC single-page statements: scroll instead of flipbook ---- */
.oic-reader-page.is-oic-statement .oic-reader__stage { overflow-y: auto; align-items: flex-start; }
.oic-reader__oic-page {
  width: 820px;
  max-width: 100%;
  background: #fff;
  box-shadow: var(--oic-shadow-lg);
  border-radius: 4px;
  margin: 0 auto;
  height: 1250px;     /* definite height so % children resolve correctly */
  min-height: 1250px; /* still grows if content overflows */
  position: relative;
}
