/* ══════════════════════════════════════════════════════════════════
   ePub Viewer — Online ePub Reader Styles
   Full-window immersive reader + upload landing page
   ══════════════════════════════════════════════════════════════════ */

.epv-wrapper { max-width: 100%; margin: 0 auto; }

/* ── Header ─────────────────────────────────────────────────────── */
.epv-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 24px; padding: 20px 24px;
  background: #f8f9fc; border-radius: 14px; border: 1px solid #e8eaf0;
}
.epv-header-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: #7c3aed; flex-shrink: 0;
}
.epv-title { font-size: 1.4rem; font-weight: 800; color: #1a1a2e; margin: 0; }
.epv-subtitle { font-size: 0.9rem; color: #6b7280; margin: 4px 0 0; }

/* ── Open Section ───────────────────────────────────────────────── */
.epv-open-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.epv-open-card {
  background: #fff; border: 1.5px solid #e8eaf0; border-radius: 14px;
  padding: 32px 24px; text-align: center; transition: border-color .2s, box-shadow .2s; cursor: pointer;
}
.epv-open-card:hover, .epv-open-card.epv-drag-over {
  border-color: #7c3aed; box-shadow: 0 4px 20px rgba(124,58,237,.1);
}
.epv-open-card-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, #f3e8ff, #ede9fe);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: #7c3aed; margin-bottom: 16px;
}
.epv-open-card h4 { font-size: 1.1rem; font-weight: 700; color: #1a1a2e; margin: 0 0 8px; }
.epv-hint { font-size: .85rem; color: #9ca3af; margin-bottom: 16px; }
.epv-url-row { display: flex; gap: 8px; margin-top: 12px; }

/* ── Inputs & Buttons ───────────────────────────────────────────── */
.epv-input {
  flex: 1; padding: 10px 14px; border: 1.5px solid #e2e4f0;
  border-radius: 8px; font-size: .9rem; outline: none; transition: border-color .2s;
}
.epv-input:focus { border-color: #7c3aed; }
.epv-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: 8px; font-size: .9rem; font-weight: 600;
  border: none; cursor: pointer; transition: all .2s; text-decoration: none;
}
.epv-btn-primary { background: linear-gradient(135deg, #7c3aed, #6d28d9); color: #fff; }
.epv-btn-primary:hover { background: linear-gradient(135deg, #6d28d9, #5b21b6); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(124,58,237,.3); }
.epv-btn-premium { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.epv-btn-premium:hover { background: linear-gradient(135deg, #d97706, #b45309); }
.epv-btn-outline { background: transparent; border: 1.5px solid #e2e4f0; color: #6b7280; }
.epv-btn-outline:hover { border-color: #7c3aed; color: #7c3aed; }

/* ── Samples ────────────────────────────────────────────────────── */
.epv-samples { text-align: center; padding: 16px; }
.epv-samples-label { font-size: .85rem; color: #6b7280; margin-bottom: 10px; }
.epv-sample-chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.epv-chip {
  padding: 6px 14px; border: 1.5px solid #e2e4f0; border-radius: 20px;
  font-size: .8rem; font-weight: 600; color: #6b7280; background: #f8f9fc;
  cursor: pointer; transition: all .2s;
}
.epv-chip:hover { border-color: #7c3aed; color: #7c3aed; background: #f3e8ff; }

/* ── Loading ────────────────────────────────────────────────────── */
.epv-loading {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,.92); display: flex; flex-direction: column;
  align-items: center; justify-content: center; z-index: 100000;
}
.epv-loading-spinner {
  width: 48px; height: 48px; border: 4px solid #e8eaf0; border-top-color: #7c3aed;
  border-radius: 50%; animation: epvSpin .8s linear infinite; margin-bottom: 16px;
}
@keyframes epvSpin { to { transform: rotate(360deg); } }
.epv-loading p { font-size: .95rem; color: #6b7280; font-weight: 600; }

/* ── Responsive (upload section) ────────────────────────────────── */
@media (max-width: 768px) { .epv-open-grid { grid-template-columns: 1fr; } }
@media (max-width: 480px) {
  .epv-header { padding: 16px; gap: 12px; }
  .epv-header-icon { width: 42px; height: 42px; font-size: 1.1rem; }
  .epv-title { font-size: 1.1rem; }
}

/* ══════════════════════════════════════════════════════════════════
   FULL-WINDOW READER (epv-fw-*)
   Covers entire viewport for immersive reading
   ══════════════════════════════════════════════════════════════════ */
.epv-fullwindow {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 99999; background: #fff;
  display: flex; flex-direction: column;
}

/* ── Toolbar ────────────────────────────────────────────────────── */
.epv-fw-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: #1a1a2e; color: #fff;
  flex-shrink: 0; gap: 12px; flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.epv-fw-toolbar-left,
.epv-fw-toolbar-center,
.epv-fw-toolbar-right { display: flex; align-items: center; gap: 6px; }

.epv-fw-btn {
  width: 36px; height: 36px; border-radius: 8px; border: none;
  background: rgba(255,255,255,.08); color: #e0e0e0; font-size: .9rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.epv-fw-btn:hover { background: rgba(255,255,255,.18); color: #fff; }

.epv-fw-exit {
  width: auto; padding: 0 14px; gap: 6px; background: rgba(239,68,68,.15); color: #fca5a5;
}
.epv-fw-exit:hover { background: rgba(239,68,68,.3); color: #fff; }
.epv-fw-btn-label { font-size: .8rem; font-weight: 600; }

.epv-fw-book-title {
  font-size: .85rem; font-weight: 600; color: #a5b4fc;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-left: 8px;
}

.epv-fw-page-info {
  font-size: .8rem; color: #9ca3af; min-width: 60px; text-align: center;
  font-weight: 600;
}

.epv-fw-zoom-val {
  font-size: .75rem; color: #a5b4fc; font-weight: 700; min-width: 40px; text-align: center;
}

.epv-fw-divider {
  width: 1px; height: 24px; background: rgba(255,255,255,.15); margin: 0 6px;
}

/* Premium button indicator */
.epv-fw-premium-btn { position: relative; }
.epv-fw-premium-btn::after {
  content: '★'; position: absolute; top: 2px; right: 2px;
  font-size: .5rem; color: #f59e0b; line-height: 1;
}

/* ── Reader Viewport ────────────────────────────────────────────── */
.epv-fw-reader {
  flex: 1; overflow: hidden; position: relative; background: #fff;
}
#epv-fw-viewer { width: 100%; height: 100%; }

/* ── Progress Bar ───────────────────────────────────────────────── */
.epv-fw-progress {
  height: 3px; background: rgba(0,0,0,.1); flex-shrink: 0;
}
.epv-fw-progress-fill {
  height: 100%; width: 0%; background: linear-gradient(90deg, #7c3aed, #a78bfa);
  transition: width .3s ease;
}

/* ── Side Panels ────────────────────────────────────────────────── */
.epv-fw-panel {
  position: absolute; top: 56px; left: 0; width: 320px;
  max-height: calc(100vh - 60px); overflow-y: auto;
  background: #fff; border-right: 1px solid #e8eaf0;
  box-shadow: 4px 0 20px rgba(0,0,0,.1); z-index: 100;
  padding: 16px;
}
.epv-fw-panel-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.epv-fw-panel-header h5 { font-size: .95rem; font-weight: 700; margin: 0; color: #1a1a2e; }
.epv-fw-panel-close {
  background: none; border: none; color: #9ca3af; cursor: pointer; font-size: 1rem; padding: 4px;
}
.epv-fw-panel-close:hover { color: #ef4444; }

/* TOC items */
.epv-fw-toc-item {
  padding: 10px 12px; border-bottom: 1px solid #f3f4f6; cursor: pointer;
  font-size: .85rem; color: #374151; display: flex; align-items: center;
  transition: background .15s; border-radius: 6px;
}
.epv-fw-toc-item:hover { background: #f3e8ff; color: #7c3aed; }

/* Search */
.epv-fw-search-row { display: flex; gap: 8px; margin-bottom: 12px; }
.epv-fw-input {
  flex: 1; padding: 9px 12px; border: 1.5px solid #e2e4f0; border-radius: 8px;
  font-size: .85rem; outline: none;
}
.epv-fw-input:focus { border-color: #7c3aed; }
.epv-fw-btn-action {
  padding: 8px 14px; border-radius: 8px; border: none;
  background: #7c3aed; color: #fff; cursor: pointer; font-size: .85rem;
}
.epv-fw-btn-action:hover { background: #6d28d9; }
.epv-fw-search-item {
  padding: 10px; border-bottom: 1px solid #f3f4f6; cursor: pointer;
  font-size: .82rem; color: #4b5563; border-radius: 6px;
}
.epv-fw-search-item:hover { background: #f3e8ff; }
.epv-fw-search-item mark { background: #fde68a; padding: 0 2px; border-radius: 2px; }

/* Bookmarks */
.epv-fw-bm-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; background: #f8f9fc; border: 1px solid #e8eaf0;
  border-radius: 8px; margin-bottom: 8px; cursor: pointer; font-size: .82rem;
}
.epv-fw-bm-item:hover { border-color: #7c3aed; }
.epv-fw-bm-del { background: none; border: none; color: #ef4444; cursor: pointer; font-size: .75rem; opacity: .6; }
.epv-fw-bm-del:hover { opacity: 1; }

/* Theme grid */
.epv-fw-theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.epv-fw-theme-opt {
  padding: 12px; border-radius: 10px; cursor: pointer; font-size: .82rem; font-weight: 600;
  display: flex; align-items: center; gap: 8px; justify-content: center;
  border: 2px solid #ddd; transition: transform .15s, box-shadow .15s;
}
.epv-fw-theme-opt[data-rtheme="light"] { background: #fff; color: #333; }
.epv-fw-theme-opt[data-rtheme="sepia"] { background: #f4ecd8; color: #5b4636; border-color: #d4c5a9; }
.epv-fw-theme-opt[data-rtheme="dark"] { background: #1a1a2e; color: #e0e0e0; border-color: #333; }
.epv-fw-theme-opt[data-rtheme="green"] { background: #1b2e1b; color: #c8e6c9; border-color: #2e7d32; }
.epv-fw-theme-opt:hover { transform: scale(1.03); }
.epv-fw-theme-opt.active { box-shadow: 0 0 0 3px rgba(124,58,237,.4); }

/* Font controls */
.epv-fw-font-controls { display: flex; flex-direction: column; gap: 16px; }
.epv-fw-font-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.epv-fw-font-row label { font-size: .85rem; font-weight: 600; color: #374151; min-width: 80px; }
.epv-fw-select { padding: 8px 12px; border: 1.5px solid #e2e4f0; border-radius: 8px; font-size: .85rem; outline: none; }
.epv-fw-range { width: 100%; accent-color: #7c3aed; }

.epv-fw-empty { text-align: center; color: #9ca3af; font-size: .85rem; padding: 20px; }

/* ── Premium Upsell Overlay ─────────────────────────────────────── */
.epv-fw-premium-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.6); display: flex; align-items: center;
  justify-content: center; z-index: 200;
}
.epv-fw-premium-box {
  background: #fff; border-radius: 20px; padding: 40px 32px;
  max-width: 420px; width: 90%; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.epv-fw-premium-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: #d97706; margin-bottom: 16px;
}
.epv-fw-premium-box h4 { font-size: 1.3rem; font-weight: 800; color: #1a1a2e; margin: 0 0 8px; }
.epv-fw-premium-box p { font-size: .9rem; color: #6b7280; margin-bottom: 20px; }
.epv-fw-premium-pricing { display: flex; gap: 12px; justify-content: center; margin-bottom: 24px; }
.epv-fw-price-card {
  flex: 1; padding: 16px 12px; border: 1.5px solid #e8eaf0;
  border-radius: 12px; text-align: center; position: relative;
}
.epv-fw-price-card.epv-fw-price-popular { border-color: #f59e0b; background: #fffbeb; }
.epv-fw-price-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: #f59e0b; color: #fff; font-size: .65rem; font-weight: 700;
  padding: 2px 8px; border-radius: 10px; white-space: nowrap;
}
.epv-fw-price-label { display: block; font-size: .75rem; color: #9ca3af; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.epv-fw-price-amount { display: block; font-size: 1.2rem; font-weight: 800; color: #1a1a2e; }
.epv-fw-premium-btns { display: flex; flex-direction: column; gap: 10px; }

/* ── epub.js highlight ──────────────────────────────────────────── */
.epv-highlight { background: rgba(253,230,138,.4); border-bottom: 2px solid #f59e0b; }

/* ── Mobile Responsive (full-window) ───────────────────────────── */
@media (max-width: 768px) {
  .epv-fw-toolbar { padding: 6px 10px; }
  .epv-fw-book-title { display: none; }
  .epv-fw-btn { width: 32px; height: 32px; font-size: .8rem; }
  .epv-fw-exit { padding: 0 10px; }
  .epv-fw-btn-label { display: none; }
  .epv-fw-panel { width: 100%; border-right: none; border-bottom: 1px solid #e8eaf0; }
  .epv-fw-premium-pricing { flex-direction: column; }
}

@media (max-width: 480px) {
  .epv-fw-toolbar-center { order: 3; width: 100%; justify-content: center; }
  .epv-fw-divider { display: none; }
  .epv-fw-zoom-val { display: none; }
}
