/* ==========================================================================
   assets/css/frontend.css - Sistema de Repositorio Institucional
   Diseño de Alto Impacto Visual, Modular y Responsive
   ========================================================================== */

:root {
  --rep-primary: #0f2942;
  --rep-primary-hover: #0a1c2e;
  --rep-secondary: #1d68bd;
  --rep-accent: #f59e0b;
  --rep-dark: #0f172a;
  --rep-surface: #f8fafc;
  --rep-border: #e2e8f0;
  --rep-text-muted: #64748b;
  --rep-radius-sm: 6px;
  --rep-radius-md: 10px;
  --rep-radius-lg: 16px;
  --rep-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --rep-shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
  --rep-shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.12), 0 4px 8px -2px rgba(15, 23, 42, 0.06);
  --rep-transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.rep-container {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 24px 16px;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--rep-dark);
  line-height: 1.5;
}

.rep-container * {
  box-sizing: border-box;
}

/* ==========================================
   1. HERO INSTITUCIONAL
   ========================================== */
.rep-hero {
  background: linear-gradient(135deg, var(--rep-primary) 0%, var(--rep-primary-hover) 100%);
  color: #ffffff;
  border-radius: var(--rep-radius-lg);
  padding: 44px 36px;
  margin-bottom: 32px;
  box-shadow: var(--rep-shadow-lg);
  position: relative;
  overflow: hidden;
}

.rep-hero::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.rep-hero-badge {
  display: inline-block;
  background: var(--rep-secondary);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.rep-hero-title {
  font-size: 32px;
  font-weight: 800;
  margin: 0 0 10px 0;
  color: #ffffff;
  line-height: 1.25;
  letter-spacing: -0.5px;
}

.rep-hero-desc {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  max-width: 820px;
  margin: 0 0 32px 0;
  line-height: 1.6;
}

/* Indicadores Métricos */
.rep-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.rep-stat-box {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--rep-radius-md);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  transition: var(--rep-transition);
}

.rep-stat-box:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}

.rep-stat-icon {
  font-size: 20px;
  margin-bottom: 6px;
}

.rep-stat-num {
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.rep-stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 4px;
  font-weight: 500;
}

/* ==========================================
   2. SECCIÓN DE BÚSQUEDA Y FILTROS
   ========================================== */
.rep-search-section {
  background: #ffffff;
  border: 1px solid var(--rep-border);
  border-radius: var(--rep-radius-lg);
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--rep-shadow-sm);
}

.rep-search-main {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.rep-container .rep-search-input,
.rep-search-input {
  flex: 1;
  width: 100%;
  height: 48px;
  padding: 0 18px !important;
  border: 1.5px solid var(--rep-border);
  border-radius: var(--rep-radius-md);
  font-size: 15px;
  color: var(--rep-dark);
  background: var(--rep-surface);
  transition: var(--rep-transition);
  font-family: inherit;
  box-sizing: border-box;
}

.rep-container .rep-search-input:focus,
.rep-search-input:focus {
  outline: none;
  border-color: var(--rep-secondary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(29, 104, 189, 0.15);
}

.rep-search-submit {
  height: 48px;
  padding: 0 24px;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  white-space: nowrap;
}

.rep-filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.rep-filter-item label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--rep-text-muted);
  margin-bottom: 6px;
}

.rep-select {
  width: 100%;
  height: 40px;
  border: 1.5px solid var(--rep-border);
  border-radius: var(--rep-radius-sm);
  padding: 0 12px;
  font-size: 13.5px;
  color: var(--rep-dark);
  background-color: var(--rep-surface);
  transition: var(--rep-transition);
  font-family: inherit;
  cursor: pointer;
}

.rep-select:focus {
  outline: none;
  border-color: var(--rep-secondary);
  background-color: #ffffff;
}

/* ==========================================
   3. BOTONES Y ELEMENTOS DE ACCIÓN
   ========================================== */
.rep-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--rep-radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--rep-transition);
  font-family: inherit;
  line-height: 1;
}

