/* ════════════════════════════════════════════════════════════
   public.css — Estilos de la interfaz pública (estudiantes)
   Biblioteca IESTP Chivay
   ════════════════════════════════════════════════════════════ */

/* ─── Hero Section ────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--header-height) + var(--space-8)) var(--space-6) var(--space-16);
}

.hero-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero-bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1; /* Fully visible */
  z-index: 0;
  pointer-events: none;
}

.video-desktop {
  display: block;
  /* Zoom para PC para esconder marca de agua */
  transform: scale(1.4);
  transform-origin: center center;
}

.video-mobile {
  display: none;
  /* Aumentar zoom agresivamente para ocultar marca de agua en móvil */
  transform: scale(1.55) translateY(3%);
  transform-origin: center center;
}

[data-theme="light"] .hero-bg-video {
  opacity: 1; 
}

.hero-bg-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 10, 16, 0.3);
  z-index: 1;
  pointer-events: none;
}

[data-theme="light"] .hero-bg-overlay {
  background: rgba(241, 245, 249, 0.2);
}

/* Orbs de fondo animados */
.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: orbFloat 8s ease-in-out infinite;
}
.hero-orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(0, 210, 196, 0.2) 0%, transparent 70%);
  top: -100px; left: -100px;
  animation-delay: 0s;
}
.hero-orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(245, 166, 35, 0.15) 0%, transparent 70%);
  bottom: -50px; right: -50px;
  animation-delay: -4s;
}
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(30px, -20px) scale(1.05); }
  66%  { transform: translate(-20px, 15px) scale(0.97); }
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 780px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--glass-bg);
  border: var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: 0.03em;
  margin-bottom: var(--space-6);
}
.badge-dot {
  width: 6px; height: 6px;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  animation: pulse-dot 1.5s infinite;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: var(--space-4);
  color: var(--color-text);
  letter-spacing: -0.02em;
  text-shadow: 0 4px 12px rgba(255, 255, 255, 0.8);
}
[data-theme="dark"] .hero-title {
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
}

.hero-title-accent {
  background: linear-gradient(135deg, var(--color-wine), var(--color-violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none; /* Let the gradient pop */
}
[data-theme="dark"] .hero-title-accent {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text);
  font-weight: 500;
  margin-bottom: var(--space-10);
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.8);
}
[data-theme="dark"] .hero-subtitle {
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}
.hero-subtitle strong { 
  color: var(--color-wine); 
}
[data-theme="dark"] .hero-subtitle strong {
  color: var(--color-accent);
}

/* ─── Barra de Búsqueda ───────────────────────────────────── */
.search-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: center;
  width: 100%;
  position: relative;
  z-index: 40;
}

.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  z-index: 90;
}

.search-box {
  position: relative;
  width: 100%;
  max-width: 720px;
  display: flex;
  align-items: center;
  background: rgba(15, 20, 34, 0.88);
  border: 1.5px solid rgba(0, 201, 167, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-2xl);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-5);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
[data-theme="light"] .search-box {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(13, 148, 136, 0.4);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}
.search-box:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(0, 201, 167, 0.22);
}

.search-icon {
  color: var(--color-text-muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-right: var(--space-3);
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: var(--text-lg);
  color: var(--color-text);
  min-width: 0;
}
.search-input::placeholder { color: var(--color-text-faint); }

.search-loading {
  flex-shrink: 0;
  margin: 0 var(--space-2);
}

.btn-search-clear {
  background: var(--color-surface);
  border: none;
  border-radius: var(--radius-md);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
  flex-shrink: 0;
  margin-right: var(--space-2);
}
.btn-search-clear:hover { background: var(--color-danger-light); color: var(--color-danger); }

.btn-ia-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: linear-gradient(135deg, var(--color-accent), #e8951a);
  color: #fff;
  font-weight: 700;
  font-size: var(--text-sm);
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(245, 166, 35, 0.3);
}
.btn-ia-trigger:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(245, 166, 35, 0.5);
}

