/* ============================================================
   Enciclopedia Digital — Estilos personalizados
   Complementa a AdminLTE 4 sin sobreescribir sus variables base
   ============================================================ */

/* ---------------------------------------------------------------
   Tarjetas de artículo con efecto hover
   --------------------------------------------------------------- */
.card-articulo {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-articulo:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ---------------------------------------------------------------
   FEAT-A: Categorías con hover zoom
   --------------------------------------------------------------- */
.cat-card {
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.cat-card:hover {
  transform: scale(1.06) translateY(-2px);
  box-shadow: 0 10px 28px rgba(0,0,0,0.14);
}

/* ---------------------------------------------------------------
   FEAT-A: Timeline de últimas adiciones
   --------------------------------------------------------------- */
.timeline-home {
  border-left: 2px solid var(--bs-primary);
  padding-left: 0.5rem;
}
.timeline-home .timeline-item:last-child {
  margin-bottom: 0 !important;
}
.timeline-dot {
  margin-left: -1.15rem;
}

/* ---------------------------------------------------------------
   FEAT-A: Hero section
   --------------------------------------------------------------- */
.hero-section {
  min-height: 340px;
}

/* ---------------------------------------------------------------
   Badges de nivel de comprensión
   --------------------------------------------------------------- */
.badge-infantil {
  background-color: #ff8c00;
  color: #fff;
}

.badge-basico {
  background-color: #28a745;
  color: #fff;
}

.badge-intermedio {
  background-color: #007bff;
  color: #fff;
}

.badge-avanzado {
  background-color: #6f42c1;
  color: #fff;
}

.badge-universitario {
  background-color: #dc3545;
  color: #fff;
}

/* ---------------------------------------------------------------
   Sistema de valoración con estrellas (radio buttons)
   --------------------------------------------------------------- */
.rating-stars {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 2px;
}

.rating-stars input[type="radio"] {
  display: none;
}

.rating-stars label {
  cursor: pointer;
  font-size: 1.4rem;
  color: #ccc;
  transition: color 0.15s ease;
}

.rating-stars input[type="radio"]:checked ~ label,
.rating-stars label:hover,
.rating-stars label:hover ~ label {
  color: #ffc107;
}

/* ---------------------------------------------------------------
   Marca del sidebar — texto en color blanco
   --------------------------------------------------------------- */
.sidebar-brand .brand-text {
  color: #ffffff !important;
}

.sidebar-brand .brand-image {
  line-height: 1;
}

/* ---------------------------------------------------------------
   Zona de carga de archivos (drag & drop)
   --------------------------------------------------------------- */
.upload-zone {
  border: 2px dashed #6c757d;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  background-color: transparent;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: #007bff;
  background-color: rgba(0, 123, 255, 0.05);
}

.upload-zone .upload-icon {
  font-size: 2.5rem;
  color: #6c757d;
  margin-bottom: 0.5rem;
}

/* ---------------------------------------------------------------
   Contenido de artículos — tipografía y responsividad
   --------------------------------------------------------------- */
.articulo-contenido {
  font-size: 1rem;
  line-height: 1.75;
  word-break: break-word;
}

.articulo-contenido h2,
.articulo-contenido h3,
.articulo-contenido h4 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.articulo-contenido img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 0.75rem 0;
}

.articulo-contenido pre,
.articulo-contenido code {
  font-size: 0.9rem;
  border-radius: 4px;
}

.articulo-contenido blockquote {
  border-left: 4px solid #007bff;
  padding-left: 1rem;
  color: #6c757d;
  font-style: italic;
}

/* ---------------------------------------------------------------
   Preview de imagen antes de subir
   --------------------------------------------------------------- */
.img-preview-wrapper {
  max-width: 200px;
  margin-top: 0.5rem;
}

.img-preview-wrapper img {
  width: 100%;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

/* ---------------------------------------------------------------
   Tabla de artículos más leídos
   --------------------------------------------------------------- */
.table-visitas .visitas-count {
  font-weight: 600;
  color: #007bff;
}

/* ---------------------------------------------------------------
   Responsive: ocultar columnas secundarias en móvil
   --------------------------------------------------------------- */
@media (max-width: 576px) {
  .d-xs-none {
    display: none !important;
  }
}

/* ===============================================================
   FEAT-B: Modo oscuro — overrides específicos
   =============================================================== */

[data-bs-theme='dark'] .card-articulo {
  background-color: var(--bs-card-bg, #1e2a38);
  border-color: rgba(255,255,255,0.08);
  color: var(--bs-body-color);
}

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

[data-bs-theme='dark'] .hero-section {
  /* El degradado oscuro ya funciona bien; solo asegurar contraste */
  color: #fff !important;
}

[data-bs-theme='dark'] .cat-card {
  border-color: rgba(255,255,255,0.07);
}

[data-bs-theme='dark'] .timeline-home {
  border-left-color: var(--bs-primary);
}

[data-bs-theme='dark'] .upload-zone {
  border-color: rgba(255,255,255,0.25);
}

[data-bs-theme='dark'] .upload-zone:hover,
[data-bs-theme='dark'] .upload-zone.dragover {
  background-color: rgba(13, 110, 253, 0.08);
}

/* Mapa Leaflet: mantener apariencia independiente del tema */
.leaflet-container {
  background: #1a3a5c !important;
  color-scheme: normal !important;
}

[data-bs-theme='dark'] .leaflet-container {
  filter: none !important;
}

/* ===============================================================
   FEAT-C: Tabla de contenidos (TOC) sticky
   =============================================================== */
.toc-aside {
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}

.toc-aside a {
  display: block;
  padding: 0.2rem 0.5rem;
  font-size: 0.85rem;
  color: var(--bs-body-color);
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.toc-aside a:hover,
.toc-aside a.toc-active {
  background: rgba(13, 110, 253, 0.1);
  color: var(--bs-primary);
  font-weight: 600;
}

.toc-aside .toc-h3 {
  padding-left: 1.2rem;
  font-size: 0.8rem;
}

/* ===============================================================
   FEAT-D: Galería con lightbox
   =============================================================== */

/* Grid de imágenes con hover overlay */
.gallery-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border-radius: 6px;
}

.gallery-item::after {
  content: '\F52A';            /* Bootstrap Icon: zoom-in (bi-zoom-in unicode) */
  font-family: 'bootstrap-icons';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: rgba(0,0,0,0);
  color: rgba(255,255,255,0);
  transition: background 0.2s ease, color 0.2s ease;
}

.gallery-item:hover::after {
  background: rgba(0,0,0,0.45);
  color: rgba(255,255,255,0.9);
}

.gallery-item img {
  transition: transform 0.25s ease;
  width: 100%;
}

.gallery-item:hover img {
  transform: scale(1.04);
}

/* Lightbox overlay */
#lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.6);
}

.lightbox-caption {
  color: #eee;
  margin-top: 0.75rem;
  font-size: 0.95rem;
  text-align: center;
  max-width: 80vw;
}

.lightbox-counter {
  color: #aaa;
  font-size: 0.82rem;
  margin-top: 0.25rem;
}

.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1.2rem;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  font-size: 1.4rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 10001;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.28);
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  font-size: 1.6rem;
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 10001;
}

