/* ═══════════════════════════════════════════
   PANAMÁ VIRTUAL — Design System
   Paleta del logo: rojo #ff0e14 · navy #072357 · cielo #98d8f8 · acento #08a8f8
   DM Serif Display + Outfit
   ═══════════════════════════════════════════ */

:root {
  --pv-cream: #eef5fa;
  --pv-cream-deep: #d5e8f5;
  --pv-red: #e30613;
  --pv-red-dark: #b80510;
  --pv-red-bright: #ff0e14;
  --pv-blue: #072357;
  --pv-blue-light: #0a4a8f;
  --pv-sky: #08a8f8;
  --pv-cyan: #98d8f8;
  --pv-cyan-light: #c8ebfa;
  --pv-dark: #0a1628;
  --pv-ink: #0a0a0a;
  --pv-warm-white: #ffffff;
  --pv-muted: #5a6b7d;
  --pv-primary-rgb: 227, 6, 19;
  --pv-secondary-rgb: 152, 216, 248;
  --pv-shadow-sm: 0 2px 12px rgba(7, 35, 87, 0.06);
  --pv-shadow-md: 0 4px 24px rgba(7, 35, 87, 0.08);
  --pv-shadow-lg: 0 12px 40px rgba(7, 35, 87, 0.12);
  --pv-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pv-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  background: var(--pv-cream);
  color: var(--pv-dark);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { text-wrap: balance; font-family: 'DM Serif Display', Georgia, serif; }

::selection { background: var(--pv-cyan-light); color: var(--pv-dark); }
:focus-visible { outline: 3px solid var(--pv-cyan); outline-offset: 2px; border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ─── BUTTONS ─── */
.btn-pv {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 32px; font-size: 15px; font-weight: 600; font-family: 'Outfit', sans-serif;
  border: none; border-radius: 40px; cursor: pointer; min-height: 44px;
  transition: transform 0.25s var(--pv-spring), box-shadow 0.3s, opacity 0.2s;
}
/* display:flex del botón no debe anular el atributo HTML hidden */
.btn-pv[hidden],
[hidden] {
  display: none !important;
}
.btn-pv:active { transform: scale(0.96); }
.btn-pv-primary {
  background: linear-gradient(135deg, var(--pv-red-bright), var(--pv-red-dark));
  color: #fff; box-shadow: 0 6px 18px rgba(227, 6, 19, 0.28);
}
.btn-pv-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(227, 6, 19, 0.4); }
.btn-pv-secondary {
  background: transparent; color: var(--pv-red); border: 2px solid var(--pv-red);
}
.btn-pv-secondary:hover { background: rgba(227, 6, 19, 0.06); }
.btn-pv-sm {
  padding: 10px 20px; font-size: 13px;
  background: linear-gradient(135deg, var(--pv-sky), var(--pv-blue-light));
  color: #fff; border-radius: 40px; box-shadow: 0 4px 12px rgba(8, 168, 248, 0.28);
}
.btn-pv-sm:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(8, 168, 248, 0.35); }

/* ─── PIN INPUT ─── */
.pin-group {
  display: flex; gap: 7px; justify-content: center; margin-bottom: 8px;
  max-width: 100%;
}
.pin-group input {
  width: 40px; height: 52px; text-align: center;
  font-size: 20px; font-weight: 600; font-family: 'Outfit', sans-serif;
  background: var(--pv-cream); border: 2px solid transparent;
  border-radius: 12px; color: var(--pv-dark); outline: none;
  transition: border-color 0.2s, background 0.2s, transform 0.25s var(--pv-spring), box-shadow 0.25s;
}
.pin-group input:focus {
  border-color: var(--pv-red); background: #fff;
  box-shadow: 0 0 0 4px rgba(var(--pv-primary-rgb), 0.16), 0 6px 16px rgba(var(--pv-primary-rgb), 0.14);
  transform: translateY(-2px) scale(1.02);
}
.pin-group input.filled { border-color: var(--pv-cyan); background: #fff; }
.pin-group .pin-dash {
  display: flex; align-items: center; font-size: 18px;
  color: var(--pv-cyan); font-weight: 300;
}
/* ─── DIVIDER ─── */
.pv-divider {
  display: flex; align-items: center; gap: 14px; margin: 26px 0; color: var(--pv-cyan);
}
.pv-divider::before, .pv-divider::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--pv-cyan), transparent);
}

/* ─── NAVBAR ─── */
.pv-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 32px;
  background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.pv-nav-brand { display: flex; align-items: center; gap: 10px; }
.pv-nav-brand img { height: 36px; }
.pv-nav-brand span { font-family: 'DM Serif Display', serif; font-size: 1.3rem; }
.pv-nav-user { display: flex; align-items: center; gap: 10px; }
.pv-nav-user .pv-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pv-blue-light), var(--pv-blue));
  display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 14px;
  box-shadow: 0 4px 12px rgba(11, 80, 159, 0.28);
}

