/* ======= ESTILOS GENERALES ======= */
@font-face {
  font-family: "Avenir Black";
  src: url("fonts/Avenir-Black.woff2") format("woff2"),
       url("fonts/Avenir-Black.woff") format("woff");
  font-weight: 900;
  font-style: normal;
}

@font-face {
  font-family: "Avenir";
  src: url("fonts/Avenir-Regular.woff2") format("woff2"),
       url("fonts/Avenir-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
}

:root {
  --color-primary: #000000;
  --color-secondary: #ff0000;
  --color-accent: #ffcc00;
  --color-dark: #ff0000;
  --color-light: #f5f7fa;
}

body {
  margin: 0;
  font-family: "Avenir", sans-serif;
  font-weight: 400;
  background-color: #e8e8e8;
  color: #333;
  padding-top: 60px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Contenedor del header - no afecta el layout */
#header-container {
  display: contents;
}

/* Contenedor del footer - se ancla al fondo */
#footer-container {
  margin-top: auto;
}

/* Asegurar que el footer dentro del contenedor hereda los estilos */
#footer-container footer {
  margin: 0;
  padding: 1rem 0;
  background: #ff0000 !important;
  border-top: 4px solid #ff0000;
  color: #ffffff !important;
  width: 100%;
}

body > *:not(nav):not(footer):not(#footer-container) {
  flex: 1;
}

footer {
  margin-top: auto;
}

h1, h2, h3 {
  font-family: "Avenir Black", sans-serif;
  font-weight: 900;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ======= NAV BAR ======= */
.navbar {
  background: #ff0000 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.navbar-nav .nav-link {
  color: #ffffff !important;
  font-weight: 600;
  transition: all 0.3s;
  margin-left: 1rem;
  position: relative;
}

.navbar-nav .nav-link:hover {
  color: #ffffff !important;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.navbar-brand img {
  height: 40px;
  width: auto;
}

/* ======= PORTADA ======= */
.hero {
  height: 90vh;
  background: url('imagenes/Ilustración_sin_título\ 27.png') center/cover no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 20px;
  margin-top: 60px;
  color: rgb(0, 0, 0);
}

.hero h2 {
  font-size: 3em;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(255,255,255,0.5);
}

.hero p {
  font-size: 1.2em;
  max-width: 600px;
  text-shadow: 1px 1px 2px rgba(255,255,255,0.5);
}

/* ======= PORTADA SECUNDARIA ======= */
.hero-secondary {
  height: 40vh;
  background: url('imagenes/Ilustración_sin_título\ 27.png') center/cover no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 20px;
  color: rgb(0, 0, 0);
  margin-top: 60px;
}

.hero-secondary h1 {
  font-size: 3em;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(255,255,255,0.5);
}

.hero-secondary p {
  font-size: 1.2em;
  max-width: 600px;
  text-shadow: 1px 1px 2px rgba(255,255,255,0.5);
}

@media (max-width: 768px) {
  .hero-secondary {
    height: 30vh;
  }
  
  .hero-secondary h1 {
    font-size: 1.8em;
  }
  
  .hero-secondary p {
    font-size: 1em;
  }
}

/* ======= QUIÉNES SOMOS ======= */
#quienes_somos h2 {
  color: #000000;
  font-size: 2.2em;
  margin-bottom: 1.5rem;
  border-bottom: 4px solid #ff0000;
  padding-bottom: 10px;
  display: inline-block;
}

#quienes_somos p {
  font-size: 1rem;
  line-height: 1.8;
  text-align: justify;
}

/* ======= SECCIONES DE REVISTAS Y ARTÍCULOS ======= */
#revistas h2,
#articulos h2 {
  color: #000000;
  font-size: 2.2em;
  margin-bottom: 2rem;
  border-bottom: 4px solid #ff0000;
  padding-bottom: 10px;
  display: inline-block;
}

#revistas {
  margin-top: 0 !important;
  padding-top: 3rem !important;
  background-color: white !important;
}

#articulos {
  margin-top: 0 !important;
  padding-top: 3rem !important;
  background-color: white !important;
}

