/**
 * LIBROS CON VIDA - CSS Personalizado
 * DEBE cargarse DESPUÉS de Bootstrap
 */

:root {
    --color-verde: #43A047;
    --color-verde-oscuro: #2E7D32;
    --color-oscuro: #1a1a2e;
    --color-gris: #6c757d;
    --color-gris-claro: #f8f9fa;
    --shadow-soft: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-medium: 0 5px 20px rgba(0,0,0,0.15);
    --shadow-strong: 0 10px 40px rgba(0,0,0,0.2);
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

* { box-sizing: border-box; }

body {
    font-family: var(--fuente-cuerpo, 'Open Sans', sans-serif);
    color: var(--color-texto, #333333);
    background-color: var(--color-fondo, #FFFFFF);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--fuente-titulos, 'Montserrat', sans-serif);
    font-weight: 700;
}

a { color: var(--color-acento, #E63946); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--color-verde); }

/* ================================================
   BOTÓN HAMBURGUESA - SIEMPRE VISIBLE
   ================================================ */
.btn-hamburguesa {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 10000; /* Muy alto para estar siempre visible */
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #FFB629;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.4);
    transition: all var(--transition-normal);
    cursor: pointer;
}
.btn-hamburguesa:hover { background-color: #e6a224; transform: scale(1.05); }
.btn-hamburguesa:focus { outline: none; box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(255, 182, 41, 0.4); }

/* ================================================
   BOTÓN VOLVER FLOTANTE (páginas internas)
   ================================================ */
.btn-volver-flotante {
    position: fixed;
    top: 75px;
    left: 15px;
    z-index: 9998;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--color-acento, #E63946);
    border: none;
    color: #fff;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    animation: pulso-suave 2.5s ease-in-out infinite;
}
.btn-volver-flotante:hover {
    background-color: #c62828;
    transform: scale(1.05);
    animation: none;
}
.btn-volver-flotante:focus {
    outline: none;
    box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(230, 57, 70, 0.4);
}

/* Animación de pulso suave */
@keyframes pulso-suave {
    0%, 100% {
        transform: scale(1);
        box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.4);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 4px 4px 18px rgba(230, 57, 70, 0.5);
    }
}

/* Responsive - Botón volver */
@media (max-width: 767.98px) {
    .btn-volver-flotante {
        top: 75px; /* Misma altura que botón búsqueda */
        left: 15px; /* Mismo margen que el derecho */
    }
}

/* ================================================
   BOTÓN BÚSQUEDA FLOTANTE
   ================================================ */
.busqueda-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 9997;
    pointer-events: none;
    transition: background 0.3s ease;
}
.busqueda-overlay.activo {
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.btn-busqueda-flotante {
    position: fixed;
    top: 75px; /* Debajo del hamburguesa (15px + 50px + 10px) */
    right: 15px;
    z-index: 9999; /* Alto para estar siempre visible */
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
}

.btn-busqueda-circulo {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    background-color: #FFB629;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.4);
    transition: all var(--transition-normal);
    cursor: pointer;
}
.btn-busqueda-circulo:hover { background-color: #e6a224; transform: scale(1.05); }
.btn-busqueda-circulo:focus { outline: none; box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(255, 182, 41, 0.4); }

.busqueda-flotante-form {
    display: flex;
    align-items: center;
    overflow: hidden;
    width: 0;
    opacity: 0;
    transition: width 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-right: 0;
}

.busqueda-flotante-input {
    width: 100%;
    height: 46px;
    padding: 10px 18px;
    border: 2px solid #FFB629;
    border-radius: 25px;
    font-size: 0.95rem;
    outline: none;
    background: #fff;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
}
.busqueda-flotante-input:focus {
    border-color: #e6a224;
    box-shadow: 2px 2px 12px rgba(0, 0, 0, 0.25);
}
.busqueda-flotante-input::placeholder {
    color: #888;
    font-size: 0.85rem;
}

/* Estado expandido - ancho máximo según viewport */
.btn-busqueda-flotante.expandido .busqueda-flotante-form {
    width: calc(100vw - 95px); /* 100vw - margen izq(15) - espacio(10) - botón(50) - posición botón(15) - extra(5) */
    opacity: 1;
    margin-right: 10px;
}

/* Limitar ancho máximo en pantallas grandes */
@media (min-width: 576px) {
    .btn-busqueda-flotante.expandido .busqueda-flotante-form {
        width: calc(100vw - 95px);
        max-width: 500px;
    }
}

@media (min-width: 768px) {
    .btn-busqueda-flotante.expandido .busqueda-flotante-form {
        max-width: 550px;
    }
}

@media (min-width: 992px) {
    .btn-busqueda-flotante.expandido .busqueda-flotante-form {
        max-width: 600px;
    }
}

/* ================================================
   HEADER - SE OCULTA AL SCROLL
   ================================================ */
.header-main {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-soft);
    z-index: 1000;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.header-main.header-hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}
.header-content { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.header-logo { text-decoration: none; display: flex; align-items: center; }
.header-logo img { height: auto; max-height: 45px; }
.logo-text { font-family: var(--fuente-titulos); font-size: 1.5rem; font-weight: 700; color: var(--color-acento, #E63946); }

/* ================================================
   MENÚ OFFCANVAS
   ================================================ */
.menu-offcanvas { background-color: var(--color-oscuro); width: 300px !important; max-width: 85vw; }
.menu-offcanvas .offcanvas-header { border-bottom: 1px solid rgba(255,255,255,0.1); }
.menu-offcanvas .offcanvas-title { color: #fff; font-family: var(--fuente-titulos); font-weight: 600; }
.menu-offcanvas .offcanvas-body { padding-top: 20px; }
.menu-search .form-control { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: #fff; border-radius: 8px 0 0 8px; }
.menu-search .form-control::placeholder { color: rgba(255,255,255,0.5); }
.menu-search .form-control:focus { background: rgba(255,255,255,0.15); border-color: var(--color-verde); box-shadow: none; }
.menu-search .btn { border-radius: 0 8px 8px 0; }
.menu-nav .nav-link { color: rgba(255,255,255,0.85); padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,0.08); transition: all var(--transition-fast); font-size: 0.95rem; }
.menu-nav .nav-link:hover { color: var(--color-verde); padding-left: 8px; }
.menu-nav .nav-link i { width: 24px; text-align: center; }

/* Chips de géneros en el menú */
.generos-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 10px 15px 10px;
    max-height: 280px;
    overflow-y: auto;
}
.generos-chips-container::-webkit-scrollbar {
    width: 4px;
}
.generos-chips-container::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}
.generos-chips-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}
.genero-chip {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.9);
    border-radius: 20px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all var(--transition-fast);
    border: 1px solid rgba(255,255,255,0.15);
}
.genero-chip:hover {
    background: var(--color-verde);
    color: #fff;
    border-color: var(--color-verde);
    transform: translateY(-1px);
}

/* ================================================
   CONTENIDO PRINCIPAL
   ================================================ */
.main-content { 
    min-height: calc(100vh - 200px); 
}

/* Cuando NO hay hero, añadir espacio para el header */
.main-content.sin-hero {
    padding-top: 65px;
}

/* ================================================
   HERO SECTION - VIDEO DETRÁS DEL HEADER
   ================================================ */
.hero-section {
    position: relative;
    width: 100%;
    min-height: 100vh;
    background: var(--color-oscuro);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-top: 0;
    padding-top: 0;
}

.hero-media-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.hero-video,
.hero-imagen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ====== MÓVIL (default): Solo video VERTICAL visible ====== */
.hero-video-vertical,
.hero-imagen-vertical {
    display: block;
    z-index: 2;
}

.hero-video-horizontal,
.hero-imagen-horizontal {
    display: none;
    z-index: 1;
}

/* ====== DESKTOP (768px+): Solo video HORIZONTAL visible ====== */
@media screen and (min-width: 768px) {
    .hero-video-vertical,
    .hero-imagen-vertical {
        display: none;
    }
    
    .hero-video-horizontal,
    .hero-imagen-horizontal {
        display: block;
    }
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    pointer-events: none;
}
.hero-overlay > * { pointer-events: auto; }
.hero-texto-caja { box-sizing: border-box; }
.hero-texto-contenido { line-height: 1.5; }
.hero-boton { transition: all var(--transition-fast); }
.hero-boton:hover { filter: brightness(1.1); transform: scale(1.02); }
.hero-link-full { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 5; }

/* ================================================
   SECCIONES
   ================================================ */
.section-title { 
    font-size: 1.8rem; 
    margin-bottom: 0.5rem; 
    position: relative; 
    display: inline-block; 
}
.section-title::after { 
    content: ''; 
    position: absolute; 
    bottom: -8px; 
    left: 0; 
    width: 50px; 
    height: 3px; 
    background: var(--color-acento, #E63946); 
    border-radius: 2px; 
}

/* ================================================
   TARJETAS DE LIBRO
   ================================================ */

/* Centrar los libros en el grid cuando no llenan la fila */
.row.libros-grid {
    justify-content: center;
}

/* En pantallas muy grandes, aumentar el ancho máximo para fichas más grandes */
@media (min-width: 1400px) {
    .libros-container {
        max-width: 95%;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (min-width: 1600px) {
    .libros-container {
        max-width: 92%;
    }
}

@media (min-width: 1900px) {
    .libros-container {
        max-width: 1850px;
    }
}

.libro-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: all var(--transition-normal);
    height: 100%;
}
.libro-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-strong);
}
.libro-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}
.libro-link:hover { color: inherit; }

.libro-media {
    position: relative;
    aspect-ratio: 9 / 14;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
    overflow: hidden;
}

.libro-video,
.libro-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Video encima del poster - siempre visible */
.libro-video { z-index: 2; }
.libro-poster { z-index: 1; }

.libro-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 10px;
}

.btn-libro {
    padding: 8px 12px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

/* Botones más pequeños en notebook (4 columnas, 992px-1199px) */
@media (min-width: 992px) {
    .btn-libro {
        padding: 4px 7px;
        font-size: 0.55rem;
        border-radius: 5px;
    }
    .btn-libro i {
        font-size: 0.6rem;
    }
}

/* Botones más pequeños en desktop (6 columnas, 1200px+) */
@media (min-width: 1200px) {
    .btn-libro {
        padding: 5px 8px;
        font-size: 0.6rem;
    }
    .btn-libro i {
        font-size: 0.65rem;
    }
}

/* Botones aún más pequeños en pantallas muy grandes */
@media (min-width: 1400px) {
    .btn-libro {
        padding: 4px 7px;
        font-size: 0.55rem;
    }
}

.btn-escuchar { background: var(--color-verde); color: #fff; }
.btn-escuchar:hover { background: var(--color-verde-oscuro); }
.btn-escuchar.speaking { background: var(--color-acento, #E63946); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
.btn-infografia { background: rgba(255,255,255,0.95); color: #333; }
.btn-infografia:hover { background: #fff; transform: scale(1.05); }

.libro-info { padding: 16px; }
.libro-titulo {
    font-size: var(--ficha-titulo-tamano, 1.05rem);
    font-weight: 700;
    margin-bottom: 4px;
    color: #333;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.libro-autor { 
    font-size: var(--ficha-autor-tamano, 0.9rem); 
    color: var(--color-gris); 
    margin-bottom: 10px; 
}
.libro-generos { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.badge-genero { 
    background: var(--color-gris-claro); 
    color: #555; 
    padding: 4px 10px; 
    border-radius: 20px; 
    font-size: var(--ficha-generos-tamano, 0.7rem); 
    font-weight: 500; 
}
.libro-sinopsis {
    font-size: var(--ficha-sinopsis-tamano, 0.85rem);
    color: #666;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Textos más pequeños en notebook (4 columnas, 992px-1199px) */
@media (min-width: 992px) {
    .libro-info {
        padding: 14px;
    }
    .libro-titulo {
        font-size: 0.95rem;
        margin-bottom: 3px;
    }
    .libro-autor {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
    .libro-generos {
        gap: 5px;
        margin-bottom: 8px;
    }
    .badge-genero {
        padding: 3px 8px;
        font-size: 0.65rem;
    }
    .libro-sinopsis {
        font-size: 0.8rem;
        line-height: 1.4;
    }
}

/* Textos más pequeños en desktop (6 columnas, 1200px+) */
@media (min-width: 1200px) {
    .libro-info {
        padding: 12px;
    }
    .libro-titulo {
        font-size: 0.9rem;
    }
    .libro-autor {
        font-size: 0.8rem;
    }
    .libro-generos {
        gap: 4px;
    }
    .badge-genero {
        padding: 3px 7px;
        font-size: 0.6rem;
    }
    .libro-sinopsis {
        font-size: 0.75rem;
        -webkit-line-clamp: 2;
    }
}

/* Textos aún más compactos en pantallas muy grandes */
@media (min-width: 1400px) {
    .libro-info {
        padding: 10px;
    }
    .libro-titulo {
        font-size: 0.85rem;
    }
    .libro-autor {
        font-size: 0.75rem;
    }
    .badge-genero {
        padding: 2px 6px;
        font-size: 0.55rem;
    }
    .libro-sinopsis {
        font-size: 0.7rem;
    }
}

/* ================================================
   NEWSLETTER
   ================================================ */
.newsletter-section {
    background: linear-gradient(135deg, var(--color-acento, #E63946) 0%, #c62828 100%);
    padding: 60px 20px;
    color: #fff;
}
.newsletter-section h2 { color: #fff; }
.newsletter-section .form-control { border: none; padding: 14px 18px; border-radius: 8px 0 0 8px; font-size: 1rem; }
.newsletter-section .btn { padding: 14px 28px; border-radius: 0 8px 8px 0; font-weight: 600; }
.newsletter-section .form-check-label { font-size: 0.85rem; }
.newsletter-section .form-check-label a { color: #fff; text-decoration: underline; }

/* Mensajes de respuesta del newsletter */
.newsletter-mensaje {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    text-align: center;
}
.newsletter-exito {
    background-color: rgba(255, 255, 255, 0.95);
    color: #2E7D32;
}
.newsletter-error {
    background-color: rgba(255, 255, 255, 0.95);
    color: #c62828;
}

/* ================================================
   FOOTER
   ================================================ */
.footer-main { background: var(--color-oscuro); color: #fff; padding: 50px 0 30px; margin-top: 60px; }
.footer-logo { max-height: 50px; width: auto; }
.footer-logo-text { color: var(--color-acento, #E63946); font-family: var(--fuente-titulos); font-weight: 700; font-size: 1.3rem; }
.footer-descripcion { color: rgba(255,255,255,0.7); font-size: 0.95rem; line-height: 1.6; }
.footer-titulo { color: #fff; font-weight: 600; margin-bottom: 18px; font-size: 1rem; }
.footer-link { color: rgba(255,255,255,0.7); transition: color var(--transition-fast); display: inline-flex; align-items: center; }
.footer-link:hover { color: var(--color-acento); }
.footer-link-legal { color: rgba(255,255,255,0.5); font-size: 0.85rem; }
.footer-link-legal:hover { color: #fff; }
.footer-social { display: flex; flex-wrap: wrap; gap: 12px; }
.social-link { width: 45px; height: 45px; border-radius: 50%; background: rgba(255,255,255,0.1); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; transition: all var(--transition-normal); }
.social-link:hover { background: var(--color-acento, #E63946); color: #fff; transform: translateY(-4px); }
.footer-divider { border-color: rgba(255,255,255,0.1); margin: 30px 0; }
.footer-copyright { text-align: center; color: rgba(255,255,255,0.5); font-size: 0.9rem; }

/* ================================================
   SELECTOR DE ORDEN
   ================================================ */
.selector-orden .dropdown-toggle { background: #fff; border: 1px solid #dee2e6; color: #333; padding: 8px 16px; border-radius: 8px; font-size: 0.9rem; }
.selector-orden .dropdown-toggle:hover { background: var(--color-gris-claro); border-color: var(--color-acento); }
.selector-orden .dropdown-menu { border-radius: 10px; box-shadow: var(--shadow-medium); border: none; padding: 8px; }
.selector-orden .dropdown-item { border-radius: 6px; padding: 10px 16px; font-size: 0.9rem; }
.selector-orden .dropdown-item:hover { background: var(--color-gris-claro); }
.selector-orden .dropdown-item.active { background: var(--color-acento); color: #fff; }

/* ================================================
   PAGINACIÓN
   ================================================ */
.pagination { gap: 5px; }
.pagination .page-link { border-radius: 8px; border: none; color: #333; padding: 10px 16px; font-weight: 500; background: var(--color-gris-claro); transition: all var(--transition-fast); }
.pagination .page-link:hover { background: var(--color-acento); color: #fff; }
.pagination .page-item.active .page-link { background: var(--color-acento); color: #fff; }
.pagination .page-item.disabled .page-link { background: transparent; color: #aaa; }

/* ================================================
   BLOQUES DE CONTENIDO
   ================================================ */
.bloque-contenido { margin: 20px 0; }
.bloque-contenido img { max-width: 100%; height: auto; }

/* ================================================
   RESPONSIVE - MÓVIL (1 columna)
   ================================================ */
@media screen and (max-width: 767.98px) {
    .hero-section { 
        min-height: 100vh; 
    }
    
    .hero-texto-caja { 
        max-width: 95% !important; 
        font-size: 0.9em; 
    }
    
    .section-title { 
        font-size: 1.4rem; 
    }
    
    .btn-libro { 
        padding: 10px 14px;
        font-size: 0.75rem;
    }
    
    .footer-social { 
        justify-content: center; 
    }
}

/* ================================================
   FRANJA DEGRADADA BAJO LOGO FLOTANTE
   ================================================ */
.franja-logo-flotante {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 80px;
    z-index: 997; /* Debajo del logo flotante (998) pero encima del contenido */
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.5) 0%,
        rgba(0, 0, 0, 0.25) 50%,
        transparent 100%
    );
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.franja-logo-flotante.visible {
    opacity: 1;
    visibility: visible;
}

/* Ajuste de altura responsive */
@media (max-width: 768px) {
    .franja-logo-flotante {
        height: 70px; /* Más compacta en móvil */
    }
}

@media (min-width: 769px) {
    .franja-logo-flotante {
        height: 90px; /* Un poco más en desktop */
    }
}

/* ================================================
   LOGO FLOTANTE AL HACER SCROLL
   ================================================ */
.logo-flotante-scroll {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 998; /* Debajo del hamburguesa (999) y búsqueda (999) */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.logo-flotante-scroll.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.logo-flotante-scroll a {
    display: block;
    line-height: 0;
}

.logo-flotante-scroll img {
    display: block;
    width: auto;
}

/* Responsive - Logo flotante */
@media (max-width: 768px) {
    .logo-flotante-scroll {
        top: 15px;
        left: 15px;
    }
}

@media (min-width: 769px) {
    .logo-flotante-scroll {
        top: 25px;
        left: 25px;
    }
}

/* ================================================
   PÁGINA DETALLE DEL LIBRO
   ================================================ */

/* Infografía horizontal (solo desktop) */
.infografia-horizontal {
    margin-bottom: 2rem;
}

.infografia-horizontal img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 0;
}

/* Infografía vertical (móvil) */
.infografia-vertical img,
.poster-destacado img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Header del libro (título, autor, géneros) */
.libro-header {
    border-bottom: 2px solid rgba(0,0,0,0.08);
    padding-bottom: 1.5rem;
}

.libro-titulo-detalle {
    font-family: var(--fuente-titulos);
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-texto);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.libro-autor-detalle {
    font-size: 1.25rem;
    color: var(--color-gris);
    margin-bottom: 0;
    font-weight: 500;
}

.libro-generos-detalle {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.badge-genero-detalle {
    display: inline-block;
    padding: 6px 16px;
    background: var(--color-acento);
    color: #fff;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.badge-genero-detalle:hover {
    background: var(--color-verde);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Sinopsis */
.libro-sinopsis-seccion {
    background: var(--color-gris-claro);
    padding: 1.5rem;
    border-radius: 8px;
}

.sinopsis-titulo {
    font-family: var(--fuente-titulos);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-texto);
}

.libro-sinopsis-texto {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-texto);
}

.libro-sinopsis-texto p {
    margin-bottom: 1rem;
}

.libro-sinopsis-texto p:last-child {
    margin-bottom: 0;
}

/* Botón de audio */
.btn-audio-detalle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 8px 16px;
    background: var(--color-verde);
    color: #fff;
    border: none;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(67, 160, 71, 0.3);
}

.btn-audio-detalle:hover {
    background: var(--color-verde-oscuro);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(67, 160, 71, 0.4);
}

.btn-audio-detalle:active {
    transform: translateY(0);
}

.btn-audio-detalle.playing {
    background: var(--color-acento);
    animation: pulse-audio 1.5s ease-in-out infinite;
}

@keyframes pulse-audio {
    0%, 100% { box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3); }
    50% { box-shadow: 0 4px 16px rgba(230, 57, 70, 0.6); }
}

/* Video del libro */
.libro-video-detalle {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    background: #000;
}

.libro-video-desktop {
    position: sticky;
    top: 85px;
}

/* Compartir en RRSS */
.compartir-seccion,
.compartir-seccion-desktop {
    padding: 1.5rem;
    background: var(--color-gris-claro);
    border-radius: 8px;
}

.compartir-titulo {
    font-family: var(--fuente-titulos);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-texto);
    margin-bottom: 1rem;
}

.compartir-botones {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

/* Móvil: 3 botones por fila, centrados */
@media (max-width: 767.98px) {
    .compartir-seccion {
        text-align: center;
    }
    
    .compartir-botones {
        gap: 15px;
        max-width: 240px;
        margin: 0 auto;
    }
    
    .btn-compartir {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}

.btn-compartir {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    font-size: 1.3rem;
    color: #fff;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn-compartir:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.btn-compartir:active {
    transform: translateY(-1px);
}

.btn-whatsapp { background: #25D366; }
.btn-whatsapp:hover { background: #1EBE57; }

.btn-facebook { background: #1877F2; }
.btn-facebook:hover { background: #0D65D9; }

.btn-twitter { background: #000000; }
.btn-twitter:hover { background: #333333; }

.btn-instagram { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.btn-instagram:hover { background: linear-gradient(45deg, #e08322 0%, #d5572b 25%, #cb1632 50%, #bb1255 75%, #ab0777 100%); }

.btn-email { background: var(--color-gris); }
.btn-email:hover { background: #5a6268; }

.btn-copiar { background: var(--color-verde); }
.btn-copiar:hover { background: var(--color-verde-oscuro); }

.btn-copiar.copiado {
    background: var(--color-acento);
    animation: pulse-copiar 0.6s ease;
}

@keyframes pulse-copiar {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Botones de compra */
.botones-compra-seccion {
    padding: 1.5rem;
    background: #fff;
    border: 2px solid var(--color-gris-claro);
    border-radius: 8px;
}

.botones-compra-titulo {
    font-family: var(--fuente-titulos);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-texto);
    margin-bottom: 1rem;
}

.botones-compra-lista {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.boton-compra {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: var(--color-acento);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.boton-compra:hover {
    background: var(--color-verde);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.boton-compra:active {
    transform: translateY(0);
}

.boton-compra .boton-icono {
    width: 24px;
    height: 24px;
}

.boton-compra .boton-icono-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Tamaños de botones */
.boton-compra-small {
    padding: 10px 18px;
    font-size: 0.875rem;
}

.boton-compra-small .boton-icono,
.boton-compra-small .boton-icono-img {
    width: 20px;
    height: 20px;
}

.boton-compra-medium {
    padding: 14px 24px;
    font-size: 1rem;
}

.boton-compra-large {
    padding: 18px 32px;
    font-size: 1.125rem;
}

.boton-compra-large .boton-icono,
.boton-compra-large .boton-icono-img {
    width: 28px;
    height: 28px;
}

/* Plantilla tienda (colores específicos) */
.boton-plantilla-tienda {
    background: #fff;
    color: #333;
    border: 2px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    min-height: 50px;
}

.boton-plantilla-tienda:hover {
    background: var(--color-gris-claro);
    color: #333;
    border-color: var(--color-gris);
}

/* Logo de tienda (imagen) */
.boton-logo-tienda {
    max-width: 100%;
    max-height: 32px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.boton-compra-small .boton-logo-tienda {
    max-height: 26px;
}

.boton-compra-large .boton-logo-tienda {
    max-height: 38px;
}

/* Texto solo (cuando no hay logo) */
.boton-texto-solo {
    font-weight: 600;
    font-size: inherit;
}

/* Libros relacionados - Reutiliza estilos de libro-card */

/* Responsive - Detalle del libro */
@media (max-width: 991px) {
    .libro-titulo-detalle {
        font-size: 1.75rem;
    }
    
    .libro-autor-detalle {
        font-size: 1.1rem;
    }
}

@media (min-width: 992px) {
    .botones-compra-lista {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .boton-compra {
        flex: 1;
        min-width: 200px;
    }
    
    .compartir-seccion-desktop {
        padding: 2rem;
    }
    
    .compartir-botones {
        gap: 16px;
    }
    
    .btn-compartir {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
}

/* Bloques de contenido personalizados */
.bloque-contenido {
    padding: 1rem;
    background: rgba(0,0,0,0.02);
    border-radius: 8px;
}

.bloque-contenido:empty {
    display: none;
}

.bloque-contenido > *:last-child {
    margin-bottom: 0;
}

/* ================================================
   MODAL COMPARTIR POR EMAIL
   ================================================ */

.modal-email-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-email-overlay.activo {
    display: flex;
}

.modal-email-container {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalEntrar 0.3s ease;
}

@keyframes modalEntrar {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-email-cerrar {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1;
}

.modal-email-cerrar:hover {
    background: var(--color-acento);
    color: #fff;
}

.modal-email-header {
    text-align: center;
    padding: 30px 30px 20px;
    background: linear-gradient(135deg, var(--color-acento) 0%, #c62828 100%);
    color: #fff;
    border-radius: 16px 16px 0 0;
}

.modal-email-header i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: block;
}

.modal-email-header h3 {
    margin: 0 0 5px;
    font-size: 1.4rem;
    font-weight: 600;
}

.modal-email-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

.modal-email-form {
    padding: 25px 30px 30px;
}

.modal-email-campo {
    margin-bottom: 18px;
}

.modal-email-campo label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #444;
}

.modal-email-campo label i {
    color: var(--color-acento);
    margin-right: 5px;
}

.modal-email-campo input,
.modal-email-campo textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.modal-email-campo input:focus,
.modal-email-campo textarea:focus {
    outline: none;
    border-color: var(--color-acento);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15);
}

.modal-email-campo textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-email-preview {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px 18px;
    margin-bottom: 20px;
}

.modal-email-preview p {
    margin: 0 0 10px;
    font-size: 0.85rem;
    color: #666;
}

.modal-email-preview ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.modal-email-preview li {
    font-size: 0.8rem;
    color: #555;
}

.modal-email-preview li i {
    color: var(--color-verde);
    margin-right: 5px;
    width: 14px;
}

.modal-email-enviar {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--color-acento) 0%, #c62828 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.modal-email-enviar:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(230, 57, 70, 0.35);
}

.modal-email-enviar:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.modal-email-enviar.enviando i {
    animation: rotar 1s linear infinite;
}

@keyframes rotar {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.modal-email-mensaje {
    margin-top: 15px;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    display: none;
}

.modal-email-mensaje.exito {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.modal-email-mensaje.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive modal */
@media (max-width: 480px) {
    .modal-email-container {
        max-height: 95vh;
    }
    
    .modal-email-header {
        padding: 25px 20px 15px;
    }
    
    .modal-email-form {
        padding: 20px;
    }
    
    .modal-email-preview ul {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   PÁGINAS LEGALES (Privacidad, Cookies, etc.)
   ============================================ */

.legal-content {
    line-height: 1.8;
    color: var(--color-texto);
}

.legal-content h2 {
    font-family: var(--fuente-titulos);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--color-texto);
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-acento);
}

.legal-content h3 {
    font-family: var(--fuente-titulos);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-texto);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.legal-content p {
    margin-bottom: 1rem;
    text-align: justify;
}

.legal-content ul {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.legal-content ul li {
    margin-bottom: 0.5rem;
}

.legal-content a {
    color: var(--color-acento);
    text-decoration: none;
}

.legal-content a:hover {
    text-decoration: underline;
}

.legal-content table {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.legal-content table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.legal-content table td,
.legal-content table th {
    padding: 0.75rem;
    vertical-align: top;
}

@media (max-width: 767.98px) {
    .legal-content h2 {
        font-size: 1.2rem;
    }
    
    .legal-content h3 {
        font-size: 1rem;
    }
    
    .legal-content p {
        text-align: left;
    }
    
    .legal-content table {
        font-size: 0.8rem;
    }
    
    .legal-content table td,
    .legal-content table th {
        padding: 0.5rem;
    }
}
