/* =========================================================
   BIBLIOTECA V2
   ========================================================= */

.hei-bib-shell{
  padding:0px;
}

/* ---------------------------------------------------------
   FILTROS
--------------------------------------------------------- */

.hei-bib-filters{
  display:grid;
  grid-template-columns: minmax(240px,1.5fr) repeat(2,180px) auto;
  gap:14px;
  align-items:end;
  margin-bottom:18px;
}

.hei-bib-filter{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.hei-bib-filter label{
  font-size:12px;
  font-weight:600;
  color:#64748b;
}

.hei-bib-filter-actions{
  display:flex;
  gap:10px;
  align-items:end;
}

/* ---------------------------------------------------------
   GRID
--------------------------------------------------------- */

.hei-bib-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, 300px);
  gap:20px;
  justify-content:center;
}

/* ---------------------------------------------------------
   CARD
--------------------------------------------------------- */

.hei-bib-card{
  width:300px;
  border:1px solid #e5e7eb;
  border-radius:16px;
  background:#fff;
  overflow:hidden;
  transition:transform .15s ease, border-color .15s ease;
}

.hei-bib-card:hover{
  transform:translateY(-2px);
  border-color:color-mix(in srgb, var(--hei-brand-color) 30%, #e5e7eb);
}

/* ---------------------------------------------------------
   MEDIA AREA
--------------------------------------------------------- */

.hei-bib-card-media{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
}

/* Vídeo */

.hei-bib-card-media.is-video{
  min-height:120px;
  background:linear-gradient(
    135deg,
    color-mix(in srgb, var(--hei-brand-color) 8%, #fff) 0%,
    #f8fafc 100%
  );
}

.hei-bib-card-media img{
  width:100%;
  height:120px;
  object-fit:cover;
}

/* Documento */

.hei-bib-card-media.is-file{
  min-height:auto;
  padding:12px 14px;
  background:#f8fafc;
  border-bottom:1px solid #eef2f7;
  justify-content:flex-start;
}

.hei-bib-file-placeholder{
  display:flex;
  align-items:center;
  gap:10px;
}

/* ---------------------------------------------------------
   ICONES
--------------------------------------------------------- */

.hei-bib-icon-wrap{
  width:42px;
  height:42px;
  border-radius:10px;
  display:flex;
  align-items:center;
  justify-content:center;

  background:color-mix(in srgb, var(--hei-brand-color) 12%, #fff);
  color:var(--hei-brand-color);

  box-shadow:inset 0 0 0 1px
    color-mix(in srgb, var(--hei-brand-color) 18%, #fff);
}

.hei-bib-icon-wrap svg{
  width:22px;
  height:22px;
}

/* ---------------------------------------------------------
   PLAY OVERLAY (VÍDEO)
--------------------------------------------------------- */

.hei-bib-play-overlay{
  width:58px;
  height:58px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;

  background:rgba(255,255,255,.9);
  color:var(--hei-brand-color);

  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%, -50%);

  box-shadow:0 6px 14px rgba(15,23,42,.12);
}

.hei-bib-play-overlay svg{
  width:26px;
  height:26px;
}

/* ---------------------------------------------------------
   HEADER DOCUMENTO
--------------------------------------------------------- */

.hei-bib-file-meta{
  display:flex;
  flex-direction:column;
  gap:2px;
}

.hei-bib-file-label{
  font-size:11px;
  font-weight:700;
  color:#475569;
  text-transform:uppercase;
  letter-spacing:.05em;
}

/* ---------------------------------------------------------
   BODY
--------------------------------------------------------- */

.hei-bib-card-body{
  padding:14px 14px 16px;
}

/* ---------------------------------------------------------
   BADGES
--------------------------------------------------------- */

.hei-bib-badges{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-bottom:6px;
}

.hei-bib-badge{
  display:inline-flex;
  align-items:center;
  padding:4px 8px;
  border-radius:6px;
  font-size:11px;
  font-weight:600;
  background:#f1f5f9;
  color:#475569;
}

.hei-bib-badge--categoria{
  background:#eef2f7;
  color:#334155;
}

.hei-bib-badge--tipo{
  background:#f1f5f9;
  color:#475569;
}

/* ---------------------------------------------------------
   TITULO
--------------------------------------------------------- */

.hei-bib-card-title{
  margin:4px 0 6px;
  font-size:16px;
  font-weight:600;
  line-height:1.35;
  color:#0f172a;
}

/* ---------------------------------------------------------
   DESCRIÇÃO
--------------------------------------------------------- */

.hei-bib-card-desc{
  margin:0;
  color:#64748b;
  font-size:13px;
  line-height:1.5;
  min-height:56px;
}

/* ---------------------------------------------------------
   FOOTER
--------------------------------------------------------- */

.hei-bib-card-footer{
  margin-top:14px;
}

.hei-bib-card-footer .hei-btn{
  width:100%;
  justify-content:center;
}

/* ---------------------------------------------------------
   RESPONSIVO
--------------------------------------------------------- */

@media (max-width:900px){

  .hei-bib-grid{
    grid-template-columns:repeat(auto-fill, 260px);
  }

  .hei-bib-card{
    width:260px;
  }

}

@media (max-width:640px){

  .hei-bib-filters{
    grid-template-columns:1fr;
  }

}


/* =========================================================
   VIDEO MODAL
========================================================= */

.hei-bib-video-modal{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.75);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:9999;
}

.hei-bib-video-modal.active{
  display:flex;
}

.hei-bib-video-modal-inner{
  width:90%;
  max-width:900px;
  position:relative;
}

.hei-bib-video-frame{
  position:relative;
  padding-top:56.25%;
  background:#000;
  border-radius:10px;
  overflow:hidden;
}

.hei-bib-video-frame iframe{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
}

.hei-bib-video-close{
  position:absolute;
  top:-40px;
  right:0;
  background:none;
  border:none;
  color:#fff;
  font-size:28px;
  cursor:pointer;
}

/* =========================================================
   BIBLIOTECA ADM MASTER
   ========================================================= */

.hei-bib-admin-wrap{
  display:grid;
  gap:20px;
  margin-top:16px;
}

.hei-bib-admin-form-card,
.hei-bib-admin-list-card{
  border:1px solid #e5e7eb;
  border-radius:16px;
  background:#fff;
  padding:18px;
}

.hei-bib-admin-form .hei-field--full{
  grid-column:1 / -1;
}

.hei-bib-admin-form textarea.hei-input{
  min-height:110px;
  resize:vertical;
}

.hei-btn-sm{
  padding:6px 10px;
  font-size:12px;
  border-radius:8px;
}




.hei-bib-admin-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.hei-inline{
  display:inline-flex;
}




.hei-bib-field-quiz{
  display:none;
}


/* =========================================================
   BIBLIOTECA - ABAS
   ========================================================= */

.hei-bib-tabs-wrap{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  flex-wrap:wrap;
  margin:0 0 20px;
  padding:0 0 12px;
  border-bottom:1px solid #e5e7eb;
}

.hei-bib-tabs-left,
.hei-bib-tabs-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.hei-bib-tabs-right{
  padding:6px;
  border:1px solid #e5e7eb;
  border-radius:999px;
  background:#f8fafc;
}

.hei-bib-tablink{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:38px;
  padding:0 16px;
  border-radius:999px;
  border:1px solid transparent;
  background:transparent;
  color:#64748b;
  text-decoration:none;
  font-size:13px;
  font-weight:600;
  line-height:1;
  white-space:nowrap;
  transition:
    background .15s ease,
    color .15s ease,
    border-color .15s ease,
    box-shadow .15s ease,
    transform .08s ease;
}

.hei-bib-tablink:hover{
  background:#eef2f7;
  color:#0f172a;
}

.hei-bib-tabs-left .hei-bib-tablink{
  background:#f8fafc;
  border-color:#e5e7eb;
  color:#0f172a;
}

.hei-bib-tablink.is-active{
  background:#878787;
  color:#ffffff;
  border-color:#5a5a5a;
}

.hei-bib-tabs-left .hei-bib-tablink.is-active{
  transform:translateY(-1px);
}

@media (max-width: 768px){
  .hei-bib-tabs-wrap{
    align-items:flex-start;
  }

  .hei-bib-tabs-right{
    width:100%;
  }
}

/* =========================================================
   STATUS DOS CARDS
   ========================================================= */

.hei-bib-status{
  margin:6px 0 8px;
}

.hei-bib-status-ok{
  display:inline-flex;
  align-items:center;
  padding:4px 8px;
  border-radius:6px;
  font-size:11px;
  font-weight:700;
  background:#ecfdf5;
  color:#047857;
}

.hei-bib-status-pending{
  display:inline-flex;
  align-items:center;
  padding:4px 8px;
  border-radius:6px;
  font-size:11px;
  font-weight:600;
  background:#f1f5f9;
  color:#475569;
}

/* Card concluído mais suave */
.hei-bib-card.is-concluido{
  background:#f8fafc;
  border-color:#e2e8f0;
}

/* leve efeito ao passar mouse */
.hei-bib-card.is-concluido:hover{
  border-color:#cbd5f5;
}

/* =========================================================
   BIBLIOTECA - DASHBOARD PREMIUM
   ========================================================= */

.hei-bib-dashboard-wrap{
  margin-top:10px;
}

/* ---------------------------------------------------------
   TOPO / INSIGHT
--------------------------------------------------------- */

.hei-bib-resumo-topo{
  margin-bottom:18px;
}

.hei-bib-dashboard-wrap .hei-alert.hei-ok{
  margin:0 0 22px;
  padding:14px 16px;
  border:1px solid #dbe7dd;
  border-radius:14px;
  background:linear-gradient(180deg, #f6fbf7 0%, #eef7f0 100%);
  color:#1f3d2b;
  box-shadow:0 1px 2px rgba(15,23,42,.03);
}

.hei-bib-dashboard-wrap .hei-alert.hei-ok strong{
  font-weight:700;
  color:#163524;
}

/* ---------------------------------------------------------
   SEÇÕES
--------------------------------------------------------- */

.hei-bib-dashboard-section{
  margin:26px 0;
}

.hei-bib-dashboard-section-head{
  margin-bottom:14px;
}

.hei-bib-dashboard-section-title{
  margin:0 0 4px;
  font-size:16px;
  line-height:1.3;
  font-weight:700;
  color:#0f172a;
  letter-spacing:-0.01em;
}

.hei-bib-dashboard-section-sub{
  font-size:13px;
  line-height:1.5;
  color:#64748b;
}

.hei-bib-dashboard-wrap .hei-hr{
  margin:22px 0 0;
  border:0;
  border-top:1px solid #edf1f5;
}

/* ---------------------------------------------------------
   GRID KPI
--------------------------------------------------------- */

.hei-bib-kpi-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  gap:16px;
}

.hei-bib-kpi-grid--compact{
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
}

/* ---------------------------------------------------------
   CARD KPI
--------------------------------------------------------- */

.hei-bib-kpi-card{
  border:1px solid #e7ecf2;
  border-radius:18px;
  background:linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  padding:18px 18px 16px;
  box-shadow:
    0 1px 2px rgba(15,23,42,.03),
    0 10px 24px rgba(15,23,42,.03);
  transition:
    transform .16s ease,
    box-shadow .16s ease,
    border-color .16s ease;
}

.hei-bib-kpi-card:hover{
  transform:translateY(-2px);
  border-color:#d9e2ec;
  box-shadow:
    0 2px 4px rgba(15,23,42,.04),
    0 16px 34px rgba(15,23,42,.06);
}

.hei-bib-kpi-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom:12px;
}

.hei-bib-kpi-label{
  font-size:13px;
  font-weight:700;
  line-height:1.25;
  color:#0f172a;
  letter-spacing:-0.01em;
}

.hei-bib-kpi-value{
  font-size:38px;
  font-weight:750;
  line-height:1;
  color:#0f172a;
  margin-bottom:10px;
  letter-spacing:-0.03em;
}

.hei-bib-kpi-sub{
  font-size:12px;
  line-height:1.45;
  color:#64748b;
}

/* ---------------------------------------------------------
   TOOLTIP INFO
--------------------------------------------------------- */

.hei-bib-kpi-help{
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  cursor:help;
}

.hei-bib-kpi-help-icon{
  width:18px;
  height:18px;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:#f3f6fa;
  color:#5b6b7f;
  font-size:11px;
  font-weight:700;
  line-height:1;
  border:1px solid #dde5ee;
  transition:
    background .15s ease,
    color .15s ease,
    border-color .15s ease,
    transform .12s ease;
}

.hei-bib-kpi-help:hover .hei-bib-kpi-help-icon,
.hei-bib-kpi-help:focus-within .hei-bib-kpi-help-icon{
  background:#eaf0f6;
  color:#334155;
  border-color:#cfd9e4;
  transform:translateY(-1px);
}

.hei-bib-kpi-help-tooltip{
  position:absolute;
  right:0;
  bottom:calc(100% + 10px);
  width:260px;
  padding:11px 12px;
  border-radius:12px;
  background:#0f172a;
  color:#ffffff;
  font-size:12px;
  line-height:1.45;
  box-shadow:0 14px 34px rgba(15,23,42,.20);
  opacity:0;
  visibility:hidden;
  transform:translateY(4px);
  transition:
    opacity .16s ease,
    transform .16s ease,
    visibility .16s ease;
  z-index:40;
  pointer-events:none;
}

.hei-bib-kpi-help:hover .hei-bib-kpi-help-tooltip,
.hei-bib-kpi-help:focus-within .hei-bib-kpi-help-tooltip{
  opacity:1;
  visibility:visible;
  transform:translateY(0);
}

/* ---------------------------------------------------------
   CATEGORIAS
--------------------------------------------------------- */

.hei-bib-cat-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  gap:14px;
}