/* ─── Pills de Categoría ──────────────────────────────────── */
.categoria-pills {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: center;
  max-width: 680px;
}
.pill {
  padding: var(--space-2) var(--space-4);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.pill:hover {
  background: var(--color-bg-card-hover);
  border-color: var(--color-primary);
  color: var(--color-text);
  box-shadow: 0 0 12px var(--color-primary-glow);
}
.pill.active {
  background: linear-gradient(135deg, var(--color-violet), var(--color-primary));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px var(--color-violet-glow);
}

/* ─── Stats ───────────────────────────────────────────────── */
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  margin-top: var(--space-10);
  padding: var(--space-5) var(--space-8);
  background: var(--glass-bg);
  border: var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-2xl);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  max-width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.stat-item { text-align: center; }
.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.stat-label {
  font-size: var(--text-xs);
  color: var(--color-text);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--space-2);
}
.stat-divider {
  width: 1px; height: 40px;
  background: rgba(0, 0, 0, 0.1);
}
[data-theme="dark"] .stat-divider {
  background: rgba(255, 255, 255, 0.1);
}

/* ─── Sección de Resultados ───────────────────────────────── */
.resultados-section {
  padding: var(--space-8) 0 var(--space-16);
  min-height: 50vh;
  position: relative;
  z-index: 10;
  /* El fondo se eliminó para que el video sea visible detrás de todo el contenido */
}

.resultados-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
}
.resultados-info {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: 500;
}
.select-orden {
  padding: var(--space-2) var(--space-8) var(--space-2) var(--space-3);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  appearance: none;
  outline: none;
}

/* ─── Grid de Libros ──────────────────────────────────────── */
.libros-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
}

/* ─── Card de Libro (Optimizada 60fps sin blur por tarjeta) ── */
.libro-card {
  background: rgba(17, 22, 38, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius-2xl);
  padding: var(--space-5);
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
  will-change: transform;
}
[data-theme="light"] .libro-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(203, 213, 225, 0.85);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.libro-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-violet), var(--color-primary));
  opacity: 0;
  transition: opacity var(--transition-base);
}
.libro-card:hover {
  border-color: rgba(0, 201, 167, 0.45);
  background: rgba(24, 31, 54, 0.96);
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.48), 0 0 16px rgba(132, 94, 194, 0.25);
}
[data-theme="light"] .libro-card:hover {
  background: #ffffff;
  border-color: #0d9488;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.13);
}
.libro-card:hover::before { opacity: 1; }

.libro-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.libro-card-icon {
  width: 48px; height: 48px;
  background: var(--color-violet-light); border: 1px solid rgba(132, 94, 194, 0.25); color: var(--color-primary);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.libro-codigo {
  font-family: monospace;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  background: var(--color-surface);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.libro-titulo {
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.libro-autor {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.libro-editorial {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-bottom: var(--space-4);
}

.libro-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: auto;
}
.libro-stock {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
}
.libro-stock-disponible { color: var(--color-success); }
.libro-stock-sin-stock  { color: var(--color-danger); }

.btn-solicitar {
  padding: var(--space-2) var(--space-4);
  background: linear-gradient(135deg, #10b981, #0ea5e9);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.btn-solicitar:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #34d399, #38bdf8);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.5);
}
.btn-solicitar:disabled {
  background: var(--color-surface);
  color: var(--color-text-faint);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ─── Skeleton Loading ────────────────────────────────────── */
.libro-card-skeleton {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  height: 200px;
  position: relative;
  overflow: hidden;
}
.libro-card-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 25%,
    rgba(0, 210, 196, 0.08) 50%,
    transparent 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
.loading-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
}

/* ─── Estado Vacío ────────────────────────────────────────── */
.estado-vacio {
  text-align: center;
  padding: var(--space-16) var(--space-8);
}
.vacio-icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
  filter: grayscale(0.3);
}
.estado-vacio h3 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-3);
}
.estado-vacio p {
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── Modal Libro: Detalle + Formulario ───────────────────── */
.modal-libro-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.modal-libro-header {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}
.modal-libro-cover {
  width: 64px; height: 80px;
  background: linear-gradient(135deg, var(--color-primary), #6366f1);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}
.modal-libro-meta { flex: 1; }
.modal-libro-titulo {
  font-size: var(--text-xl);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: var(--space-2);
}
.modal-libro-autor {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-3);
}

.modal-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.modal-info-item {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}
.modal-info-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
  margin-bottom: var(--space-1);
  font-weight: 600;
}
.modal-info-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.modal-stock-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  gap: var(--space-3);
  font-weight: 700;
}
.modal-stock-disponible {
  background: var(--color-success-light);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--color-success);
}
.modal-stock-sin-stock {
  background: var(--color-danger-light);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--color-danger);
}

