/* =========================
   BASE
========================= */

* {
    box-sizing: border-box;
}

:root {
    --trocetti-blue: #00A3E4;
    --trocetti-blue-dark: #0073A8;

    --viewer-bg: #111820;

    --ui-white: rgba(255, 255, 255, 0.88);
    --ui-muted: rgba(255, 255, 255, 0.48);
}

body {
    margin: 0;
    min-height: 100vh;

    display: flex;
    justify-content: center;
    align-items: center;

    background-color: var(--viewer-bg);

    background-image:
        linear-gradient(
            rgba(8, 15, 21, 0.48),
            rgba(8, 15, 21, 0.48)
        ),
        url("assets/background-industrial_1.png");

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;

    font-family:
        Arial,
        Helvetica,
        sans-serif;
}


/* =========================
   APLICACIÓN
========================= */

.flipbook-app {
    width: 100%;

    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 12px;

    padding: 14px 32px 18px;
}


/* =========================
   TOOLBAR SUPERIOR
========================= */

.toolbar {
    display: flex;
    justify-content: center;
    align-items: center;

    gap: 24px;

    min-height: 46px;
}


/* Grupo de iconos */

.toolbar-actions {
    display: flex;
    align-items: center;

    gap: 5px;

    padding: 4px 7px;

    background: rgba(255, 255, 255, 0.045);

    border: 1px solid rgba(255, 255, 255, 0.07);

    border-radius: 12px;
}


/* Botones */

.tool-button {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: none;
    border-radius: 8px;

    background: transparent;
    color: var(--ui-muted);

    cursor: pointer;

    transition:
        color 0.18s ease,
        background 0.18s ease,
        transform 0.18s ease;
}


/* SVG */

.tool-button svg,
.search-box svg,
.nav-arrow svg {
    width: 20px;
    height: 20px;

    fill: none;
    stroke: currentColor;

    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* Hover */

.tool-button:hover {
    color: var(--trocetti-blue);

    background: rgba(0, 163, 228, 0.09);

    transform: translateY(-1px);
}


/* Estado activo */

.tool-button.active {
    color: var(--trocetti-blue);
}


/* Separador */

.toolbar-divider {
    width: 1px;
    height: 20px;

    margin: 0 3px;

    background: rgba(255, 255, 255, 0.12);
}


/* =========================
   BUSCADOR
========================= */

.search-box {
    width: 245px;
    height: 42px;

    display: flex;
    align-items: center;

    padding-left: 15px;

    background: rgba(255, 255, 255, 0.055);

    border: 1px solid rgba(255, 255, 255, 0.09);

    border-radius: 10px;

    transition:
        border-color 0.2s ease,
        background 0.2s ease;
}

.search-box:focus-within {
    border-color: rgba(0, 163, 228, 0.65);

    background: rgba(255, 255, 255, 0.07);
}

.search-box input {
    min-width: 0;
    flex: 1;

    border: none;
    outline: none;

    background: transparent;

    color: white;

    font-size: 13px;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.36);
}

.search-box button {
    width: 42px;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: none;

    background: transparent;

    color: var(--ui-muted);

    cursor: pointer;

    transition:
        color 0.18s ease,
        background 0.18s ease;
}

.search-box button:hover {
    color: var(--trocetti-blue);

    background: rgba(0, 163, 228, 0.07);
}

/* =========================
   VISOR
========================= */

.viewer {
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 22px;
}

/* =========================
   VISOR EN MODO ZOOM
========================= */

.flipbook-app.zoom-active .viewer {
    width: 100vw;
    height: calc(100vh - 115px);

    max-width: none;

    display: grid;

    grid-template-columns:
        3.5% minmax(0, 93%) 3.5%;

    align-items: stretch;

    overflow: hidden;
}

/* =========================
   VIEWPORT DEL LIBRO
========================= */

.book-viewport {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 0;

    overflow: visible;
}

/* VIEWPORT EN MODO ZOOM */

.flipbook-app.zoom-active .book-viewport {

    grid-column: 2;

    position: relative;

    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    cursor: grab;
    user-select: none;
    
}

.flipbook-app.zoom-active .book-viewport:active {
    cursor: grabbing;
}

/* =========================
   FLECHAS EN MODO ZOOM
========================= */

.flipbook-app.zoom-active .nav-left,
.flipbook-app.zoom-active .nav-right {
    position: relative;

    top: auto;
    left: auto;
    right: auto;

    transform: none;

    margin: 0 auto;

    z-index: 10;
}

.flipbook-app.zoom-active .nav-left {
    grid-column: 1;
}

.flipbook-app.zoom-active .nav-right {
    grid-column: 3;
}

/* =========================
   LIBRO
========================= */

.book {

    position: relative;

    display: flex;
    justify-content: center;
    align-items: center;

    max-width: 82vw;

    transform:
    scale(var(--zoom-factor, 1));

    transform-origin:
    center center;

   filter:
    drop-shadow(0 10px 14px rgba(0, 0, 0, 0.22))
    drop-shadow(0 24px 34px rgba(0, 0, 0, 0.30))
    drop-shadow(0 38px 55px rgba(0, 0, 0, 0.16));
    }
        


