/* Biblioteca – estilo dedicado (solo biblioteca.php)
   Objetivo: filtros claros, tarjetas limpias, buena jerarquía y responsive.
*/

.lib-hero{
  margin-top: 10px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background:
    radial-gradient(1200px 260px at 18% 0%, rgba(50,175,180,.18), transparent 60%),
    radial-gradient(900px 240px at 92% 10%, rgba(37,99,235,.14), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.86));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.lib-hero-inner{
  padding: clamp(16px, 2.4vw, 26px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.lib-hero h1{
  margin: 0;
  font-size: clamp(24px, 3.2vw, 34px);
  letter-spacing: .2px;
}

.lib-hero p{
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.lib-hero-meta{
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lib-pill{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.55);
  background: rgba(255,255,255,.9);
  font-size: 12px;
  color: var(--muted);
}

/* Evitar exceso de negrita: resaltar con color + peso moderado */
.lib-pill strong{ color: var(--ink); font-weight: 600; }

/* Controls */
.lib-controls{
  margin-top: 14px;
  position: static; /* comportamiento normal (no sticky) */
}


.lib-controls-inner{
  background: rgba(249,250,251,.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 860px){
  .lib-controls-inner{
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }
}

.lib-segment{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seg-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  box-shadow: 0 6px 18px rgba(2,6,23,.06);
  transition: transform .12s ease, filter .15s ease, background .15s ease;
}
.seg-btn:hover{ filter: brightness(1.02); transform: translateY(-1px); }
.seg-btn[aria-current="page"],
.seg-btn.is-active{
  border-color: rgba(50,175,180,.45);
  background: rgba(50,175,180,.12);
  color: #0a3f41;
}

/* Search */
.lib-search{
  display: flex;
  gap: 10px;
  align-items: center;
}

.lib-searchbox{
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
}

.lib-searchbox input{
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
}

.lib-search-ic{
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  color: rgba(15,23,42,.65);
}

.lib-clear{
  border: 0;
  background: rgba(2,6,23,.04);
  color: rgba(15,23,42,.75);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 999px;
}
.lib-clear:hover{ background: rgba(2,6,23,.07); }

.lib-search button{
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(37,99,235,.25);
  background: rgba(37,99,235,.10);
  color: #1d4ed8;
  font-weight: 500;
  cursor: pointer;
  transition: transform .12s ease, filter .15s ease;
}
.lib-search button:hover{ filter: brightness(1.05); transform: translateY(-1px); }

/* Results row */

.lib-results{
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(15,23,42,.08);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.lib-results-left{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.lib-results-right{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}


.lib-count{
  font-weight: 500;
  letter-spacing: .2px;
}

.lib-chip{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.55);
  background: rgba(255,255,255,.8);
  font-size: 12px;
  color: rgba(15,23,42,.78);
}

/* Grid + cards */
.lib-grid{
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.topic-card{
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}
.topic-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(15,23,42,.12);
}

.topic-link{
  display: block;
  padding: 14px;
  text-decoration: none;
  color: inherit;
}

.topic-title{
  margin: 0 0 8px;
  font-size: clamp(15px, 1.15vw, 18px);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: .15px;
}

.topic-meta{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.chip{
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.55);
  background: rgba(249,250,251,.9);
  font-size: 12px;
  color: rgba(15,23,42,.72);
}

.chip-strong{
  border-color: rgba(37,99,235,.25);
  background: rgba(37,99,235,.08);
  color: #1d4ed8;
  font-weight: 500;
}

.chip-stage{
  border-color: rgba(50,175,180,.35);
  background: rgba(50,175,180,.10);
  color: #0a3f41;
  font-weight: 500;
}

.topic-cta{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-weight: 500;
  color: rgba(15,23,42,.62);
  text-decoration: none;
}

.topic-card:hover .topic-cta{
  color: rgba(15,23,42,.78);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.topic-cta .cta-dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

/* Pager */
.pager{
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.pager a, .pager span{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
  font-size: 13px;
}

.pager a:hover{ background: rgba(2,6,23,.04); }

.pager .is-current{
  border-color: rgba(50,175,180,.45);
  background: rgba(50,175,180,.12);
  color: #0a3f41;
}

.pager .is-disabled{
  opacity: .55;
  pointer-events: none;
}

/* Ajustes mobile */
@media (max-width: 420px){
  .lib-controls{ top: 54px; }
  .lib-search{ flex-wrap: wrap; }
  .lib-search button{ width: 100%; }
}


/* Results row fuera del panel sticky (comportamiento normal) */
.lib-results-standalone{ margin-top: 12px; margin-bottom: 6px; }
.lib-results-standalone .lib-results{ border-top: none; padding-top: 0; margin-top: 0; }