/* Formulario de solicitud dentro del modal */
.form-solicitud {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.form-solicitud-title {
  font-size: var(--text-lg);
  font-weight: 700;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

/* ─── Modal QR ────────────────────────────────────────────── */
.modal-qr {
  max-width: 420px;
  text-align: center;
}
.qr-estado-reservado .qr-icon { color: var(--color-warning); }
.qr-estado-entregado .qr-icon { color: var(--color-success); }
.qr-estado-expirado  .qr-icon { color: var(--color-danger); }

.qr-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.qr-icon { font-size: 2.5rem; }
.qr-titulo { font-size: var(--text-xl); font-weight: 800; }
.qr-subtitulo { color: var(--color-text-muted); font-size: var(--text-sm); }

.qr-code-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  background: #fff;
  border-radius: var(--radius-xl);
  margin: 0 auto var(--space-6);
  box-shadow: var(--shadow-md);
}

.qr-countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-warning);
  font-weight: 600;
  margin-bottom: var(--space-5);
}

.qr-data-list {
  text-align: left;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
}
.qr-data-item {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-border);
}
.qr-data-item:last-child { border-bottom: none; }
.qr-data-key {
  color: var(--color-text-muted);
  font-weight: 500;
  flex-shrink: 0;
}
.qr-data-val {
  color: var(--color-text);
  font-weight: 600;
  text-align: right;
}

.qr-acciones {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

/* Comprobante verde (libro entregado) */
.comprobante-entregado {
  background: linear-gradient(135deg, var(--color-success-light), rgba(5, 150, 105, 0.1));
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
}
.comprobante-check {
  font-size: 3.5rem;
  margin-bottom: var(--space-4);
}
.comprobante-titulo {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--color-success);
  margin-bottom: var(--space-2);
}

/* ─── Chatbot ─────────────────────────────────────────────── */
.chatbot-view {
  padding: calc(var(--header-height) + var(--space-8)) 0 var(--space-16);
  min-height: 100vh;
}

.chatbot-container {
  max-width: 760px;
  margin: 0 auto;
  background: var(--glass-bg);
  border: var(--glass-border);
  backdrop-filter: var(--glass-filter);
  -webkit-backdrop-filter: var(--glass-filter);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: var(--glass-shadow);
}

.chatbot-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  background: var(--color-wine-light); border: 1px solid rgba(159, 18, 57, 0.15); color: var(--color-wine);
  border-bottom: 1px solid var(--color-border);
}
.chatbot-avatar {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--color-primary), #6366f1);
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--color-primary-glow);
}
.chatbot-title {
  font-size: var(--text-lg);
  font-weight: 800;
  margin-bottom: var(--space-1);
}
.chatbot-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.chatbot-messages {
  height: 450px;
  overflow-y: auto;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.msg {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  animation: msgIn var(--transition-base) ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg-bot { align-self: flex-start; }
.msg-user { align-self: flex-end; flex-direction: row-reverse; }

.msg-avatar {
  width: 36px; height: 36px;
  background: var(--color-surface);
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.msg-content {
  max-width: 80%;
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius-xl) var(--radius-sm);
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  line-height: 1.6;
}
.msg-user .msg-content {
  background: linear-gradient(135deg, var(--color-primary), #6366f1);
  color: #fff;
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius-sm) var(--radius-xl);
}
.msg-content p { margin-bottom: var(--space-2); }
.msg-content p:last-child { margin-bottom: 0; }

.msg-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.suggestion-chip {
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--color-text-muted);
}
.suggestion-chip:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Indicador "escribiendo..." */
.msg-typing {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  width: fit-content;
}
.typing-dot {
  width: 8px; height: 8px;
  background: var(--color-text-muted);
  border-radius: var(--radius-full);
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1.2); opacity: 1; }
}

