/*
Theme Name: Epub Premium (Mundo)
Theme URI: https://epubgratismundo.com/
Description: Tema premium personalizado para descarga de libros (Edición Púrpura).
Author: Antigravity AI
Version: 114
Text Domain: epub-premium
*/

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&family=Prata&display=swap");

:root {
  --bg-paper: #fdfcfb;
  --text-main: #1a1a1a;
  --text-muted: #555;
  --accent: #7d3cff;
  --accent-gold: #d4af37;
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
  width: 100%;
  position: relative;
  -webkit-text-size-adjust: 100%;
}

img {
  max-width: 100%;
  height: auto;
}

/* RESET */
* {
  box-sizing: border-box;
}
body {
  background-color: var(--bg-paper);
  color: var(--text-main);
  font-family: "Inter", sans-serif;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}
a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}
ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* HEADER */
.main-header {
  background: #fff;
  border-bottom: 1px solid #eee;
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 2000;
  position: relative; /* Punto de referencia para el menu movil */
}
.menu-toggle {
  display: none; /* Oculto en escritorio */
}
.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  width: 38px;
  height: 38px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-icon svg {
  width: 24px;
  height: 24px;
  fill: white;
}
.logo-text .top {
  font-weight: 800;
  color: var(--accent);
  font-size: 1.3rem;
  line-height: 1;
  display: block;
}
.logo-text .bottom {
  font-size: 0.65rem;
  color: #777;
  display: block;
}

/* MENU */
.nav-links {
    display: flex;
    align-items: center;
    z-index: 100;
}
.main-menu {
  display: flex;
  gap: 10px;
}
.main-menu a {
  font-weight: 700;
  font-size: 0.84rem;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}
.main-menu li {
  position: relative;
}
.main-menu a:hover {
  color: var(--accent);
  background: #f8fcf9;
}

.main-menu .menu-item-has-children > a::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-top: -3px;
  margin-left: 2px;
  opacity: 0.6;
  transition: transform 0.3s ease;
}
.main-menu .menu-item-has-children:hover > a::after {
  transform: rotate(225deg);
  margin-top: 3px;
}

.main-menu .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  min-width: 220px;
  padding: 12px 0;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  border-radius: 14px;
  border: 1px solid #eee;
  z-index: 5000;
}
.main-menu li:hover > .sub-menu {
  display: block;
  animation: fadeInMenu 0.3s ease forwards;
}

@keyframes fadeInMenu {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.main-menu .sub-menu a {
  padding: 12px 20px;
  text-transform: none;
  font-weight: 500;
  font-size: 0.85rem;
  color: #555;
}
.main-menu .sub-menu a:hover {
  background: #f1f8f4;
  color: var(--accent);
  border-radius: 8px;
}

/* GRID HOME */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 30px;
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
}
.book-card {
  transition: var(--transition);
  text-align: center;
  display: flex;
  flex-direction: column;
}
.cover-wrapper-grid {
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
  background: #eee;
  aspect-ratio: 2/3;
}
.cover-wrapper-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.book-card:hover .cover-wrapper-grid {
  transform: translateY(-8px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

/* SINGLE BOOK PAGE */
.book-single {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-areas:
    "info info"
    "cover synopsis";
  gap: 50px;
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
  width: 100%;
}

.book-info-top {
  grid-area: info;
  min-width: 0; /* Permite que el grid-item se encoja correctamente */
}
.sticky-cover {
  grid-area: cover;
  position: sticky;
  top: 100px;
  height: fit-content;
  min-width: 0;
}
.book-synopsis {
  grid-area: synopsis;
  min-width: 0;
}

.cover-img {
  width: 100%;
  aspect-ratio: 2 / 3; /* Proporcion estandar de portada de libro */
  object-fit: cover; /* Recorta en lugar de estirar */
  object-position: center top; /* Alinea hacia arriba para no cortar la cara */
  border-radius: 15px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.18);
  display: block;
}

/* SIDEBAR DESCARGA */
.download-sidebar {
  background: #fff;
  padding: 25px;
  border-radius: 15px;
  border: 1px solid #eee;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  margin-top: 30px;
}

.synopsis-wrapper {
  background: #fff;
  border-radius: 20px;
  border: 1px solid #eee;
  margin: 30px 0;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.02);
}