.hei-bib-cat-card{
  border:1px solid #e7ecf2;
  border-radius:16px;
  background:linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  padding:16px 16px 14px;
  box-shadow:0 1px 2px rgba(15,23,42,.03);
  transition:
    transform .14s ease,
    box-shadow .14s ease,
    border-color .14s ease;
}

.hei-bib-cat-card:hover{
  transform:translateY(-1px);
  border-color:#d9e2ec;
  box-shadow:0 10px 24px rgba(15,23,42,.05);
}

.hei-bib-cat-name{
  font-size:13px;
  font-weight:700;
  color:#0f172a;
  margin-bottom:8px;
  line-height:1.35;
}

.hei-bib-cat-total{
  font-size:34px;
  font-weight:750;
  line-height:1;
  color:#334155;
  letter-spacing:-0.03em;
}

/* ---------------------------------------------------------
   TABELA - TOP USUÁRIOS
--------------------------------------------------------- */

.hei-bib-dashboard-wrap .hei-table-wrap{
  border:1px solid #e7ecf2;
  border-radius:16px;
  overflow:hidden;
  background:#fff;
  box-shadow:0 1px 2px rgba(15,23,42,.03);
}

.hei-bib-dashboard-wrap .hei-table{
  width:100%;
  border-collapse:collapse;
}