/* ─── BOOK CARDS (portada 3D) ─── */
.pv-book-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 28px;
}
.pv-book-card {
  background: var(--pv-warm-white); border-radius: 20px; overflow: visible;
  box-shadow: var(--pv-shadow-md); cursor: pointer;
  transition: box-shadow 0.35s var(--pv-ease), border-color 0.3s;
  border: 1px solid rgba(7, 35, 87, 0.05);
  display: flex; flex-direction: column; height: 100%;
  text-decoration: none; color: inherit;
}
.pv-book-card:hover {
  box-shadow: 0 18px 40px rgba(7, 35, 87, 0.14);
  border-color: rgba(8, 168, 248, 0.28);
}

/* Escenario 3D */
.pv-book3d-stage {
  position: relative;
  height: 220px;
  perspective: 1000px;
  display: flex; align-items: center; justify-content: center;
  padding: 28px 16px 18px;
  border-radius: 20px 20px 0 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 85%, rgba(7, 35, 87, 0.08), transparent 70%),
    linear-gradient(180deg, var(--pv-cream) 0%, #e2eef7 100%);
  overflow: visible;
}
.pv-book3d-stage::after {
  content: "";
  position: absolute; left: 50%; bottom: 18px;
  width: 88px; height: 14px;
  transform: translateX(-42%);
  background: radial-gradient(ellipse, rgba(7, 35, 87, 0.28), transparent 70%);
  filter: blur(2px);
  transition: width 0.4s var(--pv-ease), opacity 0.4s;
  opacity: 0.7; pointer-events: none;
}
.pv-book-card:hover .pv-book3d-stage::after { width: 110px; opacity: 0.45; }

.pv-book3d {
  width: 118px; height: 168px;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateY(-32deg) rotateX(8deg) translateZ(0);
  transition: transform 0.5s var(--pv-spring);
  will-change: transform;
}
.pv-book-card:hover .pv-book3d {
  transform: rotateY(-8deg) rotateX(2deg) translateY(-10px) scale(1.06);
}
.pv-book3d-cover {
  position: absolute; inset: 0;
  border-radius: 2px 7px 7px 2px;
  overflow: hidden;
  transform: translateZ(14px);
  background: linear-gradient(145deg, #1a3a5c, #0a1628);
  box-shadow:
    2px 4px 12px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.pv-book3d-cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.5s var(--pv-ease);
}
.pv-book-card:hover .pv-book3d-cover img { transform: scale(1.04); }
.pv-book3d-cover-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: flex-end; padding: 12px;
  color: #fff; font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
}
.pv-book3d-spine {
  position: absolute; top: 0; left: 0;
  width: 18px; height: 100%;
  transform-origin: left center;
  transform: rotateY(-90deg) translateX(-9px);
  background: linear-gradient(180deg, #2a1810 0%, #4a3020 40%, #2a1810 100%);
  box-shadow: inset -2px 0 4px rgba(0, 0, 0, 0.35);
}
.pv-book3d-pages {
  position: absolute; top: 3px; right: 0;
  width: 16px; height: calc(100% - 6px);
  transform-origin: right center;
  transform: rotateY(90deg) translateX(8px);
  background:
    repeating-linear-gradient(
      to bottom,
      #f7f4ee 0px, #f7f4ee 2px,
      #e8e2d6 2px, #e8e2d6 3px
    );
  border-radius: 0 1px 1px 0;
  box-shadow: inset 2px 0 3px rgba(0, 0, 0, 0.08);
}
.pv-book3d-tag {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  background: rgba(255, 255, 255, 0.94); color: var(--pv-dark);
  font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  padding: 5px 12px; border-radius: 20px;
  box-shadow: 0 2px 8px rgba(7, 35, 87, 0.1);
}

.pv-book-info { padding: 18px 20px 20px; flex: 1; display: flex; flex-direction: column; }
.pv-book-info h4 {
  font-family: 'Outfit', sans-serif; font-size: 15px; font-weight: 600;
  line-height: 1.35; margin-bottom: 4px; color: var(--pv-blue);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pv-book-info .pv-book-meta { font-size: 13px; color: var(--pv-red); font-weight: 500; margin-bottom: 12px; }
.pv-progress { height: 7px; background: #e8eef4; border-radius: 4px; margin-bottom: 9px; overflow: hidden; }
.pv-progress-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--pv-sky), var(--pv-blue));
  transition: width 0.8s var(--pv-ease);
}
.pv-progress-label { font-size: 11px; color: var(--pv-muted); display: flex; justify-content: space-between; font-weight: 500; margin-top: auto; }

