/* estilo.css */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont,
               "Helvetica Neue", Arial, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: linear-gradient(135deg, #0a1628 0%, #1a2a4a 50%, #0f1d35 100%);
  background-attachment: fixed;
  color: #e8ecf1;
  overflow: hidden;
}

/* ============================================================
   HEADER
   ============================================================ */
header {
  background: linear-gradient(135deg, #0d1f3c 0%, #162a4a 100%);
  border-bottom: 1px solid rgba(100, 149, 237, 0.12);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  width: 100%;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.header-container h1 {
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  font-weight: 700;
  background: linear-gradient(90deg, #e8ecf1 0%, #87CEEB 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.btn-volver {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.2rem;
  background: linear-gradient(135deg, #1e5aa8 0%, #2a7cc7 100%);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 15px rgba(42, 124, 199, 0.25);
  margin-left: auto;
  flex-shrink: 0;
}

.btn-volver:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(42, 124, 199, 0.4);
}

/* ============================================================
   CONTENEDOR PRINCIPAL (dos columnas)
   ============================================================ */
.contenedor-principal {
  display: flex;
  flex: 1;
  overflow: hidden;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 0.5rem 1rem 1rem;
  gap: 1rem;
}

/* ============================================================
   COLUMNA IZQUIERDA: LISTA DE ARCHIVOS
   ============================================================ */
.sidebar {
  width: 320px;
  min-width: 260px;
  background: linear-gradient(145deg, rgba(20, 40, 70, 0.7) 0%, rgba(15, 30, 55, 0.85) 100%);
  border: 1px solid rgba(100, 149, 237, 0.12);
  border-radius: 14px;
  padding: 1.2rem 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar h2 {
  margin-bottom: 1rem;
  font-size: 0.9rem;
  text-align: center;
  color: #87CEEB;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(100, 149, 237, 0.1);
}

.sidebar a {
  display: block;
  padding: 0.7rem 0.9rem;
  text-decoration: none;
  color: #c8d8ec;
  border-radius: 8px;
  margin-bottom: 0.3rem;
  cursor: pointer;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.sidebar a:hover {
  background: rgba(42, 124, 199, 0.15);
  border-color: rgba(100, 149, 237, 0.25);
  transform: translateX(4px);
}

.sidebar a:active {
  transform: scale(0.98);
}

/* ============================================================
   COLUMNA DERECHA: VISOR DE PDF
   ============================================================ */
.content {
  flex: 1;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(100, 149, 237, 0.08);
  border-radius: 14px;
  backdrop-filter: blur(4px);
  min-width: 0;
}

.visor-pdf {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  color: #7a9ab8;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 14px;
}

/* ============================================================
   CONTENEDOR DEL PDF
   ============================================================ */
#pdf-container {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 1rem;
  background: transparent;
}

#pdf-container canvas {
  display: block;
  margin: 0 auto 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(100, 149, 237, 0.15);
  background: white;
  border-radius: 4px;
  max-width: 100%;
  height: auto !important;
}

/* ============================================================
   SCROLLBAR PERSONALIZADA
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(42, 124, 199, 0.4);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(42, 124, 199, 0.6);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .header-container {
    padding: 0.6rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .header-container h1 {
    font-size: 1.1rem;
  }

  .btn-volver {
    font-size: 0.8rem;
    padding: 0.4rem 1rem;
    margin-left: auto;
  }

  .contenedor-principal {
    flex-direction: column;
    padding: 0.5rem;
    gap: 0.5rem;
  }

  .sidebar {
    width: 100%;
    min-width: unset;
    max-height: 220px;
    border-radius: 12px;
    padding: 0.8rem;
  }

  .content {
    height: 50vh;
    border-radius: 12px;
  }

  #pdf-container {
    padding: 0.5rem;
  }

  #pdf-container canvas {
    max-width: 100%;
    margin: 0 auto 8px;
  }
}

@media (max-width: 480px) {
  .header-container {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .header-container h1 {
    font-size: 0.95rem;
    order: 1;
  }

  .btn-volver {
    font-size: 0.75rem;
    padding: 0.3rem 0.8rem;
    order: 2;
    margin-left: auto;
  }

  .sidebar {
    max-height: 180px;
  }

  .sidebar a {
    font-size: 0.8rem;
    padding: 0.5rem 0.7rem;
  }

  .visor-pdf {
    padding: 0.5rem;
    font-size: 0.8rem;
  }
}

/* ============================================================
   REDUCED MOTION (accesibilidad)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ============================================================
   FOCUS VISIBLE (accesibilidad)
   ============================================================ */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #87CEEB;
  outline-offset: 2px;
}