.chatbot-input-area {
  border-top: 1px solid var(--color-border);
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg-secondary);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.input-dni-chat {
  padding: var(--space-2) var(--space-4);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  outline: none;
  transition: all var(--transition-fast);
  width: 100%;
}
.input-dni-chat:focus {
  border-color: var(--color-primary);
  color: var(--color-text);
}

.chatbot-input-row {
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
}
.chatbot-textarea {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-card);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: all var(--transition-fast);
}
.chatbot-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.chatbot-textarea::placeholder { color: var(--color-text-faint); }

.btn-send {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--color-primary), #6366f1);
  border: none;
  border-radius: var(--radius-full);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--color-primary-glow);
}
.btn-send:hover { transform: scale(1.1); }
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ─── Mis Préstamos ───────────────────────────────────────── */
.mis-prestamos-view {
  padding: calc(var(--header-height) + var(--space-8)) 0 var(--space-16);
  min-height: 100vh;
}

.prestamo-card-container {
  max-width: 600px;
  margin: 0 auto;
}

.no-prestamo {
  text-align: center;
  padding: var(--space-16) var(--space-8);
}
.no-prestamo-icon { font-size: 4rem; margin-bottom: var(--space-4); }
.no-prestamo h2 { margin-bottom: var(--space-3); }
.no-prestamo p  { color: var(--color-text-muted); margin-bottom: var(--space-6); }

/* ─── Responsive Multi-Dispositivo (Móvil, Tablet, Desktop) ─────────── */
@media (orientation: portrait) {
  .video-desktop { display: none !important; }
  .video-mobile { display: block !important; }
}

@media (max-width: 768px) {
  .header-inner {
    padding: 0 0.65rem;
    gap: 0.4rem;
    justify-content: space-between;
  }
  .header-brand {
    gap: 0.45rem;
    min-width: 0;
    flex-shrink: 1;
  }
  .header-brand .brand-sub { display: none; }
  .header-brand .brand-name {
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-nav {
    gap: 0.25rem;
    flex-shrink: 0;
  }
  .header-nav .btn-nav .nav-text { display: none; }
  .header-nav .btn-nav {
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-full);
  }
  .header-nav .btn-nav svg { width: 19px; height: 19px; }
  .header-nav .badge-prestamo {
    top: -1px;
    right: -1px;
    width: 17px;
    height: 17px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
  }
  .header-right {
    gap: 4px;
    margin-left: 0;
    flex-shrink: 0;
  }
  .header-right #btn-theme-toggle {
    margin-right: 0 !important;
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
  }
  .estado-conexion { padding: 4px 6px; }
  .estado-conexion span:not(.dot) { display: none; }
  .hero {
    padding: calc(var(--header-height) + 1.25rem) 0.85rem 2rem;
    min-height: auto;
  }
  .hero-title { font-size: clamp(1.65rem, 6vw, 2.2rem); }
  .hero-subtitle { font-size: 0.95rem; margin-bottom: 1.5rem; }
  .search-box {
    padding: 0.35rem 0.4rem 0.35rem 0.85rem;
    border-radius: 1rem;
  }
  .search-input { font-size: 0.95rem; }
  .btn-ia-trigger {
    padding: 0.45rem 0.7rem;
    font-size: 0.78rem;
    border-radius: 0.75rem;
  }
  .categoria-pills {
    max-width: 100%;
    gap: 0.35rem;
  }
  .pill {
    padding: 0.38rem 0.72rem;
    font-size: 0.73rem;
  }
  .hero-stats {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.65rem 1.1rem;
    padding: 0.85rem 1.1rem;
    margin-top: 1.5rem;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 100%;
  }
  .stat-num { font-size: 1.35rem; }
  .stat-label { font-size: 0.65rem; }
  .stat-divider { display: none; }
  .libros-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
  .resultados-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }
  .resultados-controls {
    width: 100%;
  }
  .select-orden {
    width: 100%;
  }
  .filtros-formato-bar {
    gap: 0.4rem;
  }
  .filtro-formato-btn {
    flex: 1 1 auto;
    justify-content: center;
    padding: 0.45rem 0.65rem;
  }
  .modal-info-grid { grid-template-columns: 1fr; }
  .chatbot-messages { height: 340px; }
  .modal {
    padding: 1.15rem;
    width: calc(100% - 16px);
    max-width: 100%;
    max-height: 90dvh;
    margin: 8px;
  }
}