.flipbook-app.zoom-active .book {

    max-width: none;

    flex: 0 0 auto;

    transform:
        scale(var(--zoom-factor, 1));

    transform-origin:
        center center;
}        

.page {
    position: relative;

    overflow: hidden;

    background: white;
}

.page canvas {
    display: block;
    width: auto;
    height: min(82vh, 840px);
}   


/* Unión central */

.page-left {
    border-right: none;
}

.page-right {
    border-left: none;
}


/* sombra muy sutil hacia el lomo */

.page-left::after,
.page-right::after {
    content: "";

    position: absolute;

    top: 0;
    bottom: 0;

    width: 16px;

    pointer-events: none;
}

.page-left::after {
    right: 0;

    background:
        linear-gradient(
            to left,
            rgba(0, 0, 0, 0.10),
            transparent
        );
}

.page-right::after {
    left: 0;

    background:
        linear-gradient(
            to right,
            rgba(0, 0, 0, 0.08),
            transparent
        );
}

.page.hidden {
    display: none;
}

/* =========================================================
   PANTALLA COMPLETA
   DISTRIBUCIÓN VERTICAL REAL
========================================================= */

:fullscreen {
    overflow: hidden;
}

:fullscreen .flipbook-app {
    width: 100vw;
    height: 100vh;

    min-width: 0;
    min-height: 0;

    overflow: hidden;
}


/* El viewer ocupa TODO el espacio
   disponible entre toolbar y barra inferior */

:fullscreen .viewer {
    flex: 1 1 0;

    width: 100%;
    min-width: 0;
    min-height: 0;

    display: flex;
    align-items: center;
    justify-content: center;
}


/* El viewport ocupa toda la altura
   que le entrega el viewer */

:fullscreen .book-viewport {
    flex: 1 1 0;

    width: 100%;
    height: 100%;

    min-width: 0;
    min-height: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: visible;
}


/* El catálogo crece,
   pero permanece centrado en su zona */

:fullscreen .book {
    transform: none;

    transform-origin:
        center center;

    flex-shrink: 0;

    margin: 0;
}

/* =========================
   CURVATURA VISUAL DEL PAPEL
========================= */

.page-left::before,
.page-right::before {
    content: "";

    position: absolute;

    top: 0;
    bottom: 0;

    width: 70px;

    z-index: 2;

    pointer-events: none;
}


/* HOJA IZQUIERDA */

.page-left::before {
    left: 0;
    right: 0;
    width: auto;

    background:
        linear-gradient(
            to right,

            /* BORDE EXTERIOR — MUY SUAVE */
            rgba(0, 0, 0, 0.018) 0%,
            rgba(255, 255, 255, 0.045) 3%,
            rgba(255, 255, 255, 0.018) 7%,
            transparent 15%,

            /* ZONA PLANA */
            transparent 78%,

            /* CURVATURA HACIA EL LOMO */
            rgba(255, 255, 255, 0.018) 84%,
            rgba(255, 255, 255, 0.055) 91%,
            rgba(0, 0, 0, 0.012) 96%,
            rgba(0, 0, 0, 0.035) 100%
        );
}


/* HOJA DERECHA */

.page-right::before {
    left: 0;
    right: 0;
    width: auto;

    background:
        linear-gradient(
            to left,

            /* BORDE EXTERIOR — MUY SUAVE */
            rgba(0, 0, 0, 0.018) 0%,
            rgba(255, 255, 255, 0.045) 3%,
            rgba(255, 255, 255, 0.018) 7%,
            transparent 15%,

            /* ZONA PLANA */
            transparent 78%,

            /* CURVATURA HACIA EL LOMO */
            rgba(255, 255, 255, 0.018) 84%,
            rgba(255, 255, 255, 0.055) 91%,
            rgba(0, 0, 0, 0.012) 96%,
            rgba(0, 0, 0, 0.035) 100%
        );
}

/* =========================
   HOJAS ACUMULADAS
========================= */

.page-stack {
    position: absolute;

    top: 1px;
    bottom: 1px;

    width: 12px;

    z-index: 51;

    pointer-events: none;
}

/* =========================================================
   HOJAS — OCULTAS HASTA QUE STPAGEFLIP ESTÉ LISTO
========================================================= */

.book:not(.stf-ready) .page-stack {
    visibility: hidden !important;
}

.book.stf-ready .page-stack {
    visibility: visible;
}


/* LADO IZQUIERDO */

.page-stack-left {
    right: calc(100% - 1px);
}


/* LADO DERECHO */

.page-stack-right {
    left: calc(100% - 1px);
}


/* =========================
   CADA HOJA INDIVIDUAL
========================= */

.page-stack span {
    position: absolute;

    top: 0;
    bottom: 0;

    width: 1px;

    box-sizing: border-box;

    background:
    rgba(242, 242, 239, 0.98);

    border-left:
    1px solid
    rgba(90, 90, 90, 0.40);

    pointer-events: none;
}