.rep-btn-primary {
  background: var(--rep-primary);
  color: #ffffff !important;
}

.rep-btn-primary:hover {
  background: var(--rep-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 41, 66, 0.2);
}

.rep-btn-secondary {
  background: var(--rep-secondary);
  color: #ffffff !important;
}

.rep-btn-secondary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.rep-btn-outline {
  background: transparent;
  border: 1.5px solid var(--rep-border);
  color: var(--rep-dark) !important;
}

.rep-btn-outline:hover {
  background: var(--rep-surface);
  border-color: #cbd5e1;
}

/* ==========================================
   4. CUADRÍCULA Y TARJETAS DE DOCUMENTOS
   ========================================== */
.rep-results-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
  border-bottom: 1.5px solid var(--rep-border);
  padding-bottom: 12px;
}

.rep-results-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: var(--rep-dark);
}

.rep-results-count {
  font-size: 13px;
  color: var(--rep-text-muted);
}

.rep-docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.rep-card {
  background: #ffffff;
  border: 1px solid var(--rep-border);
  border-radius: var(--rep-radius-md);
  padding: 0;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  box-shadow: var(--rep-shadow-sm);
  position: relative;
  overflow: hidden;
}

.rep-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--rep-primary);
  border-radius: var(--rep-radius-md) var(--rep-radius-md) 0 0;
  transition: var(--rep-transition);
  z-index: 4;
}

.rep-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px -8px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.05);
  border-color: #cbd5e1;
}

.rep-card:hover::before {
  background: var(--rep-secondary);
}

.rep-card.is-destacado::before {
  background: var(--rep-accent);
  height: 5px;
}

/* Portada y Placeholder de Tarjeta */
.rep-card-cover-link {
  display: block;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.rep-card-cover {
  position: relative;
  height: 195px;
  width: 100%;
  overflow: hidden;
  background: #0f172a;
}

.rep-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.rep-card:hover .rep-card-img {
  transform: scale(1.05);
}

.rep-card-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.05) 0%, rgba(15, 23, 42, 0.25) 55%, rgba(15, 23, 42, 0.75) 100%);
  pointer-events: none;
}