.lightbox-nav:hover {
  background: rgba(255,255,255,0.28);
}

.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

@media (max-width: 576px) {
  .lightbox-nav { width: 2.2rem; height: 2.2rem; font-size: 1.2rem; }
  .lightbox-prev { left: 0.3rem; }
  .lightbox-next { right: 0.3rem; }
}

/* ===============================================================
   FEAT-E: Live search dropdown
   =============================================================== */

#live-search-dropdown {
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 0.375rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 420px;
  overflow-y: auto;
}

.live-search-item {
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  color: var(--bs-body-color);
  border-bottom: 1px solid var(--bs-border-color, #f0f0f0);
  transition: background 0.12s ease;
}

.live-search-item:last-of-type {
  border-bottom: none;
}

.live-search-item:hover,
.live-search-item:focus {
  background: rgba(13, 110, 253, 0.07);
  color: var(--bs-primary);
  outline: none;
}

.live-search-ver-todos {
  border-top: 1px solid var(--bs-border-color, #dee2e6);
  color: var(--bs-primary);
  font-weight: 600;
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  display: block;
  transition: background 0.12s ease;
}

.live-search-ver-todos:hover {
  background: rgba(13, 110, 253, 0.07);
}

/* ===============================================================
   FEAT-F: Artículos relacionados — hover effect
   =============================================================== */
.related-article-item {
  transition: background 0.12s ease;
  color: inherit;
}

.related-article-item:hover {
  background: rgba(13, 110, 253, 0.06);
  color: inherit;
}