@media (max-width: 580px) {
  .libros-grid {
    grid-template-columns: 1fr !important;
    gap: 0.9rem;
  }
  .loading-grid {
    grid-template-columns: 1fr !important;
  }
  .libro-card {
    padding: 1.1rem;
  }
  .libro-card-footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
  .hero-stats .stat-item:last-child {
    grid-column: 1 / -1;
  }
  .seg-sync-banner {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
  }
  .seg-sync-banner > div:last-child {
    width: 100%;
    flex-direction: column;
  }
  .seg-sync-banner input,
  .seg-sync-banner button {
    width: 100% !important;
  }
}

@media (max-width: 400px) {
  .header-brand .brand-name {
    max-width: 82px;
    font-size: 0.82rem;
  }
  .header-nav .btn-nav {
    width: 34px;
    height: 34px;
  }
  .btn-ia-trigger span {
    display: none;
  }
  .libro-card-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-solicitar, .btn-leer-online {
    width: 100%;
    justify-content: center;
  }
}

/* ─── Search Suggestions (Autocompletado Predictivo Inteligente) ── */
.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  background: #0f1629;
  border: 1.5px solid rgba(0, 201, 167, 0.45);
  border-radius: 16px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.06);
  z-index: 150;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  text-align: left;
}
[data-theme="light"] .search-suggestions {
  background: #ffffff;
  border-color: #0d9488;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
}
.search-suggestions.hidden {
  display: none !important;
}
.sugg-section-header {
  padding: 0.55rem 1rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-primary);
  background: rgba(0, 201, 167, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
[data-theme="light"] .sugg-section-header {
  background: #f0fdfa;
  color: #0f766e;
  border-bottom-color: #e2e8f0;
}
.sugg-cats-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
[data-theme="light"] .sugg-cats-wrap {
  border-bottom-color: #e2e8f0;
}
.sugg-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  background: rgba(132, 94, 194, 0.15);
  border: 1px solid rgba(132, 94, 194, 0.4);
  color: #e2e8f0;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}
.sugg-cat-chip:hover {
  background: linear-gradient(135deg, var(--color-violet), var(--color-primary));
  border-color: transparent;
  color: #ffffff;
  transform: translateY(-1px);
}
[data-theme="light"] .sugg-cat-chip {
  background: #f3e8ff;
  border-color: #c084fc;
  color: #4c1d95;
}
[data-theme="light"] .sugg-cat-chip:hover {
  color: #ffffff;
}
.sugg-cat-stock {
  font-size: 0.68rem;
  font-weight: 600;
  opacity: 0.9;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
}
[data-theme="light"] .sugg-cat-stock {
  background: rgba(255, 255, 255, 0.75);
}
.suggestion-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
[data-theme="light"] .suggestion-item {
  border-bottom-color: #f1f5f9;
}
.suggestion-item:last-child {
  border-bottom: none;
}
.suggestion-item:hover,
.suggestion-item.active-key {
  background: rgba(0, 201, 167, 0.14);
}
[data-theme="light"] .suggestion-item:hover,
[data-theme="light"] .suggestion-item.active-key {
  background: #f0fdfa;
}
.sugg-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(132, 94, 194, 0.14);
  border: 1px solid rgba(132, 94, 194, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  flex-shrink: 0;
}
.sugg-icon svg {
  width: 20px;
  height: 20px;
}
.sugg-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.sugg-title {
  font-weight: 700;
  color: #f8fafc;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="light"] .sugg-title {
  color: #0f172a;
}
.sugg-hl {
  background: rgba(0, 201, 167, 0.28);
  color: #5eead4;
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 800;
}
[data-theme="light"] .sugg-hl {
  background: #ccfbf1;
  color: #0f766e;
}
.sugg-author {
  font-size: 0.76rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sugg-meta-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}
.sugg-badge-fisico {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  white-space: nowrap;
}
[data-theme="light"] .sugg-badge-fisico {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}
.sugg-badge-digital {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.16);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.4);
  white-space: nowrap;
}
[data-theme="light"] .sugg-badge-digital {
  background: #cffafe;
  color: #0e7490;
  border-color: #67e8f9;
}
.sugg-footer-action {
  padding: 0.65rem 1rem;
  background: rgba(15, 23, 42, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease;
}
.sugg-footer-action:hover {
  background: rgba(0, 201, 167, 0.15);
}
[data-theme="light"] .sugg-footer-action {
  background: #f8fafc;
  border-top-color: #e2e8f0;
  color: #0d9488;
}

/* ─── Banner Autónomo de Categoría / Stock Físico y Digital ── */
.active-filter-banner {
  background: rgba(15, 22, 38, 0.92);
  border: 1.5px solid rgba(0, 201, 167, 0.38);
  border-radius: 14px;
  padding: 0.85rem 1.15rem;
  margin-bottom: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
}
[data-theme="light"] .active-filter-banner {
  background: #ffffff;
  border-color: #14b8a6;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}
.active-filter-banner.auto-expanded-notice {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(30, 24, 16, 0.94);
}
[data-theme="light"] .active-filter-banner.auto-expanded-notice {
  background: #fffbeb;
  border-color: #f59e0b;
}
.afb-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex: 1;
}
.afb-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.afb-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.afb-stock-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.16s ease;
}
.afb-stock-chip.chip-fisico {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}
[data-theme="light"] .afb-stock-chip.chip-fisico {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}
.afb-stock-chip.chip-digital {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.4);
  color: #22d3ee;
}
[data-theme="light"] .afb-stock-chip.chip-digital {
  background: #cffafe;
  border-color: #67e8f9;
  color: #155e75;
}
.afb-stock-chip.active-fmt {
  box-shadow: 0 0 0 2px var(--color-primary);
  transform: scale(1.03);
}
.afb-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.8rem;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.afb-clear-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ffffff;
}
[data-theme="light"] .afb-clear-btn {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}
.pill-count {
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.85;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}
[data-theme="light"] .pill:not(.active) .pill-count {
  background: rgba(15, 23, 42, 0.08);
}