@media (prefers-reduced-motion: reduce) {
  .pv-book3d, .pv-book3d-cover img { transition: none; }
  .pv-book-card:hover .pv-book3d { transform: rotateY(-32deg) rotateX(8deg); }
}

/* ─── SIDEBAR ─── */
.pv-sidebar {
  width: 340px; background: var(--pv-warm-white);
  border-left: 1px solid rgba(0, 0, 0, 0.04);
  display: flex; flex-direction: column;
}
.pv-sidebar-head {
  padding: 20px 24px; border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  font-family: 'DM Serif Display', serif; font-size: 18px;
  display: flex; justify-content: space-between; align-items: center;
}
.pv-sidebar-body { flex: 1; overflow-y: auto; padding: 20px; }

.pv-note-card {
  background: var(--pv-cream); border-radius: 16px; padding: 15px 16px; margin-bottom: 12px;
  border: 1px solid transparent; transition: transform 0.2s, box-shadow 0.2s;
}
.pv-note-card:hover { transform: translateX(3px); box-shadow: var(--pv-shadow-sm); border-color: rgba(151, 208, 237, 0.4); }
.pv-note-head { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 12px; font-weight: 500; }
.pv-note-page { color: var(--pv-red); }
.pv-note-date { color: #c4b8ab; }
.pv-note-body { font-size: 13px; color: var(--pv-dark); line-height: 1.6; font-weight: 300; }

/* ─── TOAST ─── */
.pv-toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--pv-dark); color: #fff; padding: 12px 24px; border-radius: 40px;
  font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 10px;
  box-shadow: var(--pv-shadow-lg); opacity: 0; transition: all 0.35s var(--pv-ease);
  z-index: 1000; pointer-events: none;
  font-family: 'Outfit', sans-serif;
}
.pv-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.pv-toast .pv-toast-check {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--pv-cyan); color: var(--pv-dark);
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}

/* ─── LOGIN ART PANEL ─── */
.pv-login-screen { min-height: 100vh; display: flex; overflow: hidden; }
.pv-login-art {
  flex: 1; background: linear-gradient(160deg, #0d3b7a, var(--pv-blue) 60%, #06244a);
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.pv-login-art .pv-sun {
  position: absolute; top: -120px; right: -80px;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--pv-cyan-light), var(--pv-cyan) 55%, transparent 72%);
  opacity: 0.34;
}
.pv-login-art .pv-curve {
  position: absolute; bottom: -40px; right: 0; width: 120%; height: 200px;
  background: var(--pv-cream); border-radius: 50% 50% 0 0;
}
.pv-art-content { position: relative; z-index: 1; text-align: center; padding: 40px; }
.pv-art-content img { height: 120px; margin-bottom: 20px; }
.pv-art-content h3 { font-family: 'DM Serif Display', serif; font-size: 2.4rem; color: #fff; margin-bottom: 8px; }
.pv-art-content p { color: rgba(255, 255, 255, 0.82); font-size: 15px; font-weight: 300; }

.pv-login-form-panel {
  flex: 0.9; display: flex; align-items: center; justify-content: center;
  background: var(--pv-cream); position: relative; z-index: 1; padding: 40px;
}
.pv-form-card {
  background: var(--pv-warm-white); padding: 44px 32px; border-radius: 24px;
  width: 100%; max-width: 460px; box-shadow: var(--pv-shadow-lg);
  margin-top: -60px;
}
.pv-form-card .pv-eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: 2px;
  text-transform: uppercase; color: var(--pv-cyan); margin-bottom: 12px;
}
.pv-form-card h2 { font-family: 'DM Serif Display', serif; font-size: 2.1rem; margin-bottom: 6px; }
.pv-form-card .pv-form-sub { font-size: 14px; color: var(--pv-red); font-weight: 500; margin-bottom: 32px; }
.pv-form-hint { text-align: center; font-size: 12px; color: var(--pv-muted); margin-bottom: 24px; }