.rep-card-cover-placeholder {
  position: relative;
  height: 135px;
  width: 100%;
  overflow: hidden;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.rep-placeholder-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image: radial-gradient(#94a3b8 1px, transparent 1px);
  background-size: 16px 16px;
}

.rep-placeholder-icon {
  color: rgba(255, 255, 255, 0.6);
  z-index: 1;
  transition: transform 0.3s ease, color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rep-card:hover .rep-placeholder-icon {
  transform: scale(1.12);
  color: #ffffff;
}

.rep-card-floating-badges {
  position: absolute;
  bottom: 12px;
  left: 14px;
  display: flex;
  gap: 6px;
  z-index: 3;
}

.rep-card-floating-badges .rep-badge-tipo {
  background: rgba(14, 165, 233, 0.95);
  color: #ffffff;
  font-weight: 700;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.rep-card-floating-badges .rep-badge-anio {
  background: rgba(15, 23, 42, 0.8);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Cuerpo de la Tarjeta */
.rep-card-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.rep-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.rep-card-career-badge {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  background: var(--rep-surface);
  border: 1px solid var(--rep-border);
  padding: 3px 9px;
  border-radius: 4px;
  max-width: 68%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rep-card-badges {
  display: flex;
  gap: 6px;
  align-items: center;
}

.rep-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}

.rep-badge-tipo {
  background: #e0f2fe;
  color: #0369a1;
}

.rep-badge-anio {
  background: var(--rep-surface);
  color: var(--rep-text-muted);
  border: 1px solid var(--rep-border);
}

.rep-access-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.rep-access-open {
  background: #dcfce7;
  color: #166534;
}

.rep-access-locked {
  background: #fee2e2;
  color: #991b1b;
}

.rep-card-title {
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 10px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rep-card-title a {
  color: var(--rep-dark);
  text-decoration: none;
  transition: color 0.15s ease;
}

.rep-card-title a:hover {
  color: var(--rep-secondary);
}

.rep-card-meta {
  margin-bottom: 12px;
  font-size: 12.5px;
  color: var(--rep-text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rep-meta-author,
.rep-meta-advisor {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rep-card-excerpt {
  font-size: 13px;
  color: #475569;
  line-height: 1.55;
  margin: 0 0 16px 0;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rep-card-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--rep-border);
  padding: 10px 0 14px 0;
  font-size: 12px;
  color: var(--rep-text-muted);
  margin-top: auto;
}

.rep-card-degree {
  font-weight: 600;
  color: #475569;
  max-width: 65%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rep-card-stats {
  display: flex;
  gap: 8px;
}

.rep-card-actions {
  display: flex;
  gap: 8px;
}

.rep-card-btn {
  flex: 1;
}

/* ==========================================
   5. VISTA DE DETALLE DE DOCUMENTO
   ========================================== */
.rep-breadcrumb {
  margin-bottom: 24px;
  font-size: 13px;
}

.rep-breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.rep-breadcrumb a {
  color: var(--rep-secondary);
  text-decoration: none;
}

.rep-breadcrumb a:hover {
  text-decoration: underline;
}

.rep-breadcrumb .is-active {
  color: var(--rep-text-muted);
  font-weight: 500;
}

.rep-detail-header {
  background: #ffffff;
  border: 1px solid var(--rep-border);
  border-radius: var(--rep-radius-lg);
  padding: 32px;
  margin-bottom: 28px;
  box-shadow: var(--rep-shadow-sm);
}

.rep-detail-header.has-cover {
  display: flex;
  flex-wrap: wrap;
  gap: 26px 30px;
  align-items: flex-start;
}

.rep-detail-cover-box {
  width: 175px;
  min-width: 175px;
  height: 245px;
  border-radius: var(--rep-radius-md);
  overflow: hidden;
  box-shadow: 0 12px 28px -4px rgba(15, 23, 42, 0.22), 0 4px 10px -2px rgba(15, 23, 42, 0.08);
  border: 3px solid #ffffff;
  background: #0f172a;
  flex-shrink: 0;
}

.rep-detail-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform 0.35s ease;
}

.rep-detail-cover-box:hover .rep-detail-cover-img {
  transform: scale(1.04);
}

.rep-detail-header-info {
  flex: 1;
  min-width: 280px;
}

.rep-detail-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.rep-detail-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--rep-dark);
  line-height: 1.3;
  margin: 0 0 20px 0;
  letter-spacing: -0.3px;
}

.rep-detail-authors-box {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  background: var(--rep-surface);
  border-radius: var(--rep-radius-sm);
  padding: 14px 18px;
  margin-bottom: 24px;
}

.rep-detail-author-item {
  font-size: 14px;
}

.rep-author-label {
  color: var(--rep-text-muted);
  margin-right: 6px;
}

.rep-detail-action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--rep-border);
  padding-top: 20px;
}

.rep-btn-download {
  background: var(--rep-primary);
  font-size: 14.5px;
  height: 44px;
  padding: 0 22px;
}

.rep-restricted-notice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: #991b1b;
  background: #fee2e2;
  padding: 8px 14px;
  border-radius: var(--rep-radius-sm);
  font-weight: 600;
}

.rep-btn-view-restricted {
  font-size: 14px;
  height: 44px;
  padding: 0 20px;
}

.rep-share-box {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rep-share-title {
  font-size: 12px;
  color: var(--rep-text-muted);
  font-weight: 600;
  margin-right: 4px;
}

.rep-share-btn {
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 4px;
  text-decoration: none;
  background: var(--rep-surface);
  border: 1px solid var(--rep-border);
  color: var(--rep-dark);
  transition: var(--rep-transition);
  cursor: pointer;
}

.rep-share-btn:hover {
  background: #e2e8f0;
}

.rep-share-wa:hover { background: #25d366; color:#fff; border-color:#25d366; }
.rep-share-in:hover { background: #0a66c2; color:#fff; border-color:#0a66c2; }
.rep-share-tw:hover { background: #000000; color:#fff; border-color:#000000; }

/* Grid de Detalle */
.rep-detail-grid {
  display: grid;
  grid-template-columns: 2.3fr 1fr;
  gap: 28px;
}

.rep-content-card {
  background: #ffffff;
  border: 1px solid var(--rep-border);
  border-radius: var(--rep-radius-md);
  padding: 26px;
  margin-bottom: 24px;
  box-shadow: var(--rep-shadow-sm);
}

.rep-section-heading {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 16px 0;
  color: var(--rep-dark);
  border-bottom: 1.5px solid var(--rep-border);
  padding-bottom: 10px;
}

.rep-abstract-body {
  font-size: 14.5px;
  line-height: 1.7;
  color: #334155;
}

/* Visor Embebido PDF */
.rep-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.rep-pdf-container {
  width: 100%;
  height: 650px;
  border-radius: var(--rep-radius-sm);
  overflow: hidden;
  border: 1px solid var(--rep-border);
  background: #525659;
}

.rep-pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.rep-pdf-fallback {
  font-size: 13px;
  color: var(--rep-text-muted);
  margin-top: 12px;
  text-align: center;
}

.rep-link-download {
  color: var(--rep-secondary);
  font-weight: 600;
  text-decoration: underline;
}

/* Visor protegido para documentos de acceso restringido */
.rep-pdf-protected-notice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 5px 10px;
  border: 1px solid #fecaca;
  border-radius: 999px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
}

.rep-pdf-container--protected {
  background: #1e293b;
}

.rep-pdf-protected {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: #334155;
  outline: none;
}

.rep-pdf-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  padding: 9px 12px;
  background: #0f172a;
  color: #e2e8f0;
  border-bottom: 1px solid #334155;
  user-select: none;
}

.rep-pdf-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid #475569;
  border-radius: 6px;
  background: #1e293b;
  color: #f8fafc;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}

.rep-pdf-tool-btn:hover:not(:disabled) {
  background: #475569;
  border-color: #64748b;
}

.rep-pdf-tool-btn:focus-visible {
  outline: 2px solid var(--rep-accent);
  outline-offset: 2px;
}

.rep-pdf-tool-btn:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.rep-pdf-page-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 5px;
  font-size: 12px;
  color: #cbd5e1;
  white-space: nowrap;
}

.rep-pdf-page-input {
  width: 52px;
  height: 28px;
  padding: 2px 4px;
  border: 1px solid #475569;
  border-radius: 5px;
  background: #1e293b;
  color: #f8fafc;
  font-size: 12px;
  text-align: center;
}

.rep-pdf-page-input:focus {
  border-color: var(--rep-accent);
  outline: 2px solid rgba(245, 158, 11, .35);
  outline-offset: 1px;
}

.rep-pdf-toolbar-spacer {
  flex: 1 1 auto;
}

.rep-pdf-zoom-label {
  min-width: 42px;
  font-size: 11.5px;
  color: #cbd5e1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.rep-pdf-status {
  flex-shrink: 0;
  padding: 8px 14px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  color: #cbd5e1;
  font-size: 12px;
  text-align: center;
}

.rep-pdf-status.is-error {
  color: #fecaca;
  background: #450a0a;
}

.rep-pdf-status.is-hidden {
  display: none;
}

.rep-pdf-canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 18px;
  background: #475569;
  overscroll-behavior: contain;
}

.rep-pdf-canvas {
  display: block;
  flex: 0 0 auto;
  background: #ffffff;
  box-shadow: 0 10px 32px rgba(0, 0, 0, .38);
  user-select: none;
  -webkit-user-drag: none;
}

.rep-pdf-fallback-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.rep-pdf-protected ::selection {
  background: transparent;
}

@media (max-width: 640px) {
  .rep-pdf-toolbar {
    gap: 4px;
    padding: 8px;
  }

  .rep-pdf-page-group {
    font-size: 11px;
  }

  .rep-pdf-canvas-wrap {
    padding: 8px;
  }
}

@media print {
  .rep-pdf-protected,
  .rep-pdf-protected-notice {
    display: none !important;
  }
  .rep-container {
    width: auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* Tabla Dublin Core */
.rep-table-dublincore {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.rep-table-dublincore th,
.rep-table-dublincore td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--rep-border);
  text-align: left;
}

.rep-table-dublincore th {
  width: 28%;
  color: var(--rep-text-muted);
  font-weight: 600;
  background: var(--rep-surface);
}

.rep-table-dublincore td {
  color: var(--rep-dark);
}

.rep-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rep-tag-pill {
  background: var(--rep-surface);
  border: 1px solid var(--rep-border);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--rep-dark);
}

/* Trabajos Relacionados */
.rep-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.rep-related-item {
  background: var(--rep-surface);
  border: 1px solid var(--rep-border);
  border-radius: var(--rep-radius-sm);
  padding: 14px;
}

.rep-related-title {
  font-size: 13.5px;
  margin: 6px 0;
  line-height: 1.35;
}

.rep-related-title a {
  color: var(--rep-dark);
  text-decoration: none;
}

.rep-related-title a:hover {
  color: var(--rep-secondary);
}

.rep-related-author {
  font-size: 11.5px;
  color: var(--rep-text-muted);
}

/* Sidebar de Detalle */
.rep-sidebar-card {
  background: #ffffff;
  border: 1px solid var(--rep-border);
  border-radius: var(--rep-radius-md);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--rep-shadow-sm);
}

.rep-sidebar-cover-card {
  text-align: center;
}

.rep-sidebar-cover-wrap {
  display: block;
  padding: 10px;
  background: var(--rep-surface);
  border: 1px solid var(--rep-border);
  border-radius: var(--rep-radius-sm);
}

.rep-sidebar-cover-img {
  max-width: 100%;
  max-height: 270px;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
  display: inline-block;
  vertical-align: middle;
  transition: transform 0.25s ease;
}

.rep-sidebar-cover-img:hover {
  transform: scale(1.02);
}

.rep-sidebar-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 14px 0;
  color: var(--rep-dark);
  border-bottom: 1px solid var(--rep-border);
  padding-bottom: 8px;
}