.hei-bib-dashboard-wrap .hei-table thead th{
  background:#f8fafc;
  color:#475569;
  font-size:12px;
  font-weight:700;
  text-transform:none;
  letter-spacing:0;
  padding:12px 14px;
  border-bottom:1px solid #e7ecf2;
}

.hei-bib-dashboard-wrap .hei-table tbody td{
  padding:13px 14px;
  font-size:13px;
  color:#0f172a;
  border-bottom:1px solid #eef2f6;
}

.hei-bib-dashboard-wrap .hei-table tbody tr:last-child td{
  border-bottom:0;
}

.hei-bib-dashboard-wrap .hei-table tbody tr:hover{
  background:#fbfdff;
}

/* ---------------------------------------------------------
   BLOCOS DEMOGRÁFICOS
--------------------------------------------------------- */

.hei-bib-dashboard-wrap .hei-bib-kpi-grid--compact .hei-bib-kpi-card{
  min-height:148px;
}

.hei-bib-dashboard-wrap .hei-bib-kpi-grid--compact .hei-bib-kpi-value{
  font-size:36px;
}

.hei-bib-dashboard-wrap .hei-bib-kpi-card strong{
  color:#0f172a;
  font-weight:700;
}

/* ---------------------------------------------------------
   RESPONSIVO
--------------------------------------------------------- */

