/* ==========================================================================
   VISOR SEGURO DE DOCUMENTOS - ESTILOS DEL SISTEMA
   Aesthetically Crafted for Burlington Computing & IT Reader
   Total Anti-Copia, Anti-Selección y Estilo Glassmorphism Premium
   ========================================================================== */

:root {
  --bg-primary: #0a0d14;
  --bg-secondary: #101522;
  --bg-surface: #161d2f;
  --bg-surface-elevated: #1e273e;
  --bg-glass: rgba(18, 24, 38, 0.85);
  --bg-glass-strong: rgba(16, 21, 34, 0.95);
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(138, 79, 255, 0.5);
  --border-hover: rgba(255, 255, 255, 0.15);

  --accent-purple: #8a4fff;
  --accent-purple-glow: rgba(138, 79, 255, 0.35);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-green: #10b981;
  --accent-red: #ef4444;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px var(--accent-purple-glow);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --header-height: 60px;
  --footer-height: 36px;
  --sidebar-width: 230px;
}

/* ==========================================
   RESET Y REGLAS TOTALES DE ANTICOPIA
   ========================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* BLOQUEO TOTAL DE SELECCIÓN DE TEXTO */
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-user-drag: none !important;
}

/* Solo los campos de entrada permiten interacción de texto */
input, textarea {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================
   ANTI-IMPRESIÓN (DRM PRINT BLOCK)
   ========================================== */
@media print {
  html, body, #login-view, #reader-view, #viewport-container, #page-wrapper, #pdf-canvas {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
  }
  body::after {
    content: "⚠️ IMPRESIÓN BLOQUEADA POR PROTECCIÓN DE DERECHOS DE AUTOR DE BURLINGTON";
    display: block !important;
    color: red !important;
    font-size: 26pt !important;
    text-align: center !important;
    margin-top: 150px !important;
    font-weight: bold !important;
  }
}

/* ==========================================
   UTILIDADES
   ========================================== */
.hidden {
  display: none !important;
}

/* ==========================================
   ESCUDO CONTRA DEVTOOLS / INSPECCIÓN
   ========================================== */
.devtools-shield {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(8, 10, 15, 0.96);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease-out;
}

.shield-card {
  max-width: 520px;
  background: var(--bg-surface);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 0 50px rgba(239, 68, 68, 0.35);
}

.shield-icon {
  font-size: 54px;
  margin-bottom: 16px;
  animation: pulseWarning 1.5s infinite;
}

.shield-card h2 {
  font-size: 22px;
  font-weight: 700;
  color: #fca5a5;
  margin-bottom: 12px;
}

.shield-card p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}

.shield-alert-box {
  background: rgba(239, 68, 68, 0.12);
  border-left: 4px solid var(--accent-red);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #fecaca;
  text-align: left;
  margin-bottom: 18px;
}

.shield-instruction {
  font-weight: 600;
  color: #fff !important;
  font-size: 15px !important;
}

.shield-badge {
  display: inline-block;
  margin-top: 18px;
  padding: 6px 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-muted);
}

@keyframes pulseWarning {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ==========================================
   TOAST DE NOTIFICACIÓN DE SEGURIDAD
   ========================================== */
.security-toast {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 26, 42, 0.95);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fecaca;
  padding: 12px 22px;
  border-radius: var(--radius-full);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(239, 68, 68, 0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  z-index: 10000;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: toastSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastSlideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ==========================================
   PANTALLA DE LOGIN
   ========================================== */
.view-screen {
  width: 100%;
  height: 100%;
}

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: radial-gradient(circle at 50% 20%, #1e1538 0%, #0a0d14 70%);
  overflow-y: auto;
  padding: 24px;
}

.login-bg-glow {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 350px;
  background: radial-gradient(ellipse, rgba(138, 79, 255, 0.18) 0%, rgba(6, 182, 212, 0.08) 50%, transparent 75%);
  pointer-events: none;
  filter: blur(50px);
}

.login-container {
  width: 100%;
  max-width: 440px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 38px 34px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
  z-index: 10;
  animation: loginAppear 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginAppear {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.app-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: rgba(138, 79, 255, 0.12);
  border: 1px solid rgba(138, 79, 255, 0.3);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #c4b5fd;
  margin-bottom: 14px;
}

.brand-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-cyan);
}

.login-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 40%, #c4b5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.login-security-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  margin-bottom: 18px;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  font-size: 15px;
  pointer-events: none;
  opacity: 0.7;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--bg-surface-elevated);
  box-shadow: 0 0 0 3px rgba(138, 79, 255, 0.2);
}