/* HOJAS IZQUIERDAS */

.page-stack-left span {
    right: 0;

    transform:
        translateX(
            calc(
                (var(--sheet-index) * -0.52px)
                - var(--sheet-offset, 0px)
            )
        );
}


/* HOJAS DERECHAS */

.page-stack-right span {
    left: 0;

    transform:
        translateX(
            calc(
                (var(--sheet-index) * 0.52px)
                + var(--sheet-offset, 0px)
            )
        );
}


/* =========================
   VARIACIÓN NATURAL DEL PAPEL
========================= */

.page-stack span:nth-child(2n) {
    border-left-color:
        rgba(125, 125, 125, 0.30);
}

.page-stack span:nth-child(3n) {
    background:
        rgba(232, 232, 229, 0.98);
}

.page-stack span:nth-child(4n) {
    border-left-color:
        rgba(70, 70, 70, 0.46);
}

.page-stack span:nth-child(7n) {
    background:
        rgba(248, 248, 245, 1);
}



/* =========================
   FLECHAS LATERALES
========================= */

.nav-arrow {
    width: 50px;
    height: 70px;

    flex: 0 0 50px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: none;
    border-radius: 12px;

    background: transparent;

    color: rgba(255, 255, 255, 0.42);

    cursor: pointer;

    transition:
        color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease;
}

.nav-arrow svg {
    width: 30px;
    height: 30px;

    stroke-width: 1.5;
}

.nav-arrow:hover {
    color: var(--trocetti-blue);

    background: rgba(0, 163, 228, 0.07);
}

.nav-left:hover {
    transform: translateX(-3px);
}

.nav-right:hover {
    transform: translateX(3px);
}

.nav-arrow:disabled {
    opacity: 0.12;

    cursor: default;

    transform: none;

    background: transparent;
}


/* =========================
   INTERFAZ INFERIOR
========================= */

.bottom-interface {
    width: var(--book-width, 1000px);

    display: flex;
    align-items: center;

    gap: 18px;
}


/* Contador */

/* =========================
   CONTADOR / IR A PÁGINA
========================= */

.page-counter {
    grid-column: 1;

    display: flex;.page-counter {
    flex: 0 0 auto;

    display: flex;
    align-items: center;

    color: rgba(255, 255, 255, 0.88);

    font-size: 12px;
    font-weight: 500;

    white-space: nowrap;
}

    align-items: center;

    color: rgba(255, 255, 255, 0.82);

    font-size: 12px;
    font-weight: 500;

    white-space: nowrap;
}

.page-counter {
    flex: 0 0 auto;

    display: flex;
    align-items: center;

    color: rgba(255, 255, 255, 0.88);

    font-size: 12px;
    font-weight: 500;

    white-space: nowrap;
}

.page-jump {
    position: relative;

    display: flex;
    align-items: center;

    min-width: 24px;

    cursor: text;
}

#pageDisplay {
    min-width: 34px;

    padding: 2px 5px;

    border-bottom: 1px solid rgba(255, 255, 255, 0.22);

    color: rgba(255, 255, 255, 0.88);

    text-align: center;

    letter-spacing: 0.5px;

    cursor: text;

    transition:
        color 0.2s ease,
        border-color 0.2s ease;
}

.page-jump:hover #pageDisplay {
    color: var(--trocetti-blue);

    border-bottom-color:
        rgba(0, 163, 228, 0.5);
}

#pageInput {
    display: none;

    width: 34px;

    padding: 0;

    border: none;
    border-bottom:
        1px solid var(--trocetti-blue);

    outline: none;

    background: transparent;

    color: var(--trocetti-blue);

    font: inherit;
    text-align: center;

    appearance: textfield;
    -moz-appearance: textfield;
}

#pageInput::-webkit-inner-spin-button,
#pageInput::-webkit-outer-spin-button {
    appearance: none;
    margin: 0;
}

.page-jump.editing #pageDisplay {
    display: none;
}

.page-jump.editing #pageInput {
    display: block;
}

.page-separator {
    margin: 0 7px;

    color: rgba(255, 255, 255, 0.55);
}

/* =========================
   BARRA DE PROGRESO
========================= */

.progress-track {
    position: relative;

    flex: 1;

    min-width: 0;
    height: 4px;

    background: rgba(255, 255, 255, 0.14);

    border-radius: 999px;

    cursor: pointer;
    
    touch-action: none;
}

.progress-fill {
    position: absolute;

    top: 0;
    left: 0;

    width: 0%;
    height: 100%;

    background: var(--trocetti-blue);

    border-radius: inherit;

    transition: width 0.3s ease;
}


/* pequeño indicador circular */

.progress-thumb {
    position: absolute;

    top: 50%;
    left: 0%;

    width: 14px;
    height: 14px;

    border-radius: 50%;

    background: var(--trocetti-blue);

    transform:
        translate(-50%, -50%);

    box-shadow:
        0 0 0 4px
        rgba(0, 163, 228, 0.12);

    transition: left 0.3s ease;
}


