/**
 * File: note-view.css
 * Purpose: Styles the content reader view for notes, handling scroll 
 * containment and sticky header interactions.
 */
/* ════════════════════════════════════════════════════════════
   note-view.css — content reader page
   ════════════════════════════════════════════════════════════ */

/* ── SCROLL CONTAINER ────────────────────────────────────────
   The AffairOva ao-note-header is position:sticky at top:0.
   Any content_html that uses position:sticky internally would
   stick relative to the VIEWPORT, overlapping our header.

   Fix: lock body height to viewport, put all content in a
   fixed scroll container that starts below the header.
   Sticky elements inside content_html now stick relative to
   THIS container — they can never escape above it.

   ao-header heights from header.css: 56px mobile, 62px desktop.
*/
html, body {
  height: 100%;
  overflow: hidden;
  scroll-behavior: smooth;
}

.note-scroll-wrap {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 1024px) {
  .note-scroll-wrap { top: 62px; }
}

/* ── LOCK SCREEN (premium gate) ─────────────────────────── */
.page {
  width: 100%;
  padding: 20px 0 0;
}

@media (min-width: 1024px) {
  .page { padding: 28px 0 0; }
}

/* ── NOTE CONTENT ────────────────────────────────────────── */
.note-content {
  font-size: 14px;
  line-height: 1.75;
  color: #1e293b;
  padding: 0;
  animation: note-fade-in 0.35s ease-out;
}

/* NO transform here — transform creates a new containing block
   which breaks position:sticky inside content_html */
@keyframes note-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (min-width: 1024px) {
  .note-content { font-size: 15px; }
}

.note-content h2     { font-size: 17px; font-weight: 800; margin: 0 0 14px; }
.note-content p      { margin: 0 0 14px; }
.note-content strong { color: var(--ink); }

/* Hide any embedded lang switcher in content_html — ours is in the header */
.note-content #lang-switcher {
  display: none !important;
}

/* ── BOOKMARK BUTTON ─────────────────────────────────────── */
.bookmark-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 24px;
  padding: 2px 7px;
  border-radius: 7px;
  border: 1px solid var(--card-border);
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(15,27,45,0.08);
  font-size: 10px;
  font-weight: 700;
  color: #5b6478;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.bookmark-btn:hover  { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(15,27,45,0.12); }
.bookmark-btn:active { transform: translateY(0); box-shadow: 0 1px 4px rgba(15,27,45,0.1); }
.bookmark-btn.is-loading { opacity: 0.7; cursor: default; pointer-events: none; }
.bookmark-btn svg { display: block; width: 11px; height: 11px; flex-shrink: 0; transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1); }
.bookmark-btn .bookmark-btn-label { display: inline-flex; align-items: center; }
.bookmark-btn:active svg { transform: scale(1); }
.bookmark-btn.is-active { color: #2f6fed; }
.bookmark-btn.just-toggled svg { animation: bm-icon-pop 0.4s cubic-bezier(0.34,1.56,0.64,1); }

@keyframes bm-icon-pop {
  0%   { transform: scale(0.6) rotate(-8deg); }
  60%  { transform: scale(1.25) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ── LANGUAGE TOGGLE ─────────────────────────────────────── */
.lang-switcher-inline {
  margin-left: auto;
  display: flex;
  align-items: center;
  height: 24px;
  gap: 2px;
  background: #ffffff;
  border-radius: 7px;
  padding: 2px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(15,27,45,0.08);
  transition: box-shadow 0.2s ease;
}
.lang-switcher-inline:hover { box-shadow: 0 4px 14px rgba(15,27,45,0.12); }
.lang-switcher-inline .lb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 19px;
  font-size: 9px;
  font-weight: 600;
  padding: 0 8px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  color: #8a93a6;
  background: transparent;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.15s ease;
  white-space: nowrap;
  letter-spacing: 0.2px;
  font-family: inherit;
}
.lang-switcher-inline .lb:active      { transform: scale(0.94); }
.lang-switcher-inline .lb svg         { display: block; width: 9px; height: 9px; flex-shrink: 0; }
.lang-switcher-inline .lb:hover       { color: #5b6478; }
.lang-switcher-inline .lb.active:hover { color: #ffffff; }
.lang-switcher-inline .lb.active {
  background: #2f6fed;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(47,111,237,0.35);
  animation: lb-pop 0.25s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes lb-pop {
  0%   { transform: scale(0.9); }
  60%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@media (max-width: 420px) {
  .lang-switcher-inline .lb { padding: 0 6px; font-size: 8px; }
}

/* ── NOTE HEADER overrides ───────────────────────────────── */
.ao-note-header .lang-switcher-inline { margin-left: 0; }
.ao-note-header .bookmark-btn,
.ao-note-header .lang-switcher-inline {
  box-shadow: none;
  border: 1px solid var(--card-border);
}
.ao-note-header .bookmark-btn:hover,
.ao-note-header .lang-switcher-inline:hover { box-shadow: 0 2px 8px rgba(15,27,45,0.06); }

/* ── LOCK / PREMIUM GATE ─────────────────────────────────── */
.note-card {
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  padding: 26px 24px;
}

.note-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 0;
}
@media (min-width: 1024px) { .note-meta-row { padding: 10px 24px 12px; } }

.note-meta-row .pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  font-size: 10px;
  font-weight: 700;
  padding: 0 10px;
  border-radius: 999px;
}
.note-meta-row .pill.free    { background: var(--green-soft);  color: var(--green-soft-text); }
.note-meta-row .pill.premium { background: var(--orange-soft); color: var(--orange-soft-text); }
.note-meta-row .date         { font-size: 12px; color: var(--muted); font-weight: 600; }

.lock-wrap {
  text-align: center;
  padding: 50px 20px;
}
.lock-wrap .lock-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--orange-soft); color: var(--orange-soft-text);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.lock-wrap h3 { font-size: 16px; font-weight: 800; margin: 0 0 8px; }
.lock-wrap p  { font-size: 13px; color: var(--muted); margin: 0 0 18px; }
.lock-wrap .btn-upgrade {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
}
.lock-wrap .btn-upgrade:hover { background: #1e293b; }