/* ─── Favoritos (Mi Estante) ──────────────────────────────── */
.btn-fav {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-fav:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--color-primary);
}
.btn-fav.active {
  color: #ef4444;
}
.btn-fav.active:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ════════════════════════════════════════════════════════════
   DISEÑO PREMIUM: TRANSICIONES Y ANIMACIONES
   ════════════════════════════════════════════════════════════ */

/* ─── Animaciones de Entrada Staggered para Cards de Libros ─── */
.libros-grid .libro-card {
  animation: cardEntrance 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.libros-grid .libro-card:nth-child(1) { animation-delay: 40ms; }
.libros-grid .libro-card:nth-child(2) { animation-delay: 80ms; }
.libros-grid .libro-card:nth-child(3) { animation-delay: 120ms; }
.libros-grid .libro-card:nth-child(4) { animation-delay: 160ms; }
.libros-grid .libro-card:nth-child(5) { animation-delay: 200ms; }
.libros-grid .libro-card:nth-child(6) { animation-delay: 240ms; }
.libros-grid .libro-card:nth-child(n+7) { animation-delay: 280ms; }

/* ─── Transición de Paneles ─── */
.tab-pane-transition {
  animation: fadeInPane 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fadeInPane {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Shimmer Skeleton Refinado ─── */
.libro-card-skeleton::after {
  background: linear-gradient(90deg,
    transparent 25%,
    rgba(0, 210, 196, 0.08) 50%,
    transparent 75%
  );
}

/* ─── Iconos PNG de Categorías ─── */
.cat-icon-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  vertical-align: middle;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  transition: transform var(--transition-fast, 0.2s) ease;
}

.libro-card-icon {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid var(--color-border) !important;
  padding: 6px;
}

.libro-card-icon .cat-icon-img {
  width: 34px;
  height: 34px;
}

.modal-libro-cover {
  width: 76px !important;
  height: 76px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-xl) !important;
}

.modal-libro-cover .cat-icon-img {
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.pill .cat-icon-img {
  width: 20px;
  height: 20px;
}

.libro-card:hover .cat-icon-img {
  transform: scale(1.15) rotate(-4deg);
}

/* ════════════════════════════════════════════════════════════
   BIBLIOTECA HÍBRIDA — Estilos adicionales (v1.0.0)
   Añadidos SOBRE el diseño base sin modificar nada existente
   ════════════════════════════════════════════════════════════ */

/* ─── Card Digital: borde y acento cian-azul (sin emojis) ──── */
.libro-card[data-formato="Digital"] {
  border-color: rgba(6, 182, 212, 0.35);
}
.libro-card[data-formato="Digital"]::before {
  background: linear-gradient(90deg, #06b6d4, #3b82f6);
}
.libro-card[data-formato="Digital"]:hover {
  border-color: rgba(6, 182, 212, 0.7);
  box-shadow:
    0 16px 40px rgba(6, 182, 212, 0.18),
    0 0 0 1px rgba(6, 182, 212, 0.25);
}

/* ─── Badge: Acceso Abierto PDF ───────────────────────────── */
.badge-digital {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 7px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(59, 130, 246, 0.15));
  border: 1px solid rgba(6, 182, 212, 0.5);
  border-radius: var(--radius-full);
  color: #06b6d4;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  animation: shineDigital 3s ease-in-out infinite;
}
[data-theme="dark"] .badge-digital {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(59, 130, 246, 0.2));
  border-color: rgba(6, 182, 212, 0.6);
  color: #22d3ee;
}
@keyframes shineDigital {
  0%, 100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); }
  50%       { box-shadow: 0 0 12px 2px rgba(6, 182, 212, 0.35); }
}