.rep-sidebar-stats-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rep-sidebar-stat-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rep-sidebar-stat-icon {
  font-size: 22px;
}

.rep-sidebar-stat-num {
  font-size: 18px;
  font-weight: 800;
  display: block;
  color: var(--rep-dark);
}

.rep-sidebar-stat-label {
  font-size: 11.5px;
  color: var(--rep-text-muted);
}

.rep-file-info-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==========================================
   6. MODAL DE CITAS BIBLIOGRÁFICAS
   ========================================== */
.rep-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.rep-modal-card {
  background: #ffffff;
  border-radius: var(--rep-radius-lg);
  max-width: 650px;
  width: 100%;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.25);
  overflow: hidden;
  animation: repModalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes repModalFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.rep-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--rep-border);
}

.rep-modal-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--rep-dark);
}

.rep-modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--rep-text-muted);
  cursor: pointer;
  padding: 4px;
}

.rep-modal-body {
  padding: 24px;
}

.rep-modal-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--rep-dark);
  margin: 0 0 16px 0;
  line-height: 1.4;
}

.rep-citation-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--rep-border);
  padding-bottom: 8px;
}

.rep-tab-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--rep-text-muted);
  border-radius: var(--rep-radius-sm);
  cursor: pointer;
  transition: var(--rep-transition);
  font-family: inherit;
}