.btn-pwd-peek {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.6;
  font-size: 14px;
  transition: opacity 0.2s;
}

.btn-pwd-peek:hover {
  opacity: 1;
}

.btn-login {
  width: 100%;
  padding: 13px 20px;
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
  margin-top: 10px;
}

.btn-login:hover {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.55);
}

.btn-login:active {
  transform: translateY(0);
}

.quick-credentials-hint {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}

.hint-title {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  font-weight: 600;
}

.hint-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chip-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.chip-btn:hover {
  background: rgba(138, 79, 255, 0.12);
  border-color: rgba(138, 79, 255, 0.3);
  color: var(--text-primary);
}

.login-footer {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================
   PANTALLA DEL VISOR (READER VIEW)
   ========================================== */
.reader-screen {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  background: var(--bg-primary);
}

/* Header */
.reader-header {
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 100;
  gap: 14px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-icon {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.book-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 5px 12px;
  border-radius: var(--radius-md);
}

.book-icon {
  font-size: 16px;
}

.book-selector-wrapper select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  max-width: 320px;
}

.book-selector-wrapper select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Header Center Controls */
.header-center {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-controls, .zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 4px 6px;
  border-radius: var(--radius-md);
}

.btn-control {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-control:hover:not(:disabled) {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.btn-control:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 0 6px;
}

.page-counter input {
  width: 48px;
  padding: 3px 4px;
  text-align: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 12px;
  font-family: inherit;
}

.page-counter input:focus {
  outline: none;
  border-color: var(--border-focus);
}

#zoom-level-label {
  font-size: 11px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  padding: 0 4px;
  min-width: 44px;
  text-align: center;
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.security-badge-live {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 5px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  color: #34d399;
  font-weight: 600;
}

.live-dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.user-menu-wrapper {
  position: relative;
}

.btn-user {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-user:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-hover);
}

.caret {
  font-size: 9px;
  opacity: 0.6;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 200px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 200;
  animation: dropdownIn 0.2s ease;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-header {
  padding: 8px 10px;
}

.user-dropdown-header strong {
  display: block;
  font-size: 13px;
  color: var(--text-primary);
}

.user-dropdown-header small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.logout-item:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

/* ==========================================
   READER BODY (SIDEBAR + VIEWPORT)
   ========================================== */
.reader-body {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
  height: calc(100vh - var(--header-height) - var(--footer-height));
}

/* Sidebar miniaturas (Cajón flotante para no desviar el PDF del centro de la web) */
.thumbnails-sidebar {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100%;
  background: rgba(14, 18, 28, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.3s ease;
  z-index: 500;
  box-shadow: 10px 0 35px rgba(0, 0, 0, 0.85);
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  overflow: hidden;
}

.thumbnails-sidebar.collapsed {
  transform: translateX(calc(-100% - 60px)) !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  box-shadow: none !important;
  border-right-color: transparent !important;
  overflow: hidden !important;
}

.sidebar-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.thumbs-counter {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.thumbs-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Custom Scrollbar */
.thumbs-list::-webkit-scrollbar,
.viewport-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.thumbs-list::-webkit-scrollbar-track,
.viewport-container::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

.thumbs-list::-webkit-scrollbar-thumb,
.viewport-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
}

.thumbs-list::-webkit-scrollbar-thumb:hover,
.viewport-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.thumb-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-surface);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.thumb-card:hover {
  border-color: rgba(138, 79, 255, 0.4);
  transform: translateY(-2px);
  background: var(--bg-surface-elevated);
}

.thumb-card.active {
  border-color: var(--accent-purple);
  box-shadow: 0 0 14px var(--accent-purple-glow);
  background: var(--bg-surface-elevated);
}

.thumb-img-wrapper {
  width: 100%;
  aspect-ratio: 1 / 1.414;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.thumb-img-wrapper img,
.thumb-img-wrapper canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.thumb-skeleton {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #1b2336 25%, #25314a 50%, #1b2336 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.thumb-page-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 6px;
}

.thumb-card.active .thumb-page-label {
  color: #c4b5fd;
  font-weight: 700;
}

/* Viewport Principal */
.viewport-container {
  flex: 1;
  height: 100%;
  width: 100%;
  overflow: auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  align-items: safe center;
  justify-content: safe center;
  padding: 16px;
  background: radial-gradient(circle at center, #111624 0%, #080a10 100%);
}

/* Flechas Flotantes Laterales (Siempre transparentes y sin morado) */
.float-nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 72px;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none !important;
  color: rgba(255, 255, 255, 0.45);
  font-size: 42px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999;
  transition: opacity 0.25s ease, transform 0.2s ease, color 0.2s ease;
  border-radius: var(--radius-sm);
  opacity: 0.45;
  box-shadow: none !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}

.float-nav-btn:hover {
  opacity: 1;
  color: #ffffff;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 1);
  transform: translateY(-50%) scale(1.2);
}

.float-nav-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.prev-btn {
  left: 16px !important;
}

.thumbnails-sidebar.collapsed ~ .viewport-container .prev-btn {
  left: 16px !important;
}

.next-btn {
  right: 16px !important;
}

/* Page Wrapper & Canvas */
.page-wrapper {
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: #ffffff;
  display: block;
  margin: auto; /* Centrado perfecto automático en horizontal y vertical */
  line-height: 0;
  transition: transform 0.15s ease-out;
}

.pdf-canvas {
  display: block;
  border-radius: 4px;
  /* Bloquear arrastre nativo de imagen/canvas */
  pointer-events: none;
}

/* ESCUDO DE SEGURIDAD INVISIBLE SOBRE EL CANVAS */
.security-shield {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  background: transparent;
  cursor: default;
  /* Absorbe todos los eventos de ratón, impidiendo click derecho sobre el canvas */
  pointer-events: auto;
}

/* MARCA DE AGUA DINÁMICA */
.watermark-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 25;
  pointer-events: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.watermark-text {
  font-size: 20px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.045);
  transform: rotate(-35deg);
  white-space: nowrap;
  letter-spacing: 2px;
  text-transform: uppercase;
  user-select: none !important;
}

/* Spinner de carga */
.page-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(16, 21, 34, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 60;
  box-shadow: var(--shadow-lg);
}

.loader-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(138, 79, 255, 0.2);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Footer del Visor */
.reader-footer {
  height: var(--footer-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  font-size: 11px;
  color: var(--text-muted);
  z-index: 100;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shield-indicator {
  color: #34d399;
  font-weight: 600;
}

/* ==========================================
   MODAL DE CAMBIO DE CONTRASEÑA
   ========================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.btn {
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.btn-primary {
  background: var(--accent-purple);
  color: #fff;
}

.btn-primary:hover {
  background: #7c3aed;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}


/* ==========================================
   MODAL DE GESTIÓN DE USUARIOS (ADMIN)
   ========================================== */
.modal-card.modal-card-lg {
  max-width: 720px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.admin-modal-body {
  overflow-y: auto;
  max-height: calc(90vh - 120px);
  padding-right: 4px;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-user-count {
  font-size: 13px;
  color: var(--text-muted);
}

.admin-form-panel {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 18px;
  animation: fadeIn 0.2s ease;
}

.admin-form-panel h4 {
  margin: 0 0 14px 0;
  font-size: 14px;
  color: var(--accent-primary);
  font-weight: 700;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 600px) {
  .admin-form-grid {
    grid-template-columns: 1fr;
  }
}

.admin-form-grid select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.admin-form-grid select:focus {
  border-color: var(--accent-primary);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  text-align: left;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
}

.admin-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.role-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.role-badge.admin {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.role-badge.student {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-icon-action {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  cursor: pointer;
  margin-left: 6px;
  transition: all 0.15s ease;
}

.btn-icon-action:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-icon-action.delete {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-icon-action.delete:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

.btn-close-modal:hover {
  color: var(--text-primary);
}

/* ========================================================
   DISEÑO RESPONSIVE ADAPTABLE PARA MÓVILES Y TABLETS
   ======================================================== */
@media (max-width: 860px) {
  /* Cabecera del visor adaptable en 2 filas */
  .reader-header {
    height: auto;
    min-height: 52px;
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
  }

  .header-left {
    order: 1;
    flex: 1;
    min-width: 0;
    gap: 8px;
  }

  .book-selector-wrapper {
    max-width: 100%;
    flex: 1;
    min-width: 0;
    padding: 4px 8px;
  }

  .book-selector-wrapper select {
    max-width: 100%;
    width: 100%;
    font-size: 12px;
    text-overflow: ellipsis;
  }

  .header-right {
    order: 2;
    gap: 6px;
  }

  .security-badge-live span:last-child {
    display: none; /* Dejar solo el punto verde en móvil */
  }

  .security-badge-live {
    padding: 4px 6px;
  }

  .btn-user span#user-display-name {
    display: none; /* En móvil mostrar solo el icono de usuario */
  }

  .btn-user {
    padding: 5px 8px;
  }

  .btn-icon {
    width: 32px;
    height: 32px;
  }

  /* Fila 2: Controles de navegación y zoom */
  .header-center {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }

  .page-controls {
    flex: 1;
    justify-content: center;
    padding: 3px 4px;
    gap: 2px;
  }

  .zoom-controls {
    flex-shrink: 0;
    padding: 3px 4px;
    gap: 2px;
  }

  .zoom-controls #btn-zoom-fit-width {
    display: none; /* Ocultar botón ancho duplicado en móvil */
  }

  /* Barra de pie de página compacta */
  .reader-footer {
    padding: 6px 10px;
    font-size: 10px;
    height: auto;
    min-height: 28px;
  }

  .reader-footer .footer-right {
    display: none; /* Ocultar lista de atajos de teclado en móvil */
  }

  .reader-footer .separator,
  .reader-footer #book-info-label {
    display: none; /* Ahorrar espacio en móvil */
  }

  /* Viewport y Lienzo de lectura */
  .viewport-container {
    padding: 8px 2px;
  }

  .page-wrapper {
    max-width: 100%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
  }

  #pdf-canvas {
    max-width: 100%;
    height: auto !important;
  }

  /* Miniaturas en móvil: Menú flotante tipo Drawer */
  .thumbnails-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 250px;
    max-width: 82vw;
    height: 100%;
    z-index: 500;
    box-shadow: 15px 0 35px rgba(0, 0, 0, 0.85);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.3s ease;
    overflow: hidden;
  }

  .thumbnails-sidebar.collapsed {
    transform: translateX(calc(-100% - 60px)) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    box-shadow: none !important;
    border-right-color: transparent !important;
    overflow: hidden !important;
  }

  /* Flechas flotantes táctiles (Siempre transparentes y sin morado) */
  .float-nav-btn {
    width: 38px;
    height: 56px;
    font-size: 32px;
    opacity: 0.5;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  .float-nav-btn:hover,
  .float-nav-btn:active {
    opacity: 1;
    color: #ffffff;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  .prev-btn {
    left: 2px !important;
  }

  .next-btn {
    right: 2px !important;
  }

  /* Pantalla de login en móvil */
  .login-screen {
    padding: 16px 12px;
    align-items: center;
  }

  .login-container {
    padding: 24px 18px;
    max-width: 100%;
  }

  .login-title {
    font-size: 22px;
  }

  .login-subtitle {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  /* En teléfonos estrechos (<480px) ocultar botones de inicio y fin */
  #btn-first-page,
  #btn-last-page {
    display: none;
  }

  .page-counter input {
    width: 36px;
    padding: 2px;
    font-size: 11px;
  }

  .page-counter {
    font-size: 11px;
    gap: 3px;
    padding: 0 3px;
  }

  #zoom-level-label {
    min-width: 30px;
    font-size: 10px;
    padding: 0 2px;
  }

  .btn-control {
    padding: 4px 6px;
    font-size: 11px;
  }
}

/* ========================================================
   MODO PANTALLA COMPLETA CON MENÚS AUTO-OCULTABLES
   ======================================================== */
.fullscreen-mode .reader-body {
  height: 100vh !important;
  width: 100vw !important;
}

.fullscreen-mode .reader-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(10, 13, 20, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  transform: translateY(0);
  opacity: 1;
}

.fullscreen-mode .reader-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(10, 13, 20, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.7);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  transform: translateY(0);
  opacity: 1;
}

/* Ocultación animada suave cuando no hay movimiento */
.fullscreen-mode.ui-hidden {
  cursor: none;
}

.fullscreen-mode.ui-hidden .reader-header {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.fullscreen-mode.ui-hidden .reader-footer {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

.fullscreen-mode.ui-hidden .float-nav-btn {
  opacity: 0.12;
  cursor: pointer;
}

.fullscreen-mode.ui-hidden .float-nav-btn:hover {
  opacity: 1;
  cursor: pointer;
}

.fullscreen-mode .viewport-container {
  height: 100vh !important;
  max-height: 100vh !important;
  width: 100vw !important;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  align-items: safe center;
  justify-content: safe center;
}

.fullscreen-mode .thumbnails-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1050;
}

.fullscreen-mode.ui-hidden .thumbnails-sidebar {
  transform: translateX(calc(-100% - 60px)) !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  box-shadow: none !important;
  border-right-color: transparent !important;
  overflow: hidden !important;
}