@media (max-width: 900px){
  .hei-bib-kpi-grid,
  .hei-bib-kpi-grid--compact,
  .hei-bib-cat-grid{
    grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));
  }

  .hei-bib-kpi-value,
  .hei-bib-cat-total{
    font-size:32px;
  }
}

@media (max-width: 640px){
  .hei-bib-dashboard-section{
    margin:22px 0;
  }

  .hei-bib-kpi-card,
  .hei-bib-cat-card{
    padding:16px 14px;
  }

  .hei-bib-kpi-value,
  .hei-bib-cat-total{
    font-size:28px;
  }

  .hei-bib-kpi-help-tooltip{
    right:auto;
    left:0;
    width:220px;
  }

  .hei-bib-dashboard-wrap .hei-table thead th,
  .hei-bib-dashboard-wrap .hei-table tbody td{
    padding:10px 10px;
    font-size:12px;
  }
}


/* =========================================================
   GRAFICOS DASHBOARD
   ========================================================= */

.hei-bib-charts-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:20px;
}

.hei-bib-chart-card{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:16px;
  padding:20px;
  text-align:center;
}

.hei-bib-chart-card h5{
  margin:0 0 12px;
  font-size:14px;
  font-weight:700;
  color:#334155;
}

.hei-bib-chart-card canvas{
  max-width:180px;
  margin:0 auto;
}

.hei-bib-chart-legend{
  margin-top:14px;
  font-size:13px;
  color:#64748b;
  display:flex;
  flex-direction:column;
  gap:4px;
}

/* RESPONSIVO */
@media (max-width:768px){
  .hei-bib-charts-grid{
    grid-template-columns:1fr;
  }
}