/* =========================
   RESPONSIVE BÁSICO
========================= */

@media (max-width: 850px) {

    .flipbook-app {
        padding:
            18px
            12px;
    }

    .toolbar {
        flex-wrap: wrap;

        gap: 10px;
    }

    .search-box {
        width: 220px;
    }

    .viewer {
        gap: 4px;
    }

    .nav-arrow {
        width: 38px;
        flex-basis: 38px;
    }

    .page canvas {
        max-width: 42vw;
        height: auto;
    }

    .bottom-interface {
    width: min(1000px, 72vw);

    display: grid;

    grid-template-columns:
        78px
        minmax(200px, 1fr);

    align-items: center;

    column-gap: 18px;
}
}

/* =========================
   MODO PORTADA
========================= */

.flipbook-app.cover-mode .search-box {
    width: 46px;

    padding-left: 0;

    justify-content: center;
}

.flipbook-app.cover-mode .search-box input {
    display: none;
}

.flipbook-app.cover-mode .search-box button {
    width: 44px;

    border-radius: 9px;
}

/* =========================
   MODO ZOOM
========================= */

.zoom-toolbar {
    display: none;

    align-items: center;
    justify-content: center;

    gap: 10px;

    height: 46px;

    padding: 0 14px;

    border: 1px solid
        rgba(255, 255, 255, 0.08);

    border-radius: 12px;

    background:
        rgba(255, 255, 255, 0.05);
}


/* BOTÓN REGRESAR */

.zoom-back {
    width: 32px;
    height: 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 1px solid
        rgba(255, 255, 255, 0.18);

    border-radius: 50%;

    background: transparent;

    color:
        rgba(255, 255, 255, 0.75);

    cursor: pointer;

    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease;
}

.zoom-back svg {
    width: 17px;
    height: 17px;

    fill: none;

    stroke: currentColor;
    stroke-width: 1.8;

    stroke-linecap: round;
    stroke-linejoin: round;
}

.zoom-back:hover {
    color: var(--trocetti-blue);

    border-color:
        var(--trocetti-blue);

    background:
        rgba(0, 163, 228, 0.08);
}


/* SEPARADOR */

.zoom-divider {
    width: 1px;
    height: 20px;

    background:
        rgba(255, 255, 255, 0.12);
}


/* BOTONES + Y − */

.zoom-control {
    width: 28px;
    height: 28px;

    padding: 0;

    border: none;

    background: transparent;

    color:
        rgba(255, 255, 255, 0.75);

    font-size: 20px;
    font-weight: 300;

    cursor: pointer;

    transition: color 0.2s ease;
}

.zoom-control:hover {
    color: var(--trocetti-blue);
}


/* SLIDER */

.zoom-range {
    width: 170px;

    accent-color:
        var(--trocetti-blue);

    cursor: pointer;
}


/* PORCENTAJE */

.zoom-value {
    min-width: 42px;

    color:
        rgba(255, 255, 255, 0.82);

    font-size: 12px;
    font-weight: 500;

    text-align: right;
}


/* TOOLBAR EN MODO ZOOM */

.toolbar.zoom-mode .toolbar-actions,
.toolbar.zoom-mode .search-box {
    display: none;
}

.toolbar.zoom-mode .zoom-toolbar {
    display: flex;
}

/* =========================
   TOOLBAR FIJA EN MODO ZOOM
========================= */

.toolbar.zoom-mode {
    position: fixed;

    top: 18px;
    left: 50%;

    transform: translateX(-50%);

    z-index: 1000;

    width: auto;
}

.flipbook-app.zoom-active {
    padding-top: 78px;
}

/* =========================
   BLOQUEAR PANTALLA EN ZOOM
========================= */

html:has(.flipbook-app.zoom-active),
body:has(.flipbook-app.zoom-active) {
    width: 100%;
    height: 100%;

    overflow: hidden;
}

.flipbook-app.zoom-active {
    width: 100vw;
    height: 100vh;

    padding-top: 78px;

    box-sizing: border-box;

    overflow: hidden;
}

/* =========================
   LOADER DEL CATÁLOGO
========================= */

.catalog-loader {
    position: absolute;
    inset: 0;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 14px;

    z-index: 20;

    opacity: 1;

    transition:
        opacity 160ms ease;

    pointer-events: none;
}

.catalog-loader span {
    font-size: 11px;
    font-weight: 600;

    letter-spacing: 1.8px;

    color:
        rgba(255, 255, 255, 0.58);
}


/* CÍRCULO */

.loader-spinner {
    width: 28px;
    height: 28px;

    border: 3px solid
        rgba(255, 255, 255, 0.12);

    border-top-color:
        #00A3E4;

    border-radius: 50%;

    animation:
        catalogSpin 0.75s linear infinite;
}


@keyframes catalogSpin {

    to {
        transform: rotate(360deg);
    }

}


/* LIBRO DURANTE LA CARGA */

.book-loading {
    opacity: 0;
}


/* LIBRO LISTO */

.book {
    transition:
        opacity 160ms ease;
}


/* OCULTAR LOADER */