/* ─── Botón: Leer en Línea ─────────────────────────────────── */
.btn-leer-online {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: linear-gradient(135deg, #6366f1, #d946ef);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-base);
  box-shadow: 0 4px 12px rgba(217, 70, 239, 0.35);
  white-space: nowrap;
}
.btn-leer-online:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 24px rgba(217, 70, 239, 0.55);
  background: linear-gradient(135deg, #818cf8, #e879f9);
  color: #fff;
  text-decoration: none;
}
.btn-leer-online:active {
  transform: translateY(0);
}

/* ─── Panel de Filtros por Formato ────────────────────────── */
.filtros-formato-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}
.filtros-formato-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.filtro-formato-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.filtro-formato-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-text);
  background: var(--color-bg-card-hover);
}
.filtro-formato-btn.activo-todos {
  background: linear-gradient(135deg, var(--color-violet), var(--color-primary));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px var(--color-violet-glow);
}
.filtro-formato-btn.activo-fisico {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35);
}
.filtro-formato-btn.activo-digital {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.35);
}
.filtro-formato-btn .filtro-count {
  background: rgba(255,255,255,0.25);
  border-radius: var(--radius-full);
  padding: 1px 7px;
  font-size: 0.65rem;
  font-weight: 800;
}
.filtro-formato-btn:not(.activo-todos):not(.activo-fisico):not(.activo-digital) .filtro-count {
  background: var(--color-surface);
  color: var(--color-text-muted);
}

/* ─── Transición de filtrado de cards ─────────────────────── */
.libro-card.oculto-filtro {
  display: none;
}

/* ─── Stats Híbridos en el Hero ───────────────────────────── */
.stat-num.stat-digital {
  color: #06b6d4;
}
[data-theme="dark"] .stat-num.stat-digital {
  color: #22d3ee;
}
.stat-num.stat-fisico {
  color: var(--color-wine);
}
[data-theme="dark"] .stat-num.stat-fisico {
  color: var(--color-primary);
}

/* ─── Modal Detalle: sección Digital ──────────────────────── */
.modal-digital-access {
  background: linear-gradient(135deg,
    rgba(6, 182, 212, 0.08),
    rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  margin-top: var(--space-4);
  text-align: center;
}
.modal-digital-access .badge-digital {
  margin-bottom: var(--space-3);
  font-size: 0.8rem;
  padding: 5px 14px 5px 10px;
}
.modal-digital-access p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  line-height: 1.6;
}
.modal-digital-access .btn-leer-online {
  width: 100%;
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}

/* ─── Ícono de libro digital en la card ───────────────────── */
.libro-codigo.codigo-digital {
  background: linear-gradient(135deg, rgba(6,182,212,0.1), rgba(59,130,246,0.1));
  border: 1px solid rgba(6,182,212,0.3);
  color: #06b6d4;
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  font-size: 0.65rem;
}
[data-theme="dark"] .libro-codigo.codigo-digital {
  color: #22d3ee;
  background: linear-gradient(135deg, rgba(6,182,212,0.15), rgba(59,130,246,0.15));
}