/* ─── LECTOR ─── */
.pv-lector-layout { display: flex; height: calc(100vh - 61px); }
.pv-lector-main {
  flex: 1; min-width: 0;
  background: linear-gradient(135deg, #eef5fa, #d5e8f5);
  display: flex; align-items: center; justify-content: center; padding: 40px;
  transition: padding 0.3s var(--pv-ease);
}
.pv-lector-layout.notes-collapsed .pv-lector-main { padding: 24px 32px; }
.pv-lector-layout .pv-sidebar {
  width: 340px; flex: 0 0 340px;
  transition: width 0.32s var(--pv-ease), flex-basis 0.32s var(--pv-ease), opacity 0.25s, border-color 0.25s;
  overflow: hidden;
}
.pv-lector-layout.notes-collapsed .pv-sidebar {
  width: 0; flex-basis: 0; opacity: 0; border-left-color: transparent; pointer-events: none;
}
.pv-notes-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; min-height: 40px; border-radius: 22px;
  border: 2px solid rgba(7, 35, 87, 0.1); background: #fff;
  color: var(--pv-blue); font-family: 'Outfit', sans-serif; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s var(--pv-ease);
}
.pv-notes-toggle:hover {
  border-color: var(--pv-sky); background: rgba(152, 216, 248, 0.18);
  color: var(--pv-blue);
}
.pv-notes-toggle .pv-notes-badge {
  background: var(--pv-cyan); color: var(--pv-dark);
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; min-width: 20px; text-align: center;
}
.pv-lector-layout:not(.notes-collapsed) .pv-notes-toggle {
  background: rgba(8, 168, 248, 0.12); border-color: rgba(8, 168, 248, 0.35);
}
.pv-topbar-actions { display: flex; align-items: center; gap: 12px; }
.pv-book-page {
  max-width: 560px; width: 100%; background: #fff; border-radius: 20px;
  padding: 48px 40px; box-shadow: var(--pv-shadow-lg); position: relative;
}
.pv-book-page .pv-chapter-eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: 2.5px;
  text-transform: uppercase; color: var(--pv-cyan); margin-bottom: 10px;
}
.pv-book-page h2 { font-size: 2.1rem; margin-bottom: 16px; }
.pv-book-page p { font-size: 14px; line-height: 1.8; color: #5a6675; font-weight: 300; margin-bottom: 12px; }
.pv-book-page p.lead::first-letter {
  font-family: 'DM Serif Display', serif;
  font-size: 3.6rem; float: left; line-height: 0.82;
  padding: 6px 12px 0 0; color: var(--pv-red);
}
.pv-page-badge {
  position: absolute; bottom: 22px; right: 26px;
  background: linear-gradient(135deg, var(--pv-blue-light), var(--pv-blue));
  color: #fff; font-size: 12px; font-weight: 600;
  padding: 7px 16px; border-radius: 20px; box-shadow: 0 4px 12px rgba(11, 80, 159, 0.25);
}

/* ─── TOPBAR ─── */
.pv-topbar {
  padding: 14px 28px; display: flex; justify-content: space-between; align-items: center;
  background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 14px; font-weight: 500;
}
.pv-topbar .pv-back {
  cursor: pointer; color: var(--pv-red); display: flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 6px; border-radius: 22px;
  transition: gap 0.3s var(--pv-ease), color 0.3s;
  text-decoration: none;
}
.pv-topbar .pv-back:hover { gap: 12px; color: var(--pv-red-dark); }
.pv-topbar .pv-book-title { font-family: 'DM Serif Display', serif; font-size: 16px; }
.pv-page-counter { display: flex; align-items: center; gap: 6px; color: var(--pv-muted); }

.pv-pull-quote {
  font-family: 'DM Serif Display', serif; font-style: italic;
  font-size: 1.15rem; color: var(--pv-blue); line-height: 1.5;
  border-left: 3px solid var(--pv-cyan); padding: 4px 0 4px 20px; margin: 22px 0;
}
.pv-pull-quote::before { content: "\201C"; color: var(--pv-cyan); font-size: 1.4em; margin-right: 2px; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .pv-login-screen { flex-direction: column; }
  .pv-login-art { min-height: 280px; }
  .pv-login-form-panel { flex: 1; padding: 24px; }
  .pv-form-card { margin-top: -40px; }
  .pv-book-grid { grid-template-columns: 1fr; }
  .pv-lector-layout { flex-direction: column; }
  .pv-lector-layout .pv-sidebar { width: 100%; flex-basis: auto; max-height: 40vh; }
  .pv-lector-layout.notes-collapsed .pv-sidebar { width: 100%; max-height: 0; flex-basis: auto; }
  .pv-lector-main { padding: 20px; }
  .pv-notes-toggle .pv-notes-label { display: none; }
  .pv-nav { padding: 12px 16px; }
}

/* ─── SOLUCIONARIO CARDS ─── */
.pv-solucionario-card .pv-book3d-stage {
  background:
    radial-gradient(ellipse 80% 60% at 50% 85%, rgba(139, 105, 20, 0.12), transparent 70%),
    linear-gradient(180deg, #fbf6e8 0%, #f0e6c8 100%);
}
.pv-tag-solucionario {
  background: rgba(139,105,20,0.92) !important;
  color: #fff !important;
  font-weight: 700 !important;
}
.pv-solucionario-card:hover {
  border-color: #c9a84c;
  box-shadow: 0 18px 40px rgba(139,105,20,0.18);
}
.pv-book-inactive { opacity: 0.55; }
.pv-book-inactive:hover { opacity: 0.9; }