.catalog-loader.hidden {
    opacity: 0;
}

/* AJUSTE ESPECIAL DE ILUMINACIÓN — PORTADA */
.flipbook-app.cover-mode .page::before {
    opacity: 0.55;
}

/* =========================================================
   PANEL DE BÚSQUEDA
========================================================= */

.search-panel {
    position: fixed;

    top: 50%;
    right: 26px;

    width: min(360px, calc(100vw - 52px));
    height: min(640px, calc(100vh - 120px));

    padding: 22px;

    box-sizing: border-box;

    display: flex;
    flex-direction: column;

    z-index: 100;

    /* Cristal industrial */
    background:
        linear-gradient(
            145deg,
            rgba(0, 163, 228, 0.24),
            rgba(3, 24, 34, 0.72) 38%,
            rgba(2, 15, 22, 0.82)
        );

    border:
        1px solid rgba(0, 163, 228, 0.28);

    border-radius: 16px;

    box-shadow:
        0 24px 55px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 28px rgba(0, 163, 228, 0.06);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    /* CERRADO */
    opacity: 0;

    transform:
        translateY(-50%)
        translateX(calc(100% + 50px));

    pointer-events: none;

    transition:
        transform 320ms cubic-bezier(.22, .8, .25, 1),
        opacity 220ms ease;
}


/* PANEL ABIERTO */

.search-panel.open {
    opacity: 1;

    transform:
        translateY(-50%)
        translateX(0);

    pointer-events: auto;
}


/* =========================================================
   CABECERA
========================================================= */

.search-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    padding-bottom: 16px;

    border-bottom:
        1px solid rgba(255, 255, 255, 0.10);
}


.search-panel-heading {
    display: flex;
    flex-direction: column;
    gap: 5px;
}


.search-panel-label {
    font-size: 9px;
    font-weight: 700;

    letter-spacing: 2.2px;

    color: #00A3E4;
}


.search-panel-heading h2 {
    margin: 0;

    font-size: 20px;
    font-weight: 600;

    letter-spacing: 1px;

    color: rgba(255, 255, 255, 0.96);
}


/* CERRAR */

.search-panel-close {
    width: 34px;
    height: 34px;

    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border:
        1px solid rgba(255, 255, 255, 0.10);

    border-radius: 8px;

    background:
        rgba(255, 255, 255, 0.04);

    color:
        rgba(255, 255, 255, 0.68);

    font-size: 22px;
    font-weight: 300;

    cursor: pointer;

    transition:
        background 160ms ease,
        border-color 160ms ease,
        color 160ms ease;
}


.search-panel-close:hover {
    color: #ffffff;

    border-color:
        rgba(0, 163, 228, 0.48);

    background:
        rgba(0, 163, 228, 0.14);
}


/* =========================================================
   CONSULTA
========================================================= */

.search-panel-query {
    margin-top: 20px;

    display: flex;
    flex-direction: column;

    gap: 5px;
}


.search-panel-query span {
    font-size: 9px;
    font-weight: 600;

    letter-spacing: 1.8px;

    color:
        rgba(255, 255, 255, 0.40);
}


.search-panel-query strong {
    font-size: 15px;
    font-weight: 500;

    color: #ffffff;
}


.search-panel-summary {
    margin-top: 10px;

    font-size: 11px;

    color:
        rgba(255, 255, 255, 0.48);
}


/* =========================================================
   ÁREA DE RESULTADOS
========================================================= */

.search-results {
    flex: 1;

    min-height: 0;

    margin-top: 18px;

    overflow-y: auto;
    overflow-x: hidden;

    padding-right: 4px;
}


/* SCROLLBAR */

.search-results::-webkit-scrollbar {
    width: 4px;
}


.search-results::-webkit-scrollbar-track {
    background:
        rgba(255, 255, 255, 0.04);
}


.search-results::-webkit-scrollbar-thumb {
    background:
        rgba(0, 163, 228, 0.48);

    border-radius: 999px;
}


/* =========================================================
   ESTADO VACÍO
========================================================= */

.search-empty {
    height: 100%;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 12px;

    text-align: center;

    color:
        rgba(255, 255, 255, 0.34);
}


.search-empty-icon {
    font-size: 22px;

    color:
        rgba(0, 163, 228, 0.55);
}


.search-empty p {
    max-width: 220px;

    margin: 0;

    font-size: 11px;
    line-height: 1.6;

    letter-spacing: 0.3px;
}

/* =========================================================
   REORGANIZACIÓN AL ABRIR BÚSQUEDA
========================================================= */

.viewer,
.bottom-interface {
    transition:
        transform 320ms cubic-bezier(.22, .8, .25, 1);
}


/* Catálogo abierto */

.flipbook-app.search-open .viewer,
.flipbook-app.search-open .bottom-interface {
    transform: translateX(-160px);
}

.flipbook-app.zoom-active.search-open .viewer,
.flipbook-app.zoom-active.search-open .bottom-interface {
    transform: none;
}

/* =========================================================
   RESULTADOS DE BÚSQUEDA
========================================================= */

