/* =====================================================
   📚 VIDYA READER — UI PREMIUM (NAV + SIDEBAR + ICONS)
   ===================================================== */

@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@300..800&display=swap");

::-webkit-scrollbar {
  display: none;
}

/* RESET LOCAL */
#epub-reader-overlay * {
  -webkit-tap-highlight-color: transparent;
  outline: none;
  box-sizing: border-box;
  font-family: "Open Sans", sans-serif;
}

/* =====================================================
   🌗 OVERLAY
   ===================================================== */
#epub-reader-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;

  transition: background 0.3s ease, color 0.3s ease;
}

#epub-reader-overlay.theme-light {
  background: #f4f4f4;
  color: #222;
}

#epub-reader-overlay.theme-dark {
  background: #121212;
  color: #eee;
}

/* =====================================================
   🔝 NAVBAR
   ===================================================== */
.reader-toolbar {
  height: 65px;
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 20px;

  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.7);

  animation: fadeDown 0.5s ease;
}

.theme-dark .reader-toolbar {
  background: rgba(18, 18, 18, 0.7);
}

@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reader-toolbar span {
  font-weight: 600;
  color: rgb(255, 127, 36);
}

/* =====================================================
   🔘 BOTÕES
   ===================================================== */
.reader-btn {
  width: 42px;
  height: 42px;

  border-radius: 12px;
  border: none;
  background: transparent;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  transition: all 0.25s ease;
}

.reader-btn:hover {
  background: rgba(255, 127, 36, 0.15);
  transform: scale(1.08);
}

/* SVG ICON */
.reader-btn img {
  width: 22px;
  height: 22px;
  margin: 0;

  filter: brightness(0);
  transition: all 0.3s ease;
}

.theme-dark .reader-btn img {
  filter: brightness(0) invert(1);
}

.reader-btn:hover img {
  transform: scale(1.2);
  filter: invert(56%) sepia(87%) saturate(2250%) hue-rotate(351deg) brightness(101%) contrast(105%);
}

/* =====================================================
   📦 BODY
   ===================================================== */
.reader-body {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* =====================================================
   📚 SIDEBAR
   ===================================================== */
#sidebar {
  position: absolute;
  left: 0;
  top: 0;

  width: 320px;
  height: 100%;

  background: inherit;
  backdrop-filter: blur(20px);

  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);

  z-index: 50;
  padding: 20px;

  overflow-y: auto;
}

#sidebar.active {
  transform: translateX(0);
}

#sidebar ul {
  list-style: none;
  padding: 0;
}

#sidebar li {
  margin-bottom: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#sidebar li:hover {
  background: rgba(255, 127, 36, 0.15);
  color: rgb(255, 127, 36);
  transform: translateX(6px);
}

/* =====================================================
   📖 VIEWER
   ===================================================== */
#viewer {
  flex: 1;
  height: 100%;
  position: relative;
}

#frame {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;

  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* =====================================================
   🎬 MEDIA
   ===================================================== */
img {
  max-width: 100%;
  height: auto;
}

video {
  max-width: 100%;
  height: auto;

  display: block;
  margin: 20px auto;

  border-radius: 12px;
}

/* =====================================================
   📱 RESPONSIVO
   ===================================================== */
@media (max-width: 768px) {
  #sidebar {
    width: 85%;
  }
}


/* =====================================================
   📖 EPUB FALLBACK STYLE (AUTO-READ MODE)
   ===================================================== */

/* ⚠️ Esse bloco é pensado para ser injetado no iframe também */

.epub-content,
#frame body {
  font-family: "Open Sans", sans-serif;
  font-size: clamp(16px, 1.2vw, 20px);
  line-height: 1.8;

  max-width: 900px;
  margin: auto;

  padding: clamp(16px, 5vw, 60px);

  color: inherit;
  background: transparent;

  word-wrap: break-word;
}

/* Títulos */
#frame h1,
#frame h2,
#frame h3,
#frame h4 {
  color: rgb(255, 127, 36);
  margin-bottom: 16px;
  line-height: 1.3;
}

#frame h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}

#frame h2 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
}

#frame h3 {
  font-size: clamp(1.2rem, 2.5vw, 1.4rem);
}

/* Texto */
#frame p {
  margin-bottom: 18px;
  text-align: justify;
}