.rep-tab-btn.is-active {
  background: var(--rep-surface);
  color: var(--rep-secondary);
  border-bottom: 2px solid var(--rep-secondary);
}

.rep-tab-pane {
  display: none;
}

.rep-tab-pane.is-active {
  display: block;
}

.rep-citation-box {
  background: var(--rep-surface);
  border: 1px solid var(--rep-border);
  border-radius: var(--rep-radius-sm);
  padding: 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--rep-dark);
  user-select: all;
  min-height: 80px;
}

.rep-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--rep-border);
  background: var(--rep-surface);
}

/* Toast Notificación */
.rep-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--rep-radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3);
  z-index: 1000000;
  animation: repToastIn 0.3s ease;
}

@keyframes repToastIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   7. PAGINACIÓN Y ESTADOS VACÍOS
   ========================================== */
.rep-pagination {
  margin-top: 36px;
  display: flex;
  justify-content: center;
}

.rep-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  margin: 0 3px;
  border: 1.5px solid var(--rep-border);
  border-radius: var(--rep-radius-sm);
  color: var(--rep-dark);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  transition: var(--rep-transition);
}

.rep-pagination .page-numbers:hover {
  background: var(--rep-surface);
  border-color: var(--rep-secondary);
}

.rep-pagination .page-numbers.current {
  background: var(--rep-primary);
  color: #ffffff;
  border-color: var(--rep-primary);
}