/* ======= TARJETAS DE BIBLIOTECA ======= */
.card-biblioteca-link {
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
}

.card-biblioteca {
  height: 100%;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  cursor: pointer;
  overflow: hidden;
}

.card-biblioteca:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.card-biblioteca-img {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background-color: #f0f0f0;
  position: relative;
}

.card-biblioteca-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.4s ease, transform 0.4s ease;
}

.card-biblioteca:hover .card-biblioteca-img img {
  filter: brightness(1.05);
  transform: scale(1.02);
}

.card-body {
  color: #000000;
  padding: 1rem 1.15rem 1.15rem;
}

.card-titulo {
  font-weight: 600;
  color: #1a1a1a;
  font-size: 0.95rem;
  line-height: 1.45;
  min-height: 2.8em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

/* Fecha como pill */
.card-body small.text-muted {
  display: inline-block;
  background: #f5f5f5;
  color: #666;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* Badge Científico / Divulgativo */
.badge-tipo {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-cientifico {
  background: #fff0f0;
  color: #cc0000;
  border: 1px solid #ffcccc;
}

.badge-divulgativo {
  background: #f0f5ff;
  color: #1a56cc;
  border: 1px solid #c7d8ff;
}

[data-theme="dark"] .badge-cientifico {
  background: #2a1010;
  color: #ff6666;
  border-color: #5c2020;
}

[data-theme="dark"] .badge-divulgativo {
  background: #101828;
  color: #6699ff;
  border-color: #1e3a6e;
}

/* Ocultar autor en tarjeta — se ve en detalle */
.card-body p.text-muted {
  display: none;
}

/* Grid: más espacio entre tarjetas */
#revistas .row.g-4,
#articulos .row.g-4 {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

#revistas .row.g-4 > *,
#articulos .row.g-4 > * {
  width: 100%;
  padding: 0;
}

/* Tablet: 2 columnas */
@media (max-width: 992px) {
  #revistas .row.g-4,
  #articulos .row.g-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

/* ======= PIE DE PÁGINA ======= */
footer {
  margin-top: auto;
  background: #ff0000 !important;
  border-top: 4px solid #ff0000;
  color: #ffffff !important;
}

footer p {
  margin: 0;
  font-size: 0.95rem;
  color: #ffffff !important;
}

footer img {
  width: auto;
  filter: brightness(1.1);
}

/* Estructura compacta del footer */
.footer-compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.footer-logo {
  display: flex;
  justify-content: center;
}

.footer-logo img {
  height: 40px;
}

.footer-contacto {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.footer-contacto p {
  margin: 0;
  font-size: 0.9rem;
}

.footer-copyright {
  font-size: 0.85rem;
  opacity: 0.95;
}

.footer-copyright p {
  margin: 0;
}

.footer-link {
  color: #ffffff;
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 500;
}

.footer-link:hover {
  text-decoration: underline;
  opacity: 0.8;
}

.footer-link i {
  margin-right: 0.3rem;
}

/* Responsive footer */
@media (max-width: 600px) {
  footer {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
  
  .footer-contacto p {
    font-size: 0.85rem;
  }
  
  .footer-copyright {
    font-size: 0.8rem;
  }
}

/* ======= MODAL ======= */
#modalSinopsis {
  text-align: justify;
}

.modal-header {
  background: #ff0000;
  color: white;
  border: none;
}

.modal-header .btn-close {
  filter: brightness(0) invert(1);
}

.modal-body img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
  border: 3px solid #ff0000;
}

.modal-body h4 {
  color: #000000;
  font-weight: 700;
  margin-top: 1rem;
  border-bottom: 3px solid #ff0000;
  padding-bottom: 8px;
}

@media (max-width: 768px) {
  .modal-dialog {
    margin: 0.5rem;
  }
}

/* ======= RESPONSIVE ======= */
@media (max-width: 600px) {
  html {
    font-size: 14px;
  }
}







/* ======= QUIÉNES SOMOS ======= */
#quienes_somos_text {
  padding: 40px 20px;
  max-width: 1000px;
  margin: auto;
}

#quienes_somos_text h2 {
  text-align: left;
  font-size: 2.2em;
  margin-bottom: 20px;
  color: #000000;
}

#quienes_somos_text p {
  background-color: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  font-size: 1.1em;
  line-height: 1.6;
}