/* Imagens */
#frame img {
  width: 100%;
  max-width: 100%;
  border-radius: 12px;
  margin: 20px auto;
  display: block;
}

/* Vídeos */
#frame video {
  width: 100%;
  border-radius: 12px;
  margin: 20px 0;
}

/* Listas */
#frame ul,
#frame ol {
  padding-left: 20px;
  margin-bottom: 20px;
}

#frame li {
  margin-bottom: 8px;
}

/* Links */
#frame a {
  color: rgb(255, 127, 36);
  text-decoration: none;
}

#frame a:hover {
  text-decoration: underline;
}

/* Citações */
#frame blockquote {
  border-left: 4px solid rgb(255, 127, 36);
  padding-left: 15px;
  margin: 20px 0;
  opacity: 0.9;
}

/* Separadores */
#frame hr {
  margin: 30px 0;
  opacity: 0.2;
}

/* Tabelas */
#frame table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

#frame td,
#frame th {
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 10px;
}

/* Código */
#frame pre,
#frame code {
  background: rgba(0, 0, 0, 0.05);
  padding: 5px 8px;
  border-radius: 6px;
  font-family: monospace;
}

/* =====================================================
   🌙 DARK MODE EPUB
   ===================================================== */

.theme-dark #frame body {
  background: #121212 !important;
  color: #e8e8e8 !important;
}

.theme-dark #frame a {
  color: rgb(255, 127, 36);
}

.theme-dark #frame blockquote {
  border-color: rgb(255, 127, 36);
}

.theme-dark #frame pre,
.theme-dark #frame code {
  background: rgba(255, 255, 255, 0.08);
}

/* =====================================================
   🔘 NAV BUTTONS — PREMIUM CENTERED
   ===================================================== */

.nav-buttons {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);

  display: flex;
  gap: 14px;

  padding: 8px 12px;
  border-radius: 16px;

  backdrop-filter: blur(14px);
  transition: all 0.3s ease;

  animation: fadeUp 0.5s ease;
}

/* LIGHT */
.theme-light .nav-buttons {
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

/* DARK */
.theme-dark .nav-buttons {
  background: rgba(20, 20, 20, 0.6);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
}

/* BOTÕES */
.nav-buttons button {
  width: 44px;
  height: 44px;

  border-radius: 12px;
  border: none;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;

  transition: all 0.25s ease;
}

/* LIGHT BUTTON */
.theme-light .nav-buttons button {
  background: rgba(0, 0, 0, 0.05);
}

/* DARK BUTTON */
.theme-dark .nav-buttons button {
  background: rgba(255, 255, 255, 0.08);
}

/* =====================================================
   🔥 SVG ICONS (ANIMADOS)
   ===================================================== */

.nav-btn img {
  width: 22px;
  height: 22px;
  margin: 0;

  transition: all 0.3s ease;

  /* padrão (light) */
  filter: brightness(0);
}

/* DARK MODE → ícone branco */
.theme-dark .nav-btn img {
  filter: brightness(0) invert(1);
}

/* HOVER GERAL */
.nav-buttons button:hover {
  transform: translateY(-4px) scale(1.08);
  background: rgba(255, 127, 36, 0.2);
  box-shadow: 0 6px 18px rgba(255, 127, 36, 0.25);
}

/* 👉 ANIMAÇÃO DIREITA */
#next-btn:hover img {
  transform: translateX(5px) scale(1.2);
}

/* 👉 ANIMAÇÃO ESQUERDA */
#prev-btn:hover img {
  transform: translateX(-5px) scale(1.2);
}

/* COR LARANJA NO HOVER */
.nav-buttons button:hover img {
  filter: invert(56%) sepia(87%) saturate(2250%) 
          hue-rotate(351deg) brightness(101%) contrast(105%);
}

/* CLICK */
.nav-buttons button:active {
  transform: scale(0.95);
}

.nav-buttons button:active img {
  transform: scale(0.9);
}

/* ANIMAÇÃO ENTRADA */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* =====================================================
   📱 RESPONSIVO EPUB
   ===================================================== */

@media (max-width: 768px) {
  #frame body {
    padding: 20px;
  }

  #frame h1 {
    font-size: 1.8rem;
  }
}

@media (max-width: 480px) {
  #frame body {
    padding: 16px;
  }
}