/* ─── Íconos vectoriales de categorías (.cat-icon-svg) ──── */
.cat-icon-svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.pill .cat-icon-svg {
  width: 1.15em;
  height: 1.15em;
}
.libro-card-icon .cat-icon-svg {
  width: 30px;
  height: 30px;
}
.modal-libro-cover .cat-icon-svg {
  width: 48px;
  height: 48px;
}

/* ══════════════════════════════════════════════════════════════
   Seguridad Estudiantil & Modal de PIN (Dark & Light Friendly)
   ══════════════════════════════════════════════════════════════ */
.seg-modal-dialog {
  padding: 0.5rem 0.25rem;
}

.seg-modal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.seg-modal-icon-badge {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
  color: #ffffff;
}

.seg-modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  color: var(--color-text);
}

.seg-modal-subtitle {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.45;
}

.seg-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 64vh;
  overflow-y: auto;
  padding-right: 0.35rem;
}

/* 4 Bloques institucionales con contraste de alta precisión */
.seg-box {
  border-radius: 14px;
  padding: 1.05rem 1.25rem;
  transition: transform var(--transition-fast) ease, box-shadow var(--transition-fast) ease;
}

.seg-box-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 0.94rem;
  margin-bottom: 0.45rem;
  font-family: var(--font-display);
}

.seg-box-content {
  font-size: 0.84rem;
  line-height: 1.62;
  color: var(--color-text);
}

.seg-box-content ul {
  margin: 0;
  padding-left: 1.2rem;
}

.seg-box-content li {
  margin-bottom: 0.35rem;
}

.seg-box-content li:last-child {
  margin-bottom: 0;
}

/* Temas específicos para los 4 bloques */
/* 1. Azul: Validación y Límites */
.seg-box-blue {
  background: rgba(30, 58, 138, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.35);
}
.seg-box-blue .seg-box-head { color: #60a5fa; }
[data-theme="light"] .seg-box-blue {
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.04);
}
[data-theme="light"] .seg-box-blue .seg-box-head { color: #1e40af; }
[data-theme="light"] .seg-box-blue .seg-box-content { color: #1e293b; }

/* 2. Verde: Cambio de Equipo y Atención */
.seg-box-green {
  background: rgba(6, 78, 59, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.seg-box-green .seg-box-head { color: #34d399; }
[data-theme="light"] .seg-box-green {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.04);
}
[data-theme="light"] .seg-box-green .seg-box-head { color: #065f46; }
[data-theme="light"] .seg-box-green .seg-box-content { color: #1e293b; }

/* 3. Violeta: Privacidad */
.seg-box-purple {
  background: rgba(88, 28, 135, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.35);
}
.seg-box-purple .seg-box-head { color: #c084fc; }
[data-theme="light"] .seg-box-purple {
  background: #faf5ff;
  border: 1px solid #e9d5ff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.04);
}
[data-theme="light"] .seg-box-purple .seg-box-head { color: #581c87; }
[data-theme="light"] .seg-box-purple .seg-box-content { color: #1e293b; }

/* 4. Ámbar / Dorado: Normas y Ética */
.seg-box-amber {
  background: rgba(120, 53, 15, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.seg-box-amber .seg-box-head { color: #fbbf24; }
[data-theme="light"] .seg-box-amber {
  background: #fffbeb;
  border: 1px solid #fde68a;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.04);
}
[data-theme="light"] .seg-box-amber .seg-box-head { color: #92400e; }
[data-theme="light"] .seg-box-amber .seg-box-content { color: #1e293b; }

/* Barra de sincronización en Mi Préstamo adaptada a temas */
.seg-sync-banner {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}
[data-theme="light"] .seg-sync-banner {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.06);
}

.seg-badge-pill {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.seg-badge-pill-success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
[data-theme="light"] .seg-badge-pill-success {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

.seg-help-link-btn {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast) ease;
}
.seg-help-link-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  transform: translateY(-1px);
}
[data-theme="light"] .seg-help-link-btn {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0369a1;
}
[data-theme="light"] .seg-help-link-btn:hover {
  background: #e0f2fe;
}

