/* =========================================================================
   style.css
   Visor de documento protegido — estética "sala de lectura controlada":
   fondo carbón, acento ámbar sellado, indicadores monoespaciados.
   ========================================================================= */

:root {
    --bg-app:        #1B1D21;
    --bg-topbar:     #15171A;
    --border-subtle: #2A2D33;
    --text-main:     #E4E2DC;
    --text-dim:      #8B8D93;
    --accent:        #C8A464;
    --accent-dim:    #8A7144;

    --font-ui:   -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Consolas, monospace;

    --topbar-height: 52px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg-app);
    color: var(--text-main);
    font-family: var(--font-ui);
    -webkit-font-smoothing: antialiased;
}

/* -------------------------------------------------------------------------
   PROTECCIONES DE INTERFAZ (punto 6 del requerimiento)
   Nota: esto disuade a un usuario promedio; no es seguridad absoluta.
   Las herramientas de desarrollador del navegador siempre pueden saltarlo.
   ------------------------------------------------------------------------- */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;

    -webkit-touch-callout: none;   /* evita menú contextual largo-toque en iOS */

    overscroll-behavior: none;
}

img, canvas {
    -webkit-user-drag: none;
    pointer-events: auto; /* mantenemos clicks para los controles del visor, pero bloqueamos drag de imagen */
}

/* =========================================================================
   BARRA SUPERIOR
   ========================================================================= */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border-subtle);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.topbar-title {
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.02em;
    color: var(--text-main);
    white-space: nowrap;
}

.topbar-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 auto;
}

.topbar-controls button {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-main);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.topbar-controls button:hover {
    border-color: var(--accent-dim);
    color: var(--accent);
}

.topbar-controls button:active {
    transform: translateY(1px);
}

.topbar-controls button:disabled {
    opacity: 0.35;
    cursor: default;
}

.zoom-level,
.page-indicator {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent);
    min-width: 56px;
    text-align: center;
    user-select: none;
}

.topbar-divider {
    width: 1px;
    height: 22px;
    background: var(--border-subtle);
    margin: 0 4px;
}

/* En pantallas muy angostas, ocultamos el título para dar espacio a los controles */
@media (max-width: 480px) {
    .topbar {
        gap: 8px;
        padding: 0 10px;
    }
    .topbar-title {
        display: none;
    }
    .topbar-controls {
        gap: 2px;
    }
    .zoom-level,
    .page-indicator {
        min-width: 44px;
        font-size: 12px;
    }
}

/* =========================================================================
   ÁREA DEL VISOR
   ========================================================================= */
.viewer-wrapper {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
    background: var(--bg-app);
    display: flex;
    justify-content: center;
}

.pdf-container {
    width: 100%;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px 8px 40px;
}

.pdf-container canvas {
    background: #fff;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
    max-width: 100%;
    height: auto !important;
    /* Bloqueo adicional de selección/arrastre sobre el lienzo del PDF */
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}

.pdf-page-wrap {
    position: relative;
    line-height: 0;
}

/* Capa transparente sobre cada página: añade una barrera extra a clic
   derecho / selección directamente encima del render del PDF. */
.pdf-page-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
}

.viewer-message {
    margin-top: 80px;
    text-align: center;
    color: var(--text-dim);
    font-size: 15px;
    padding: 0 20px;
}

.viewer-message-sub {
    font-size: 13px;
    margin-top: 8px;
}

.viewer-message code {
    font-family: var(--font-mono);
    background: var(--bg-topbar);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent);
}

/* =========================================================================
   MARCA DE AGUA SUTIL (disuasivo visual ante capturas, no un bloqueo real)
   ========================================================================= */
.watermark-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    background-repeat: repeat;
    background-size: 280px 200px;
    opacity: 0.035;
    background-image: repeating-linear-gradient(
        -28deg,
        transparent 0 120px,
        var(--text-main) 120px 121px,
        transparent 121px 240px
    );
    mix-blend-mode: overlay;
}

/* Foco visible accesible (no eliminamos el outline para teclado) */
a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Respeta preferencia de reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
