/* ==========================================================================
   Biblioteca Digital — catálogo, estante pessoal e leitor integrado
   Usa as variáveis do portal-tx.css (azul e branco)
   ========================================================================== */

.bib-section { background: #f4f8ff; padding: 56px 0 104px; font-family: "Inter", sans-serif; color: #0b1a3d; }
.bib-wrap { width: min(1240px, 92%); margin: 0 auto; }
html.bib-lock { overflow: hidden; }

/* ── Cabeçalho: pesquisa e números ── */
.bib-hero .bib-search {
  display: flex; align-items: center; gap: 12px; max-width: 700px; margin: 34px 0 0; padding: 7px 7px 7px 22px;
  border-radius: 999px; background: #fff; box-shadow: 0 24px 60px rgba(2, 10, 40, .35);
}
.bib-search > i { color: #0057e5; font-size: 16px; }
.bib-search input[type="search"] {
  flex: 1; min-width: 0; border: 0 !important; outline: 0 !important; box-shadow: none !important; background: transparent !important;
  padding: 13px 4px !important; font: 400 16px "Inter", sans-serif !important; color: #0b1a3d; border-radius: 0 !important;
}
.bib-search input::placeholder { color: #7a86a3; }
.bib-search button { flex: none; border: 0; padding: 14px 28px; border-radius: 999px; background: #0057e5; color: #fff; font: 600 14px "Inter", sans-serif; cursor: pointer; transition: background .3s, transform .3s; }
.bib-search button:hover { background: #0048c0; transform: translateY(-1px); }
.bib-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 28px; padding: 0; margin: 28px 0 0; }
.bib-stats li { color: rgba(255, 255, 255, .7); font-size: 14px; font-weight: 300; }
.bib-stats strong { font: 500 22px "Manrope", sans-serif; color: #fff; margin-right: 6px; }

/* ── Botões ── */
.bib-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 12px 22px; border-radius: 999px; border: 1px solid transparent;
  font: 500 14px "Inter", sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .3s var(--tx-ease, ease), background .3s, color .3s, box-shadow .3s, border-color .3s;
}
.bib-btn:hover { transform: translateY(-2px); }
.bib-btn-p { background: #0057e5; color: #fff; }
.bib-btn-p:hover { background: #0048c0; color: #fff; box-shadow: 0 12px 28px rgba(0, 87, 229, .3); }
.bib-btn-w { background: #fff; color: #0057e5; }
.bib-btn-w:hover { background: #e8f0ff; color: #0048c0; }
.bib-btn-g { border-color: rgba(255, 255, 255, .4); color: #fff; background: transparent; }
.bib-btn-g:hover { background: #fff; color: #0057e5; }
.bib-btn-i { width: 44px; padding: 0; flex: none; background: #fff; border-color: #cfe0ff; color: #0057e5; }
.bib-btn-i:hover { background: #0057e5; color: #fff; border-color: #0057e5; }
.bib-btn-off { background: #eef3fb; color: #7a86a3; cursor: default; flex: 1; }
.bib-btn-off:hover { transform: none; }
.bib-btn-sm { padding: 9px 16px; font-size: 13px; }
.bib-actions { display: flex; gap: 8px; }
.bib-actions .bib-btn-p { flex: 1; }

/* ── A minha estante ── */
.bib-shelf { margin-bottom: 36px; padding: 26px 26px 22px; border-radius: 26px; background: #fff; border: 1px solid #dfe8fa; }
.bib-shelf[hidden] { display: none; }
.bib-shelf-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.bib-shelf-head h2 { margin: 0; font: 600 20px "Manrope", sans-serif; letter-spacing: -.02em; color: #0b1a3d; }
.bib-shelf-head h2 i { color: #0057e5; margin-right: 8px; }
.bib-link-btn { border: 0; background: none; color: #5b6b8a; font: 500 13px "Inter", sans-serif; cursor: pointer; }
.bib-link-btn:hover { color: #0057e5; }
.bib-shelf-row { display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
.bib-mini { position: relative; flex: 0 0 min(330px, 82%); display: flex; gap: 14px; padding: 14px; border-radius: 20px; background: #f4f8ff; border: 1px solid #e3ecfb; scroll-snap-align: start; }
.bib-mini-cover { flex: none; width: 78px; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: linear-gradient(135deg, #0a3fb8, #2f7bff); box-shadow: 0 8px 18px rgba(0, 60, 170, .25); }
.bib-mini-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bib-mini-info { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; padding-right: 18px; }
.bib-mini-info strong { font: 600 14.5px/1.3 "Manrope", sans-serif; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bib-mini-info small { font-size: 12.5px; color: #5b6b8a; }
.bib-mini-bar { width: 100%; height: 5px; border-radius: 5px; background: #d6e4ff; overflow: hidden; }
.bib-mini-bar span, .bib-prog span { display: block; height: 100%; border-radius: 5px; background: #0057e5; }
.bib-mini-info .bib-btn { margin-top: auto; }
.bib-mini-x { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: #7a86a3; cursor: pointer; font-size: 13px; }
.bib-mini-x:hover { background: #fff; color: #0057e5; }

/* ── Destaque ── */
.bib-feature { display: grid; grid-template-columns: 250px 1fr; gap: 44px; align-items: center; margin-bottom: 40px; padding: 38px 44px; border-radius: 30px; position: relative; overflow: hidden; color: #fff; background: linear-gradient(120deg, #061746 0%, #0a3fb8 55%, #0057e5 100%); }
.bib-feature::after { content: ""; position: absolute; right: -80px; top: -80px; width: 340px; height: 340px; border-radius: 50%; background: radial-gradient(circle, rgba(143, 184, 255, .35), transparent 70%); pointer-events: none; }
.bib-feature-cover { aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: #0a2160; box-shadow: 0 30px 60px rgba(2, 10, 40, .5); transform: rotate(-3deg); transition: transform .5s var(--tx-ease, ease); }
.bib-feature:hover .bib-feature-cover { transform: rotate(0); }
.bib-feature-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bib-feature-body { position: relative; z-index: 1; }
.bib-kicker { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .3); font: 500 11px "Inter", sans-serif; letter-spacing: .16em; text-transform: uppercase; }
.bib-feature h2 { margin: 18px 0 8px; font: 400 clamp(26px, 3vw, 40px)/1.12 "Manrope", sans-serif; letter-spacing: -.04em; color: #fff; }
.bib-feature-author { margin: 0 0 14px; color: #a9c9ff; font-size: 14px; font-weight: 500; }
.bib-feature p { max-width: 560px; color: rgba(255, 255, 255, .78); font-weight: 300; line-height: 1.7; margin: 0 0 24px; }
.bib-feature .bib-actions { flex-wrap: wrap; }
.bib-feature .bib-actions .bib-btn-p, .bib-feature .bib-btn-w { flex: none; }
.bib-feature .bib-save { display: none; }

/* ── Separadores e filtros ── */
.bib-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; margin-bottom: 8px; scrollbar-width: none; }
.bib-tabs::-webkit-scrollbar { display: none; }
.bib-tab { flex: none; display: inline-flex; align-items: center; gap: 9px; padding: 11px 18px; border-radius: 999px; background: #fff; border: 1px solid #dfe8fa; color: #34456b; font: 500 14px "Inter", sans-serif; text-decoration: none; transition: all .3s; }
.bib-tab i { color: #0057e5; font-size: 13px; }
.bib-tab span { padding: 2px 9px; border-radius: 999px; background: #eef4ff; color: #0057e5; font-size: 12px; font-weight: 600; }
.bib-tab:hover { border-color: #0057e5; color: #0057e5; transform: translateY(-1px); }
.bib-tab.is-on { background: #0057e5; border-color: #0057e5; color: #fff; }
.bib-tab.is-on i { color: #fff; }
.bib-tab.is-on span { background: rgba(255, 255, 255, .22); color: #fff; }

.bib-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin: 14px 0 6px; }
.bib-filters label { display: grid; gap: 6px; }
.bib-filters label span { font: 500 11px "Inter", sans-serif; letter-spacing: .12em; text-transform: uppercase; color: #5b6b8a; }
.bib-filters select { min-width: 210px; padding: 12px 16px !important; border-radius: 14px !important; }
.bib-clear { margin-left: auto; align-self: center; color: #0057e5; font: 500 14px "Inter", sans-serif; text-decoration: none; }
.bib-clear:hover { color: #0b1a3d; }
.bib-count { margin: 18px 0 22px; color: #4f5d7d; font-size: 15px; }
.bib-count strong { color: #0b1a3d; }

/* ── Grelha de cartões ── */
.bib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.bib-card { display: flex; flex-direction: column; overflow: hidden; border-radius: 26px; background: #fff; border: 1px solid #dfe8fa; transition: transform .5s var(--tx-ease, ease), border-color .4s, box-shadow .4s; }
.bib-card:hover { transform: translateY(-6px); border-color: rgba(0, 87, 229, .45); box-shadow: 0 26px 60px rgba(0, 87, 229, .14); }
.bib-cover { position: relative; aspect-ratio: 4 / 4.4; overflow: hidden; background: linear-gradient(135deg, #0a3fb8, #2f7bff); }
.bib-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .8s var(--tx-ease, ease); }
.bib-card:hover .bib-cover img { transform: scale(1.05); }
.bib-cover-ph { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, .55); font-size: 3.4rem; background: radial-gradient(circle at 70% 20%, rgba(255, 255, 255, .22), transparent 55%), linear-gradient(135deg, #061746, #0057e5); }
.bib-badge { position: absolute; left: 14px; top: 14px; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .94); color: #0057e5; font: 600 11px "Inter", sans-serif; letter-spacing: .04em; box-shadow: 0 8px 18px rgba(2, 10, 40, .18); }
.bib-save { position: absolute; right: 12px; top: 12px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .94); color: #0057e5; cursor: pointer; display: grid; place-items: center; box-shadow: 0 8px 18px rgba(2, 10, 40, .18); transition: transform .3s, background .3s, color .3s; }
.bib-save:hover { transform: scale(1.08); }
.bib-save.is-on { background: #0057e5; color: #fff; }
.bib-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(255, 255, 255, .35); }
.bib-prog span { border-radius: 0; background: #fff; }
.bib-body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 22px; }
.bib-cat { align-self: flex-start; margin-bottom: 8px; font: 600 11px "Inter", sans-serif; letter-spacing: .12em; text-transform: uppercase; color: #0057e5; }
.bib-title { margin: 0 0 6px; font: 600 18px/1.3 "Manrope", sans-serif; letter-spacing: -.02em; color: #0b1a3d; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bib-author { margin: 0 0 10px; font-size: 13.5px; color: #5b6b8a; }
.bib-desc { margin: 0 0 14px; font-size: 14px; font-weight: 300; line-height: 1.65; color: #4f5d7d; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bib-meta { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 16px; padding: 0; font-size: 12.5px; color: #5b6b8a; }
.bib-meta i { color: #0057e5; margin-right: 5px; }
.bib-card .bib-actions { margin-top: auto; }

/* ── Estado vazio e paginação ── */
.bib-empty { padding: 70px 24px; text-align: center; border-radius: 26px; background: #fff; border: 1px solid #dfe8fa; }
.bib-empty i { font-size: 3rem; color: #0057e5; opacity: .55; margin-bottom: 14px; }
.bib-empty h2 { font: 500 26px "Manrope", sans-serif; margin: 0 0 8px; }
.bib-empty p { color: #5b6b8a; margin: 0 0 22px; }
.bib-pages { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 40px; }
.bib-pages a { min-width: 44px; height: 44px; display: grid; place-items: center; padding: 0 6px; border-radius: 999px; background: #fff; border: 1px solid #dfe8fa; color: #34456b; font: 500 14px "Inter", sans-serif; text-decoration: none; transition: all .3s; }
.bib-pages a:hover { border-color: #0057e5; color: #0057e5; }
.bib-pages a.is-on { background: #0057e5; border-color: #0057e5; color: #fff; }

/* ==========================================================================
   LEITOR INTEGRADO
   ========================================================================== */
.bib-reader { position: fixed; inset: 0; z-index: 10100; display: flex; flex-direction: column; background: #07173f; color: #fff; font-family: "Inter", sans-serif; animation: bibIn .35s var(--tx-ease, ease) backwards; }
.bib-reader[hidden] { display: none; }
@keyframes bibIn { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
.bib-r-bar { position: relative; flex: none; display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: rgba(6, 23, 70, .96); border-bottom: 1px solid rgba(255, 255, 255, .1); }
.bib-r-title { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.bib-r-title strong { font: 600 15px "Manrope", sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bib-r-title small { font-size: 12px; color: rgba(255, 255, 255, .6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bib-r-tools { display: flex; align-items: center; gap: 6px; }
.bib-r-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer; font-size: 15px; text-decoration: none; transition: background .25s, color .25s; }
.bib-r-btn:hover { background: #fff; color: #0057e5; }
.bib-r-zoom { width: auto; min-width: 58px; padding: 0 10px; font: 600 13px "Inter", sans-serif; }
.bib-r-sep { width: 1px; height: 24px; margin: 0 6px; background: rgba(255, 255, 255, .15); }
.bib-r-page { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; font-size: 14px; color: rgba(255, 255, 255, .75); }
.bib-r-page input { width: 56px; height: 36px; padding: 0 6px !important; text-align: center; border-radius: 10px !important; border: 1px solid rgba(255, 255, 255, .2) !important; background: rgba(255, 255, 255, .08) !important; color: #fff !important; font: 600 14px "Inter", sans-serif !important; -moz-appearance: textfield; }
.bib-r-page input::-webkit-outer-spin-button, .bib-r-page input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bib-r-page input:focus { border-color: #8fb8ff !important; box-shadow: 0 0 0 3px rgba(143, 184, 255, .25) !important; background: rgba(255, 255, 255, .14) !important; }
.bib-r-page b { color: #fff; font-weight: 600; }
.bib-r-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: rgba(255, 255, 255, .08); }
.bib-r-progress span { display: block; width: 0; height: 100%; background: #4d94ff; transition: width .25s; }
.bib-r-body { position: relative; flex: 1; overflow: auto; outline: 0; -webkit-overflow-scrolling: touch; background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(47, 123, 255, .25), transparent 70%), #07173f; }
.bib-r-pages { width: max-content; min-width: 100%; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 22px 12px 80px; }
.bib-r-sheet { position: relative; flex: none; background: #fff; border-radius: 4px; box-shadow: 0 20px 50px rgba(0, 0, 0, .45); overflow: hidden; }
.bib-r-sheet canvas { display: block; width: 100%; height: 100%; }
.bib-r-num { position: absolute; inset: 0; display: grid; place-items: center; font: 200 54px "Manrope", sans-serif; color: #cfdcf5; pointer-events: none; transition: opacity .3s; }
.bib-r-sheet.is-done .bib-r-num { opacity: 0; }
.bib-r-state { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; text-align: center; padding: 24px; font-size: 16px; color: rgba(255, 255, 255, .85); }
.bib-r-state[hidden] { display: none; }
.bib-r-state i { font-size: 22px; color: #8fb8ff; }
.bib-r-state.is-error { flex-direction: column; }
.bib-r-state.is-error i { color: #ffb4b4; font-size: 34px; }

/* ── Responsivo ── */
@media (max-width: 991px) {
  .bib-feature { grid-template-columns: 1fr; padding: 30px 26px; gap: 28px; text-align: left; }
  .bib-feature-cover { width: 170px; transform: none; }
  .bib-filters label, .bib-filters select { width: 100%; }
  .bib-filters label { flex: 1 1 200px; }
  .bib-clear { margin-left: 0; }
}
@media (max-width: 767px) {
  .bib-section { padding: 36px 0 80px; }
  .bib-hero .bib-search { padding-left: 16px; }
  .bib-search button { padding: 13px 18px; }
  .bib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .bib-body { padding: 14px 14px 16px; }
  .bib-title { font-size: 15px; }
  .bib-desc { display: none; }
  .bib-card .bib-btn-p { padding-inline: 10px; font-size: 13px; }
  .bib-btn-i { width: 40px; }
  .bib-shelf { padding: 20px 16px 16px; }
  .bib-r-bar { flex-wrap: wrap; gap: 8px 10px; padding: 8px 10px; }
  .bib-r-title { order: 1; flex: 1 1 calc(100% - 60px); }
  .bib-r-bar > [data-r="close"] { order: 0; }
  .bib-r-tools { order: 2; width: 100%; justify-content: space-between; }
  .bib-r-btn { width: 38px; height: 38px; }
  .bib-r-sep, .bib-r-btn[data-r="fullscreen"] { display: none; }
  .bib-r-pages { padding: 14px 8px 70px; gap: 10px; }
}
@media (max-width: 420px) {
  .bib-grid { grid-template-columns: 1fr; }
  .bib-desc { display: -webkit-box; }
  .bib-stats li:nth-child(n+3) { display: none; }
}
@media (prefers-reduced-motion: reduce) { .bib-reader, .bib-card, .bib-feature-cover { animation: none; transition: none; } }

/* campo da página no leitor: vence os estilos globais de formulários */
.bib-reader .bib-r-page input[type="number"] {
  width: 56px !important; height: 36px !important; padding: 0 6px !important; text-align: center; border-radius: 10px !important;
  border: 1px solid rgba(255, 255, 255, .22) !important; background: rgba(255, 255, 255, .08) !important; color: #fff !important; font: 600 14px "Inter", sans-serif !important;
}
.bib-reader .bib-r-page input[type="number"]:focus { border-color: #8fb8ff !important; box-shadow: 0 0 0 3px rgba(143, 184, 255, .25) !important; background: rgba(255, 255, 255, .14) !important; }