.rep-empty-state {
  text-align: center;
  padding: 60px 20px;
  grid-column: 1 / -1;
  background: #ffffff;
  border: 1.5px dashed var(--rep-border);
  border-radius: var(--rep-radius-md);
}

.rep-empty-icon {
  font-size: 44px;
  margin-bottom: 12px;
}

/* ==========================================
   8. MEDIA QUERIES (RESPONSIVE)
   ========================================== */
@media (max-width: 900px) {
  .rep-detail-grid {
    grid-template-columns: 1fr;
  }
  .rep-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .rep-filter-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .rep-hero {
    padding: 30px 20px;
  }
  .rep-hero-title {
    font-size: 24px;
  }
}

@media (max-width: 640px) {
  .rep-container {
    padding: 16px 12px;
  }
  .rep-hero {
    padding: 24px 18px;
    margin-bottom: 22px;
  }
  .rep-hero-title {
    font-size: 22px;
  }
  .rep-hero-desc {
    font-size: 14.5px;
    margin-bottom: 22px;
  }
  .rep-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
  }
  .rep-stat-box {
    padding: 12px 14px;
  }
  .rep-stat-num {
    font-size: 22px;
  }
  .rep-stat-label {
    font-size: 11.5px;
  }
  .rep-search-section {
    padding: 16px;
    margin-bottom: 24px;
  }
  .rep-search-main {
    flex-direction: column;
    gap: 10px;
  }
  .rep-container .rep-search-input {
    flex: 0 0 auto;
    width: 100%;
    height: 46px;
    font-size: 16px; /* 16px evita el zoom automático al escribir en iPhone */
  }
  .rep-search-submit {
    width: 100%;
    height: 46px;
  }
  .rep-filter-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .rep-select {
    height: 44px;
    font-size: 16px;
  }
  .rep-results-header {
    flex-wrap: wrap;
    gap: 4px;
  }
  .rep-docs-grid {
    grid-template-columns: 1fr;
  }
  .rep-detail-header.has-cover {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .rep-detail-cover-box {
    width: 150px;
    height: 215px;
    margin-bottom: 8px;
  }
  .rep-detail-badges {
    justify-content: center;
  }
  .rep-detail-authors-box {
    justify-content: center;
    text-align: left;
  }
  .rep-table-dublincore th,
  .rep-table-dublincore td {
    display: block;
    width: 100%;
  }
  .rep-table-dublincore th {
    border-bottom: none;
    padding-bottom: 4px;
  }
  .rep-table-dublincore td {
    padding-top: 0;
  }
  .rep-detail-action-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .rep-share-box {
    margin-left: 0;
    margin-top: 10px;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .rep-hero {
    padding: 20px 14px;
  }
  .rep-hero-title {
    font-size: 20px;
  }
  .rep-hero-badge {
    font-size: 10px;
    letter-spacing: 0.6px;
  }
  .rep-stat-box {
    padding: 10px 12px;
  }
  .rep-stat-num {
    font-size: 20px;
  }
  .rep-search-section {
    padding: 14px;
  }
  .rep-detail-header {
    padding: 20px 16px;
  }
  .rep-detail-title {
    font-size: 21px;
  }
}