.synopsis-content {
  color: #333;
  line-height: 1.9;
  font-size: 1.1rem;
  text-align: justify;
  padding: 0 40px 40px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table td {
  padding: 10px 0;
  border-bottom: 1px dashed #eee;
  font-size: 0.9rem;
}
.data-table tr:last-child td {
  border-bottom: none;
}

/* TAGS */
.book-tag {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #f0f0f0;
  margin-right: 12px;
  margin-bottom: 10px;
  transition: var(--transition);
}
.book-tag:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}
.tag-romantica {
  background: #fee2e2;
  color: #991b1b;
}
.tag-fantastica {
  background: #e0e7ff;
  color: #3730a3;
}
.tag-terror {
  background: #1a1a1a;
  color: #fff;
}
.tag-erotica {
  background: #ffedfa;
  color: #9d174d;
}
.tag-year {
  background: #fef3c7;
  color: #92400e;
}
.tag-default {
  background: #f3f4f6;
  color: #374151;
}

/* TAGS ROW */
.tags-row {
  margin-top: 20px;
  margin-bottom: 25px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

/* FOOTER */
.site-footer {
  background: #1a1a1a;
  padding: 60px 20px;
  color: #aaa;
  margin-top: 60px;
  text-align: center;
}

/* RESPONSIVE */

/* Tablet (Landscape e Portrait grande) */
@media (max-width: 1024px) {
  .book-single {
    grid-template-columns: 280px 1fr;
    gap: 30px;
  }
}

/* Tablet Portrait e Mobile Landscape */
@media (max-width: 900px) {
  .book-single {
    grid-template-columns: 1fr;
    grid-template-areas:
      "info"
      "cover"
      "synopsis";
    gap: 30px;
  }
  .sticky-cover {
    position: static;
    max-width: 400px;
    margin: 0 auto;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
    font-size: 2.2rem;
    line-height: 1;
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    padding: 5px;
    z-index: 10001;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    flex-direction: column;
    padding: 0 !important;
    border-top: 1px solid #eee;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    z-index: 99999;
    max-height: 85vh;
    overflow-y: auto;
    text-align: left;
  }
  .nav-links.active {
    display: flex !important;
  }
  .main-menu {
    flex-direction: column;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .main-menu li {
    width: 100%;
    list-style: none;
    position: relative;
  }
  .main-menu a {
    width: 100%;
    padding: 15px 25px !important;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    border-radius: 0;
    border-bottom: 1px solid #f5f5f5;
    box-sizing: border-box !important;
  }
  /* Forzar limpieza de estilos de escritorio en submenús */
  .main-menu .sub-menu {
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #f9f9f9 !important;
    box-shadow: none !important;
    border: none !important;
    display: none;
  }
  .main-menu .sub-menu li a {
    padding-left: 45px !important;
    font-size: 0.9rem;
    color: #666;
    background: transparent !important;
  }
  .main-menu .open-submenu > .sub-menu {
    display: block !important;
  }

  .book-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .book-single {
    margin: 20px auto;
    gap: 20px;
  }
  .synopsis-wrapper {
    padding: 25px !important;
  }

  /* Ajustes críticos para títulos móviles */
  .book-title-main {
    font-size: clamp(1.4rem, 6vw, 2rem) !important;
    line-height: 1.2 !important;
    margin-bottom: 15px !important;
    font-family: "Prata", serif;
    font-weight: 800;
    display: block;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
  }

  .breadcrumbs {
    font-size: 0.75rem;
    margin-bottom: 10px;
  }
  .tags-row {
    margin-bottom: 15px !important;
  }
  .book-tag {
    padding: 4px 10px;
    font-size: 0.7rem;
    margin-right: 8px;
  }

  .download-sidebar {
    padding: 15px !important;
  }
  .synopsis-content {
    padding: 0 15px 15px !important;
    font-size: 1rem !important;
  }
}

@media (max-width: 480px) {
  .logo-text .top {
    font-size: 1.1rem;
  }
  .logo-text .bottom {
    font-size: 0.6rem;
  }

  .book-title-main {
    font-size: 1.35rem !important;
  }
}

/* ── Telegram Footer CTA — estilos globales (desktop + móvil) ── */
.site-footer .telegram-footer-cta {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  background: linear-gradient(135deg, #0088cc 0%, #00a8e8 100%) !important;
  color: #fff !important;
  text-decoration: none !important;
  padding: 14px 18px !important;
  border-radius: 12px !important;
  font-size: 1rem !important;
  font-weight: 800 !important;
  font-family: "Inter", sans-serif !important;
  box-shadow: 0 6px 18px rgba(0,136,204,0.28) !important;
  max-width: 560px !important;
  width: auto !important;
  height: auto !important;
  position: static !important;
  margin: 0 auto !important;
  opacity: 1 !important;
  visibility: visible !important;
  box-sizing: border-box !important;
  transition: transform .2s ease, box-shadow .2s ease;
}

.site-footer .telegram-footer-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0,136,204,0.32) !important;
}

.site-footer .telegram-footer-cta__icon {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 auto !important;
}

.site-footer .telegram-footer-cta__icon svg,
.site-footer .telegram-footer-cta svg {
  width: 22px !important;
  height: 22px !important;
  display: block !important;
  flex: 0 0 auto !important;
}

.site-footer .telegram-footer-cta__text {
  line-height: 1.15;
}

/* ── Telegram Footer CTA — overrides móvil ── */
@media (max-width: 480px) {
  .site-footer .telegram-footer-cta {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    width: calc(100% - 16px) !important;
    max-width: 560px !important;
    margin: 0 auto !important;
    padding: 12px 20px 12px 14px !important;
    border-radius: 12px !important;
    font-size: 0.95rem !important;
    gap: 10px !important;
  }
  .site-footer .telegram-footer-cta__text {
    padding-right: 4px;
  }
}

/* Global box-sizing para el buscador */
.hero-search-form-box * { box-sizing: border-box; }
  /* Evitar desbordamiento por botones y rellenos */
  .hero-search-form-box {
    padding: 4px 4px 4px 15px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .hero-search-btn {
    padding: 10px 18px !important;
    font-size: 0.85rem !important;
    height: auto !important;
  }

  .hero-search-input {
    font-size: 0.9rem !important;
    padding: 10px 5px !important;
    min-width: 0 !important;
  }

  .download-sidebar {
    padding: 15px !important;
  }

  .download-sidebar button {
    height: 52px !important;
    padding: 0 12px !important;
    gap: 8px !important;
  }

  .download-sidebar button span {
    font-size: 0.75rem !important;
  }

  /* Ajustes de footer y botones flotantes */
  #btn-top,
  #btn-telegram-float {
    width: 44px !important;
    height: 44px !important;
    bottom: 15px !important;
  }
  #btn-top {
    right: 15px !important;
  }
  #btn-telegram-float {
    left: 15px !important;
  }