.search-result-card {
    width: 100%;

    display: block;

    margin: 0 0 10px;
    padding: 14px 14px 15px;

    text-align: left;

    border:
        1px solid rgba(255, 255, 255, 0.07);

    border-radius: 10px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.055),
            rgba(0, 163, 228, 0.025)
        );

    color: inherit;

    cursor: pointer;

    transition:
        transform 160ms ease,
        border-color 160ms ease,
        background 160ms ease,
        box-shadow 160ms ease;
}


.search-result-card:hover {
    transform:
        translateX(-3px);

    border-color:
        rgba(0, 163, 228, 0.38);

    background:
        linear-gradient(
            135deg,
            rgba(0, 163, 228, 0.11),
            rgba(255, 255, 255, 0.035)
        );

    box-shadow:
        inset 3px 0 0
        rgba(0, 163, 228, 0.72);
}


/* CABECERA DEL RESULTADO */

.search-result-top {
    display: grid;

    grid-template-columns:
        auto 1fr auto;

    align-items: center;

    gap: 9px;

    margin-bottom: 9px;
}


.search-result-number {
    font-size: 9px;
    font-weight: 700;

    letter-spacing: 1px;

    color:
        rgba(0, 163, 228, 0.72);
}


.search-result-page {
    font-size: 10px;
    font-weight: 700;

    letter-spacing: 1.1px;

    color: #00A3E4;
}


.search-result-matches {
    font-size: 9px;
    font-weight: 500;

    color:
        rgba(255, 255, 255, 0.38);
}


/* FRAGMENTO */

.search-result-snippet {
    margin: 0;

    font-size: 11px;
    line-height: 1.55;

    color:
        rgba(255, 255, 255, 0.64);
}

.search-result-snippets {
    display: flex;
    flex-direction: column;
    gap: 6px;
}


.search-result-snippet {
    margin: 0;

    font-size: 10.5px;
    line-height: 1.45;

    color:
        rgba(255, 255, 255, 0.62);
}


.search-highlight {
    padding: 1px 3px;

    border-radius: 3px;

    background:
        rgba(0, 163, 228, 0.16);

    color: #7DDCFF;

    font-weight: 700;
}


.search-result-more {
    margin-top: 2px;

    font-size: 9px;
    font-weight: 600;

    letter-spacing: 0.4px;

    color:
        rgba(0, 163, 228, 0.72);
}

/* =========================================
   HIGHLIGHT TEMPORAL DE BÚSQUEDA
========================================= */

.page {
    position: relative;
}

.search-highlight-layer {
    position: absolute;
    inset: 0;
    z-index: 8;
    pointer-events: none;
    overflow: hidden;
}

.pdf-search-highlight {
    position: absolute;

    background:
    radial-gradient(
        ellipse at center,
        rgba(0, 163, 228, 0.68) 0%,
        rgba(0, 163, 228, 0.48) 35%,
        rgba(0, 163, 228, 0.22) 65%,
        rgba(0, 163, 228, 0.00) 100%
    );

    border: none;
    border-radius: 50%;

    box-shadow:
    0 0 9px rgba(0, 163, 228, 0.28);

    pointer-events: none;

    animation:
        searchHighlightFlash 1.8s ease forwards;
}

    @keyframes searchHighlightFlash {
    0% {
        opacity: 0;
    }

    12% {
        opacity: 1;
    }

    65% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* =========================
   PANEL COMPARTIR
========================= */

/* Fondo desenfocado detrás del panel */

.share-backdrop {
    position: fixed;
    inset: 0;

    z-index: 2990;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    background:
        rgba(2, 18, 26, 0.22);

    backdrop-filter:
        blur(3px);

    -webkit-backdrop-filter:
        blur(3px);

    transition:
        opacity 0.22s ease,
        visibility 0.22s ease;
}

.share-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.share-panel {
    position: fixed;
    top: 82px;
    left: 50%;
    z-index: 3000;

    width: 360px;
    padding: 22px;

    transform:
        translateX(-50%)
        translateY(-8px);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    background:
        rgba(5, 35, 48, 0.88);

    border:
        1px solid rgba(0, 163, 228, 0.38);

    border-radius: 16px;

    box-shadow:
        0 18px 45px rgba(0, 0, 0, 0.38);

    backdrop-filter: blur(14px);

    transition:
        opacity 0.2s ease,
        transform 0.2s ease,
        visibility 0.2s ease;
}


.share-panel.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transform:
        translateX(-50%)
        translateY(0);
}


.share-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}


.share-panel-eyebrow,
.share-label {
    display: block;

    color: #00A3E4;

    font-size: 10px;
    font-weight: 700;

    letter-spacing: 2px;
}


.share-panel-header h3 {
    margin: 5px 0 0;

    color: #ffffff;

    font-size: 18px;
    font-weight: 700;
}


.share-close-button {
    width: 34px;
    height: 34px;

    border:
        1px solid rgba(255, 255, 255, 0.12);

    border-radius: 9px;

    background:
        rgba(255, 255, 255, 0.05);

    color:
        rgba(255, 255, 255, 0.72);

    font-size: 22px;
    line-height: 1;

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}