/* ======= TARJETAS DE ACCESO ======= */
#acceso-secciones h2 {
  color: #000000;
  font-size: 2.2em;
  margin-bottom: 2rem;
  border-bottom: 4px solid #ff0000;
  padding-bottom: 10px;
  display: inline-block;
}

.card-acceso-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-acceso {
  height: 100%;
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.card-acceso:hover {
  border-color: #ff0000;
  box-shadow: 0 8px 24px rgba(255, 0, 0, 0.2);
  transform: translateY(-8px);
}

.card-acceso-icon {
  font-size: 3em;
  color: #ff0000;
  margin-bottom: 1rem;
}

.card-acceso h3 {
  color: #ff0000;
  font-size: 1.8em;
  margin-bottom: 1rem;
  margin-top: 0;
}

.card-acceso p {
  color: #000000;
  font-size: 1rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.btn-arrow {
  color: #ff0000;
  font-weight: 600;
  display: inline-block;
  margin-top: auto;
  transition: transform 0.3s ease;
}

.card-acceso:hover .btn-arrow {
  transform: translateX(5px);
}

/* ======= RESPONSIVE ======= */
@media (max-width: 600px) {
  .hero h2 {
    font-size: 2em;
  }

  .card-acceso-icon {
    font-size: 2.5em;
  }
}

/* ======= PUBLICA CON NOSOTROS ======= */
.publica-contenido {
  min-height: calc(100vh - 200px);
}

.publica-title {
  color: #000000;
  font-size: 2.2em;
  margin-bottom: 1.5rem;
  border-bottom: 4px solid #ff0000;
  padding-bottom: 10px;
  display: inline-block;
}

.publica-section {
  margin-bottom: 3rem;
}

.publica-section p.text-muted {
  text-align: justify;
}

/* Card de Bases */
.bases-card {
  background: linear-gradient(135deg, #fff 0%, #f9f9f9 100%);
  border: 2px solid #ff0000;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 280px;
}

.bases-card:hover {
  box-shadow: 0 8px 24px rgba(255, 0, 0, 0.2);
  transform: translateY(-5px);
}

.bases-icon {
  font-size: 4em;
  color: #ff0000;
  margin-bottom: 1rem;
}

.bases-card h4 {
  color: #000000;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.bases-card p {
  color: #666;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* Botón Descargar */
.btn-descarga {
  background-color: #ff0000;
  color: #ffffff;
  border: none;
  padding: 0.75rem 2rem;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-descarga:hover {
  background-color: #cc0000;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(255, 0, 0, 0.3);
}

.btn-descarga i {
  margin-right: 0.5rem;
}

/* Formulario Container */
.formulario-container {
  background: #f9f9f9;
  border-radius: 12px;
  padding: 2rem;
  border: 1px solid #e0e0e0;
  margin: 2rem 0;
}

.formulario-container iframe {
  border-radius: 8px;
}

/* Info Boxes */
.info-box {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border-top: 4px solid #ff0000;
}

.info-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(255, 0, 0, 0.15);
}

.info-icon {
  font-size: 2.5em;
  color: #ff0000;
  margin-bottom: 1rem;
}

.info-box h5 {
  color: #000000;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.info-box p {
  color: #666;
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.5;
}

/* Botón Contacto */
.btn-contacto {
  background-color: #ff0000;
  color: #ffffff !important;
  border: none;
  padding: 0.75rem 2rem;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-contacto:hover {
  background-color: #cc0000;
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(255, 0, 0, 0.3);
}

.btn-contacto i {
  margin-right: 0.5rem;
}

/* Alert personalizada */
.alert-info {
  background-color: #f0f8ff;
  border: 2px solid #ff0000;
  color: #000000;
}

.alert-info .alert-heading {
  color: #ff0000;
  margin-bottom: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
  .publica-title {
    font-size: 1.8em;
  }

  .bases-card {
    min-height: auto;
    margin-top: 2rem;
  }

  .formulario-container {
    padding: 1rem;
  }

  .info-box {
    margin-bottom: 1.5rem;
  }

  .publica-contenido {
    padding-top: 1rem !important;
  }
}

/* ======= BÚSQUEDA Y FILTROS ======= */
.busqueda-filtros {
  background: linear-gradient(135deg, #f9f9f9 0%, #f0f0f0 100%);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Fila única: [search] [sel] [sel] [sel] [sel] [x] */
.filtros-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Buscador crece para ocupar el espacio sobrante */
.buscador-wrap {
  flex: 1 1 200px;
  display: flex;
  align-items: center;
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.buscador-wrap:focus-within {
  border-color: #ff0000;
  box-shadow: 0 0 0 0.2rem rgba(255,0,0,0.15);
}

.buscador-icon {
  padding: 0 0.75rem;
  color: #ff0000;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.filtro-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.55rem 0.5rem 0.55rem 0;
  font-size: 0.9rem;
  font-family: "Avenir", sans-serif;
  background: transparent;
  color: #000;
}

.filtro-input::placeholder {
  color: #aaa;
}

/* Selects de filtro — tamaño compacto */
.filtro-select {
  flex: 0 1 130px;
  min-width: 100px;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 0.55rem 0.5rem;
  font-size: 0.82rem;
  font-family: "Avenir", sans-serif;
  background-color: #fff;
  color: #000;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: auto;
}

.filtro-select:hover {
  border-color: #ff0000;
}

.filtro-select:focus {
  outline: none;
  border-color: #ff0000;
  box-shadow: 0 0 0 0.2rem rgba(255,0,0,0.15);
}

/* Botón toggle filtros */
.btn-toggle-filtros {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 2px solid #ff0000;
  color: #ff0000;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: "Avenir", sans-serif;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.btn-toggle-filtros:hover,
.btn-toggle-filtros.active {
  background-color: #ff0000;
  color: #fff;
}

.toggle-chevron {
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

.btn-toggle-filtros.active .toggle-chevron {
  transform: rotate(180deg);
}

/* Panel desplegable */
.filtros-panel {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.25s ease;
}

.filtros-panel.open {
  max-height: 120px;
  opacity: 1;
}

.filtros-panel-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  padding-top: 0.75rem;
}

/* Botón limpiar — icono circular compacto */
.btn-limpiar-inline {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #ff0000;
  background: transparent;
  color: #ff0000;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-limpiar-inline:hover {
  background-color: #ff0000;
  color: #fff;
}

/* Mensaje de no resultados */
.sin-resultados {
  text-align: center;
  padding: 3rem 1rem;
  color: #666;
  font-size: 1.1rem;
}

.sin-resultados i {
  font-size: 3em;
  color: #ff0000;
  margin-bottom: 1rem;
  display: block;
  opacity: 0.5;
}

/* ======= GRID BIBLIOTECA ======= */
.biblioteca-grid-wrap {
  padding: 0 1.25rem;
}

/* ======= PAGINACIÓN ======= */
.pagination {
  gap: 0.25rem;
}

.pagination .page-link {
  font-family: "Avenir", sans-serif;
  font-size: 0.85rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px !important;
  border: 2px solid #ddd;
  color: #000;
  background-color: #fff;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.pagination .page-link:hover {
  border-color: #ff0000;
  color: #ff0000;
  background-color: #fff;
}

.pagination .page-item.active .page-link {
  background-color: #ff0000;
  border-color: #ff0000;
  color: #fff;
}

.pagination .page-item.disabled .page-link {
  border-color: #eee;
  color: #bbb;
  background-color: #fafafa;
}

/* Responsive */
@media (max-width: 768px) {
  .buscador-wrap {
    flex: 1 1 100%;
  }

  .filtros-panel.open {
    max-height: 220px;
  }

  .filtros-panel-inner {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .filtros-panel.open {
    max-height: 380px;
  }

  .filtros-panel-inner {
    grid-template-columns: 1fr;
  }
}

/* ======= BOTÓN MODO CLARO/OSCURO ======= */
.btn-theme-toggle {
  background: rgba(255, 255, 255, 0.15);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  color: #ffffff;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.btn-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.7);
}

/* ======= DARK MODE ======= */

/* Transición suave al cambiar tema */
body,
.card-biblioteca,
.card-acceso,
.busqueda-filtros,
.modal-content,
.bases-card,
.info-box,
.formulario-container,
.filtro-select,
.buscador-wrap,
.filtro-input {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* --- Cuerpo y fondo general --- */
[data-theme="dark"] body {
  background-color: #111111;
  color: #d0d0d0;
}

/* --- Secciones blancas --- */
[data-theme="dark"] #revistas,
[data-theme="dark"] #articulos {
  background-color: #1a1a1a !important;
}

[data-theme="dark"] #revistas h2,
[data-theme="dark"] #articulos h2,
[data-theme="dark"] #quienes_somos h2,
[data-theme="dark"] .publica-title {
  color: #ffffff;
}

/* --- Tarjetas biblioteca --- */
[data-theme="dark"] .card-biblioteca {
  background: #1e1e1e;
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

[data-theme="dark"] .card-biblioteca:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .card-titulo {
  color: #f0f0f0;
}

[data-theme="dark"] .card-body {
  color: #c0c0c0;
}

[data-theme="dark"] .card-body small.text-muted {
  background: #2a2a2a;
  color: #999;
}

[data-theme="dark"] .card-biblioteca-img {
  background-color: #2a2a2a;
}

/* --- Buscador y filtros --- */
[data-theme="dark"] .busqueda-filtros {
  background: linear-gradient(135deg, #1e1e1e 0%, #242424 100%);
}

[data-theme="dark"] .buscador-wrap {
  background-color: #2a2a2a;
  border-color: #444;
}

[data-theme="dark"] .filtro-input {
  background-color: #2a2a2a;
  color: #d0d0d0;
}

[data-theme="dark"] .filtro-input::placeholder {
  color: #666;
}

[data-theme="dark"] .filtro-select {
  background-color: #2a2a2a;
  color: #d0d0d0;
  border-color: #444;
}

[data-theme="dark"] .filtro-select:hover,
[data-theme="dark"] .filtro-select:focus {
  border-color: #ff0000;
  box-shadow: 0 0 0 0.2rem rgba(255, 0, 0, 0.2);
}

[data-theme="dark"] .btn-toggle-filtros {
  border-color: #ff4444;
  color: #ff4444;
}

[data-theme="dark"] .btn-toggle-filtros:hover,
[data-theme="dark"] .btn-toggle-filtros.active {
  background-color: #ff0000;
  color: #fff;
}

[data-theme="dark"] .btn-limpiar-inline {
  border-color: #ff4444;
  color: #ff4444;
}

[data-theme="dark"] .btn-limpiar-inline:hover {
  background-color: #ff0000;
  color: #fff;
}

/* --- Tarjetas de acceso (home) --- */
[data-theme="dark"] .card-acceso {
  background: #242424;
  border-color: #333333;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .card-acceso:hover {
  box-shadow: 0 8px 24px rgba(255, 0, 0, 0.2);
}

[data-theme="dark"] .card-acceso p {
  color: #aaaaaa;
}

/* --- Quiénes somos text --- */
[data-theme="dark"] #quienes_somos_text p {
  background: #242424;
  color: #c0c0c0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* --- Publica con nosotros --- */
[data-theme="dark"] .bases-card {
  background: linear-gradient(135deg, #242424 0%, #1e1e1e 100%);
}

[data-theme="dark"] .bases-card p {
  color: #999;
}

[data-theme="dark"] .formulario-container {
  background: #1e1e1e;
  border-color: #333;
}

[data-theme="dark"] .info-box {
  background: #242424;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .info-box h5 {
  color: #ffffff;
}

[data-theme="dark"] .info-box p {
  color: #999;
}

[data-theme="dark"] .alert-info {
  background-color: #1a2030;
  border-color: #ff0000;
  color: #d0d0d0;
}

[data-theme="dark"] .alert-info .alert-heading {
  color: #ff4444;
}

/* --- Paginación --- */
[data-theme="dark"] .pagination .page-link {
  background-color: #2a2a2a;
  border-color: #444;
  color: #d0d0d0;
}

[data-theme="dark"] .pagination .page-link:hover {
  border-color: #ff0000;
  color: #ff4444;
  background-color: #2a2a2a;
}

[data-theme="dark"] .pagination .page-item.active .page-link {
  background-color: #ff0000;
  border-color: #ff0000;
  color: #fff;
}

[data-theme="dark"] .pagination .page-item.disabled .page-link {
  background-color: #222;
  border-color: #333;
  color: #555;
}

/* --- Modal --- */
[data-theme="dark"] .modal-content {
  background-color: #1e1e1e;
  color: #d0d0d0;
}

[data-theme="dark"] .modal-body h4 {
  color: #ffffff;
}

[data-theme="dark"] .modal-body p {
  color: #aaa;
}

/* --- Sin resultados --- */
[data-theme="dark"] .sin-resultados {
  color: #888;
}

/* --- Hero: texto blanco en modo oscuro sin desenfoque --- */
[data-theme="dark"] .hero h2,
[data-theme="dark"] .hero p {
  color: #ffffff;
  text-shadow: none;
}

[data-theme="dark"] .hero-secondary h1,
[data-theme="dark"] .hero-secondary p {
  color: #000000;
}

/* --- Bootstrap bg-white override (afecta a index y publica) --- */
[data-theme="dark"] .bg-white {
  background-color: #1a1a1a !important;
}

/* --- Bootstrap text-muted override --- */
[data-theme="dark"] .text-muted {
  color: #888888 !important;
}

/* --- Headings genéricos en secciones bg-white --- */
[data-theme="dark"] #acceso-secciones h2,
[data-theme="dark"] #quienes_somos p.text-muted,
[data-theme="dark"] .publica-contenido h3,
[data-theme="dark"] .bases-card h4 {
  color: #ffffff;
}

/* --- Divisor hr --- */
[data-theme="dark"] hr {
  border-color: #333333;
  opacity: 1;
}

/* ============================================================
   MEJORAS VISTA MÓVIL
   Todos los estilos dentro de media queries para NO afectar desktop
   ============================================================ */

/* --- 1. NAVEGACIÓN: Fullscreen overlay menu --- */
@media (max-width: 991px) {
  .navbar {
    padding: 0.4rem 0.75rem;
  }

  .navbar-brand img {
    height: 32px;
  }

  .navbar-toggler {
    border: none;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .navbar-toggler:focus {
    box-shadow: none;
  }

  .navbar-collapse {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(255, 0, 0, 0.97);
    z-index: 1050;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .navbar-collapse.show {
    opacity: 1;
    pointer-events: auto;
  }

  .navbar-collapse .navbar-nav {
    text-align: right;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
    padding-right: 2rem;
  }

  .navbar-collapse .nav-link {
    font-size: 1.5rem !important;
    padding: 0.75rem 0 !important;
    margin-left: 0 !important;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .navbar-collapse .nav-item.d-flex {
    justify-content: flex-end;
    margin-left: 0 !important; /* anula Bootstrap ms-2 */
  }

  .navbar-collapse .btn-theme-toggle {
    margin-left: 0;
    padding: 0.6rem 0;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #ffffff;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .navbar-toggler[aria-expanded="true"] {
    z-index: 1060;
    position: relative;
  }
}

/* --- 2. HERO: Mejor layout móvil --- */
@media (max-width: 768px) {
  .hero {
    height: 55vh;
    padding: 0 1rem;
    margin-top: 50px;
  }

  .hero h2 {
    font-size: clamp(1.5rem, 6vw, 2.2rem);
    line-height: 1.2;
    margin-bottom: 0.5rem;
  }

  .hero p {
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    line-height: 1.5;
    padding: 0 0.5rem;
  }

  .hero-secondary {
    height: 25vh;
    margin-top: 50px;
    padding: 0 1rem;
  }

  .hero-secondary h1 {
    font-size: clamp(1.4rem, 5.5vw, 2rem);
    line-height: 1.2;
  }

  .hero-secondary p {
    font-size: clamp(0.85rem, 3vw, 1rem);
  }
}

@media (max-width: 480px) {
  .hero {
    height: 45vh;
  }

  .hero-secondary {
    height: 22vh;
  }
}

/* --- 3. TIPOGRAFÍA FLUIDA MÓVIL --- */
@media (max-width: 768px) {
  body {
    padding-top: 50px;
  }

  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  #quienes_somos h2,
  #revistas h2,
  #articulos h2,
  #acceso-secciones h2 {
    font-size: clamp(1.4rem, 5vw, 2rem);
    margin-bottom: 1rem;
  }

  #quienes_somos p {
    font-size: 0.95rem;
    line-height: 1.6;
  }

  .publica-title {
    font-size: clamp(1.3rem, 5vw, 1.8rem);
  }
}

/* --- 4. CARDS DE ACCESO: Scroll horizontal en móvil --- */
@media (max-width: 600px) {
  #acceso-secciones .row.g-4 {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 1rem;
    padding-bottom: 1rem;
    margin: 0;
  }

  #acceso-secciones .row.g-4 > .col-md-6 {
    flex: 0 0 85%;
    max-width: 85%;
    scroll-snap-align: center;
    padding: 0 0.25rem;
  }

  /* Ocultar scrollbar pero mantener funcionalidad */
  #acceso-secciones .row.g-4::-webkit-scrollbar {
    height: 4px;
  }

  #acceso-secciones .row.g-4::-webkit-scrollbar-thumb {
    background: #ff0000;
    border-radius: 4px;
  }

  #acceso-secciones .row.g-4::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 4px;
  }

  .card-acceso {
    padding: 1.25rem;
    min-height: 200px;
  }

  .card-acceso h3 {
    font-size: 1.3rem;
  }

  .card-acceso-icon {
    font-size: 2.2rem;
    margin-bottom: 0.75rem;
  }

  .card-acceso p {
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }
}

/* --- 5. BUSCADOR STICKY + FILTROS EN LÍNEA en móvil --- */
@media (max-width: 768px) {
  .busqueda-filtros {
    position: sticky;
    top: 50px;
    z-index: 100;
    padding: 0.75rem;
    border-radius: 0 0 8px 8px;
    margin-left: -1rem;
    margin-right: -1rem;
  }

  /* Fila buscador + filtros + X siempre en una línea */
  .filtros-inline {
    flex-wrap: nowrap;
    gap: 0.4rem;
  }

  .buscador-wrap {
    flex: 1 1 0;
    min-width: 0;
  }

  .filtro-input {
    font-size: 16px; /* Evita zoom en iOS */
  }

  /* Botón filtros: solo icono, sin texto ni chevron */
  .btn-toggle-filtros {
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
    font-size: 0; /* Oculta texto "Filtros" */
    gap: 0;
  }

  .btn-toggle-filtros > i.fas.fa-sliders-h {
    font-size: 1rem;
  }

  .btn-toggle-filtros > .toggle-chevron {
    display: none;
  }

  /* Botón limpiar (X) compacto */
  .btn-limpiar-inline {
    min-width: 44px;
    min-height: 44px;
  }
}

/* --- 6. TARJETAS BIBLIOTECA: Simplificadas en móvil --- */
@media (max-width: 768px) {
  .card-biblioteca {
    border-radius: 12px;
    box-shadow: none;
    border-color: rgba(0, 0, 0, 0.06);
  }

  .card-biblioteca:hover {
    transform: none;
    box-shadow: none;
  }

  .card-biblioteca:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  .card-body {
    padding: 0.7rem 0.8rem 0.8rem;
  }

  .card-titulo {
    font-size: 0.85rem;
    min-height: auto;
    -webkit-line-clamp: 2;
    margin-bottom: 0.35rem;
  }

  .card-body small.text-muted {
    font-size: 0.65rem;
    padding: 0.15rem 0.45rem;
  }

  /* Ajustar gap en móvil */
  #revistas .row.g-4,
  #articulos .row.g-4 {
    gap: 0.75rem;
  }
}

/* --- 7. PADDING Y MÁRGENES REDUCIDOS + TOUCH TARGETS --- */
@media (max-width: 768px) {
  .py-5 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }

  .mb-5 {
    margin-bottom: 2rem !important;
  }

  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Touch targets mínimos de 44px */
  .nav-link,
  .btn,
  .form-select,
  .form-control,
  a.card-acceso-link,
  .btn-descarga,
  .btn-contacto,
  .btn-limpiar-inline,
  .btn-toggle-filtros {
    min-height: 44px;
  }

  .navbar-nav .nav-link {
    padding: 0.6rem 0.75rem !important;
  }

  #revistas,
  #articulos {
    padding-top: 2rem !important;
  }

  #quienes_somos_text {
    padding: 20px 10px;
  }

  #quienes_somos_text p {
    padding: 15px;
    font-size: 1rem;
  }
}

/* --- 8. FOOTER SIMPLIFICADO MÓVIL --- */
@media (max-width: 600px) {
  #footer-container footer,
  footer {
    padding: 0.75rem 0 !important;
  }

  .footer-compact {
    gap: 0.3rem;
  }

  .footer-logo img {
    height: 30px;
  }

  .footer-contacto {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .footer-contacto p {
    font-size: 0.8rem;
    margin: 0 !important;
  }

  /* Separador visual entre items inline */
  .footer-contacto p:not(:last-child)::after {
    content: " · ";
    color: rgba(255, 255, 255, 0.5);
  }

  .footer-copyright {
    font-size: 0.75rem;
    opacity: 0.8;
  }

  .footer-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* --- 9. MODALES MEJORADOS EN MÓVIL --- */
@media (max-width: 768px) {
  .modal-dialog {
    margin: 0;
    max-width: 100%;
    min-height: 100vh;
  }

  .modal-content {
    border-radius: 0;
    min-height: 100vh;
  }

  .modal-header {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .modal-header .btn-close {
    min-width: 44px;
    min-height: 44px;
    padding: 0.75rem;
  }

  .modal-body {
    padding: 1rem;
  }

  .modal-body img {
    max-height: none;
    width: 100%;
    border-radius: 8px;
  }

  .modal-body h4 {
    font-size: 1.2rem;
  }
}

/* --- 10. PUBLICA CON NOSOTROS: Mejoras móvil --- */
@media (max-width: 768px) {
  .publica-contenido {
    min-height: auto;
  }

  .bases-card {
    padding: 1.5rem;
    min-height: auto;
    margin-top: 1.5rem;
  }

  .bases-icon {
    font-size: 3rem;
  }

  .bases-card h4 {
    font-size: 1.1rem;
  }

  .bases-card p {
    font-size: 0.9rem;
  }

  .btn-descarga {
    width: 100%;
    text-align: center;
    padding: 0.75rem 1.5rem;
    min-height: 44px;
  }

  .formulario-container {
    padding: 0.5rem;
    margin: 1rem 0;
  }

  .formulario-container iframe {
    height: 500px;
  }

  .info-box {
    padding: 1.25rem;
    margin-bottom: 1rem;
  }

  .info-icon {
    font-size: 2rem;
  }

  .info-box h5 {
    font-size: 1rem;
  }

  .info-box p {
    font-size: 0.85rem;
  }

  .btn-contacto {
    width: 100%;
    text-align: center;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .alert-info {
    padding: 1rem;
    font-size: 0.9rem;
  }
}

/* --- 11. SIN RESULTADOS MEJORADO MÓVIL --- */
@media (max-width: 600px) {
  .sin-resultados {
    padding: 2rem 0.5rem;
    font-size: 1rem;
  }

  .sin-resultados i {
    font-size: 2.5rem;
  }
}

/* --- 12. ANIMACIONES REDUCIDAS PARA PERFORMANCE --- */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