/* COMENTARIOS */
.comments-area {
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--card-shadow);
  margin-top: 40px;
  border: 1px solid #f0f0f0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
@media (max-width: 768px) {
  .comments-area {
    padding: 20px;
  }
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100% !important;
  max-width: 100% !important;
  padding: 12px 15px !important;
  border: 1px solid #e2e2e2 !important;
  border-radius: 12px !important;
  font-family: "Inter", sans-serif !important;
  box-sizing: border-box !important;
  font-size: 1rem !important;
  margin-bottom: 15px !important;
  display: block !important;
  background: #fff !important;
  overflow: hidden !important;
}
#submit {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 14px 35px;
  border-radius: 50px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
#submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(39, 174, 96, 0.3);
}

/* Telegram CTA Button - New Design v100 */
.telegram-footer-container {
  text-align: center;
  margin-bottom: 35px;
  padding: 0 15px;
}

.telegram-cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  background: linear-gradient(135deg, #0088cc 0%, #00a8e8 100%);
  color: #fff !important;
  text-decoration: none;
  padding: 18px 40px;
  border-radius: 16px;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: 0 8px 30px rgba(0, 136, 204, 0.4);
  transition: all 0.3s ease;
  max-width: 100%;
  box-sizing: border-box;
}

.telegram-cta-button svg {
  flex-shrink: 0;
}

.telegram-cta-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(0, 136, 204, 0.5);
}

@media (max-width: 768px) {
  .telegram-footer-container {
    padding: 0 20px;
  }
  .telegram-cta-button {
    flex-direction: column !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 22px 20px !important;
    gap: 10px !important;
    box-sizing: border-box !important;
    font-size: 1rem !important;
  }
  .telegram-cta-button span {
    line-height: 1.4 !important;
  }
}