.share-close-button:hover {
    color: #ffffff;

    border-color:
        rgba(0, 163, 228, 0.55);

    background:
        rgba(0, 163, 228, 0.14);
}


.share-panel-divider {
    height: 1px;

    margin: 18px 0;

    background:
        rgba(255, 255, 255, 0.10);
}


.share-label {
    margin-bottom: 8px;
}


.share-link-box {
    display: flex;

    overflow: hidden;

    border:
        1px solid rgba(255, 255, 255, 0.14);

    border-radius: 9px;

    background:
        rgba(255, 255, 255, 0.045);
}


.share-link-input {
    min-width: 0;
    flex: 1;

    padding: 11px 12px;

    border: 0;
    outline: 0;

    background: transparent;

    color:
        rgba(255, 255, 255, 0.72);

    font-size: 12px;
}


.share-copy-button {
    padding: 0 16px;

    border: 0;
    border-left:
        1px solid rgba(255, 255, 255, 0.12);

    background:
        rgba(0, 163, 228, 0.10);

    color: #00A3E4;

    font-size: 11px;
    font-weight: 800;

    letter-spacing: 1px;

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}


.share-copy-button:hover {
    background: #00A3E4;
    color: #ffffff;
}


.share-qr-area {
    display: flex;
    flex-direction: column;
    align-items: center;

    margin-top: 22px;
}


.share-qr-placeholder {
    display: grid;
    place-items: center;

    width: 132px;
    height: 132px;

    background: #ffffff;

    border-radius: 10px;

    color: #072633;

    font-size: 14px;
    font-weight: 800;
}


.share-qr-text {
    display: flex;
    flex-direction: column;
    align-items: center;

    margin-top: 12px;

    color:
        rgba(255, 255, 255, 0.58);

    font-size: 10px;

    letter-spacing: 1.4px;

    line-height: 1.55;
}


.share-qr-text strong {
    color:
        rgba(255, 255, 255, 0.88);

    font-size: 10px;
}

/* Estado confirmado al copiar */

.share-copy-button.is-copied {
    background:
        rgba(0, 163, 228, 0.22);

    color: #ffffff;
}

/* =========================================================
   HOJA DE ANIMACIÓN — FLIPBOOK
========================================================= */

.page-turn-layer {
    position: absolute;

    top: 0;
    left: 50%;

    width: 50%;
    height: 100%;

    z-index: 20;

    overflow: visible;

    pointer-events: none;

    opacity: 0;
    visibility: hidden;

    transform-origin: left center;

    backface-visibility: hidden;

    /*
     * Importante:
     * al ser absolute ya NO participa
     * en la geometría del libro.
     */
}

/* =========================================================
   HOJA 3D — FRENTE + REVERSO
========================================================= */

.page-turn-sheet {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    transform-style: preserve-3d;

    transform-origin:
        left center;
}


.page-turn-face {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    overflow: hidden;

    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}


.page-turn-front {
    transform:
        rotateY(0deg);
}


.page-turn-back {
    transform:
        rotateY(180deg);
}


.page-turn-face canvas {
    display: block;

    width: 100%;
    height: 100%;
}

.page-turn-layer canvas {
    display: block;

    width: 100%;
    height: 100%;
}

/* =========================
   REVERSO DE LA HOJA
========================= */

#pageTurnSheet {
    transform-style: preserve-3d;
}

#pageTurnCanvas,
#pageTurnBackCanvas {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

#pageTurnBackCanvas {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;
}
/* =========================================================
   HOJA FLEXIBLE — ARRASTRE MANUAL
========================================================= */

.page-turn-curl {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    pointer-events: none;

    visibility: hidden;

    transform-style: preserve-3d;
}

.page-turn-curl-strip {
    position: absolute;

    top: 0;
    bottom: 0;

    height: 100%;

    overflow: hidden;

    transform-origin: left center;

    transform-style: preserve-3d;

    backface-visibility: visible;
}

.page-turn-curl-strip canvas {
    display: block;

    width: 100%;
    height: 100%;
}

/* =========================================================
   NUEVO MOTOR DE PÁGINAS — STPAGEFLIP
   ETAPA DE INTEGRACIÓN
========================================================= */

.page-flip-stage {
    position: absolute !important;

    top: 0 !important;
    left: 0 !important;

    width: 100% !important;
    height: 100% !important;

    z-index: 50;

    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* =========================================================
   ZOOM — BLOQUEAR AGARRE MANUAL DE STPAGEFLIP
========================================================= */

.flipbook-app.zoom-active .page-flip-stage {
    pointer-events: none !important;
}

/* PÁGINAS TEMPORALES DE PRUEBA */

.stf-test-page {
    background: white;

    overflow: hidden;
}

.stf-ghost-page {
    background: transparent;
}

.stf-test-page canvas {
    display: block;

    width: 100%;
    height: 100%;
}

/* =========================
   HOJAS ACUMULADAS
   STPAGEFLIP
========================= */

#leftStack,
#rightStack {
    visibility: visible;
    z-index: 49;
}

/* Ocultar páginas visuales del motor antiguo
   mientras probamos StPageFlip */

#leftPage,
#rightPage,
#pageTurnLayer {
    visibility: hidden;
    pointer-events: none;
}

    /* =========================================================
    AJUSTE DE GROSOR — PORTADA Y CONTRAPORTADA CENTRADAS
    ========================================================= */

    /*
    En portada/contraportada la página visible ocupa
    la mitad del ancho del libro y está centrada.

    Por tanto:
    borde izquierdo  = 25%
    borde derecho    = 75%
    */


    /* PORTADA
    El bloque de páginas restantes debe tocar
    el borde derecho de la portada.
    */

.book.single-cover .page-stack-right {
    left: calc(100% - 1px);
}


/* CONTRAPORTADA
   Las páginas ya recorridas deben tocar
   el borde izquierdo de la contraportada.
*/

.book.single-back-cover .page-stack-left {
    right: calc(100% - 1px);
}
/* =========================================
   RESALTADO DE BÚSQUEDA — STPAGEFLIP
========================================= */

.stf-test-page {
    position: relative;
}

.stf-highlight-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;

    z-index: 10;
    pointer-events: none;
}

/* =========================================================
   ACABADO FÍSICO DEL PAPEL — STPAGEFLIP
========================================================= */

.stf-page-left::before,
.stf-page-right::before {
    content: "";

    position: absolute;

    inset: 0;

    z-index: 2;

    pointer-events: none;
}


/* =========================
   HOJA IZQUIERDA
========================= */

.stf-page-left::before {
    background:
        linear-gradient(
            to right,

            rgba(0, 0, 0, 0.018) 0%,
            rgba(255, 255, 255, 0.045) 3%,
            rgba(255, 255, 255, 0.018) 7%,
            transparent 15%,

            transparent 78%,

            rgba(255, 255, 255, 0.018) 84%,
            rgba(255, 255, 255, 0.055) 91%,
            rgba(0, 0, 0, 0.012) 96%,
            rgba(0, 0, 0, 0.035) 100%
        );
}


/* =========================
   HOJA DERECHA
========================= */

.stf-page-right::before {
    background:
        linear-gradient(
            to left,

            rgba(0, 0, 0, 0.018) 0%,
            rgba(255, 255, 255, 0.045) 3%,
            rgba(255, 255, 255, 0.018) 7%,
            transparent 15%,

            transparent 78%,

            rgba(255, 255, 255, 0.018) 84%,
            rgba(255, 255, 255, 0.055) 91%,
            rgba(0, 0, 0, 0.012) 96%,
            rgba(0, 0, 0, 0.035) 100%
        );
}

/* =========================================================
   SOMBRA SUAVE DEL LOMO — STPAGEFLIP
========================================================= */

.stf-page-left::after,
.stf-page-right::after {
    content: "";

    position: absolute;

    top: 0;
    bottom: 0;

    width: 18px;

    z-index: 3;

    pointer-events: none;
}


.stf-page-left::after {
    right: 0;

    background:
        linear-gradient(
            to left,
            rgba(0, 0, 0, 0.10),
            transparent
        );
}


.stf-page-right::after {
    left: 0;

    background:
        linear-gradient(
            to right,
            rgba(0, 0, 0, 0.08),
            transparent
        );
}


/* =========================================================
   EVITAR SCROLL VERTICAL Y HORIZONTAL
   DURANTE EL GIRO DE PÁGINAS
========================================================= */

@media (min-width: 1024px) {

    html,
    body {
        overflow-x: hidden;
        overflow-y: hidden;
    }

}

/* =========================================================
   MÓVIL — OCULTAR GROSOR LATERAL DEL LIBRO
========================================================= */

@media (max-width: 600px) and (orientation: portrait) {

    .page-stack-left,
    .page-stack-right {
        display: none !important;
    }

}

/* =========================================================
   MÓVIL — CENTRADO REAL DE STPAGEFLIP
========================================================= */

@media (max-width: 600px) and (orientation: portrait) {

    .page-flip-stage {
        left: 50% !important;

        transform:
            translateX(-50%) !important;
    }

}

/* =========================================================
   MÓVIL — NAVEGACIÓN TÁCTIL
========================================================= */

@media (max-width: 600px) and (orientation: portrait) {

    .nav-left,
    .nav-right {
        display: none !important;
    }

}

/* =====================================
   MÓVIL — ARRASTRE TÁCTIL EN ZOOM
===================================== */

@media (max-width: 600px) and (orientation: portrait) {

    .flipbook-app.zoom-active .book-viewport {
        touch-action: none;
    }

}

/* =========================================
   ZOOM TÁCTIL — MÓVIL HORIZONTAL
   Permitir desplazamiento continuo
========================================= */

@media (orientation: landscape)
       and (max-height: 600px)
       and (max-width: 1024px) {

    .flipbook-app.zoom-active .book-viewport {
        touch-action: none;
    }

}