/* =========================================================
   EB · Historial manual (CFGM 2020/2024 + Renovació + BE)
   Scoped perquè NO afecti altres taules
   CSS limpio y corregido para DataTables + scrollX
   ======================================================= */

.eb-hm-wrap{
  width:100%;
  margin-bottom:40px;
}

/* ==============================
   Tabs Plans (2020 / 2024)
   ============================== */

.eb-hm-tabs{
  display:flex;
  gap:10px;
  margin:10px 0 18px 0;
  flex-wrap:wrap;
}

.eb-hm-tab{
  padding:10px 16px;
  border-radius:14px;
  border:1px solid rgba(0,0,0,.15);
  background:#fff;
  text-decoration:none;
  color:#222;
  font-weight:600;
}

.eb-hm-tab:hover{
  background:rgba(0,0,0,.04);
}

.eb-hm-tab.is-active{
  border-color:#0b5ed7;
  box-shadow:0 0 0 3px rgba(11,94,215,.15);
}

/* ==============================
   Capçalera del bloc
   ============================== */

.eb-hm-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  margin-bottom:12px;
}

.eb-hm-header h2{
  margin:0;
  font-size:26px;
}

.eb-hm-sub{
  margin-top:4px;
  opacity:.7;
  font-size:14px;
}

.eb-hm-actions .button{
  padding:8px 14px;
  font-weight:600;
}

/* Separadors */
.eb-hm-sep{
  margin:28px 0;
  border:0;
  border-top:1px solid rgba(0,0,0,.12);
}

/* ==============================
   DataTables controls
   ============================== */

.eb-hm-wrap .dataTables_wrapper{
  width:100%;
}

.eb-hm-wrap .dataTables_length,
.eb-hm-wrap .dataTables_filter{
  margin-bottom:10px;
}

.eb-hm-wrap .dataTables_filter{
  text-align:right;
}

.eb-hm-wrap select,
.eb-hm-wrap input[type="search"]{
  border-radius:8px;
  padding:6px 8px;
  border:1px solid rgba(0,0,0,.2);
}

/* ==============================
   Tabla general
   ============================== */

.eb-hm-wrap table.dataTable{
  width:100% !important;
  border-collapse:separate !important;
  border-spacing:0 !important;
}

.eb-hm-wrap table.dataTable,
.eb-hm-wrap table.dataTable th,
.eb-hm-wrap table.dataTable td{
  box-sizing:border-box !important;
}

/* ==============================
   Header
   ============================== */

.eb-hm-wrap table.dataTable thead th{
  background:#141a1f;
  color:#fff;
  font-weight:700;
  font-size:13px;
  padding:12px 10px !important;
  border-right:1px solid rgba(255,255,255,.15);
  border-bottom:1px solid rgba(255,255,255,.22);
  white-space:nowrap;
  vertical-align:middle !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
}

.eb-hm-wrap table.dataTable thead tr:first-child th:first-child{
  border-top-left-radius:12px;
}

.eb-hm-wrap table.dataTable thead tr:first-child th:last-child{
  border-top-right-radius:12px;
}

.eb-hm-wrap table.dataTable thead tr:nth-child(2) th{
  font-size:11.5px !important;
  font-weight:600;
  line-height:1.1 !important;
  padding:10px 8px !important;
  white-space:nowrap !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
}

/* ==============================
   Body
   ============================== */

.eb-hm-wrap table.dataTable tbody td{
  background:#fff;
  padding:10px !important;
  border-right:1px solid rgba(0,0,0,.12);
  border-bottom:1px solid rgba(0,0,0,.12);
  font-size:13.5px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  vertical-align:middle;
}

.eb-hm-wrap table.dataTable tbody tr:nth-child(even) td{
  background:#f6f9fc;
}

.eb-hm-wrap table.dataTable tbody tr:hover td{
  background:rgba(11,94,215,.08);
}

/* Contenido interno de Assignatura */
.eb-hm-wrap .eb-hm-subject{
  display:block;
  width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* ==============================
   Scroll horizontal
   ============================== */

.eb-hm-wrap .dataTables_scrollHead,
.eb-hm-wrap .dataTables_scrollBody{
  margin:0 !important;
}

.eb-hm-wrap .dataTables_scrollBody{
  border:1px solid rgba(0,0,0,.15);
  border-top:0;
  border-radius:0 0 12px 12px;
}

/* Oculta el thead clonado del body para evitar franja negra */
.eb-hm-wrap .dataTables_scrollBody thead{
  visibility:hidden;
}

.eb-hm-wrap .dataTables_scrollBody thead th{
  padding:0 !important;
  border:0 !important;
  height:0 !important;
  line-height:0 !important;
}

/* ==============================
   Ajustes específicos de cabeceras complejas
   ============================== */

/* Subcolumnas de BE / CFGM con más aire */
.eb-hm-wrap table.ebHmTable[data-type="be"] thead tr:nth-child(2) th,
.eb-hm-wrap table.ebHmTable[data-type="cfgm"] thead tr:nth-child(2) th{
  min-width:110px;
}

/* Un poco más compacto en BE */
.eb-hm-wrap table.ebHmTable[data-type="be"] thead th{
  padding:11px 8px !important;
}

/* ==============================
   Modal (edició manual)
   ============================== */

.eb-hm-modal{
  display:none;
  position:fixed;
  inset:0;
  z-index:99999;
}

.eb-hm-modal.is-open{
  display:block;
}

.eb-hm-modal__backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.55);
}

.eb-hm-modal__panel{
  position:relative;
  background:#fff;
  width:min(860px, calc(100% - 24px));
  margin:30px auto;
  border-radius:14px;
  box-shadow:0 20px 60px rgba(0,0,0,.3);
}

.eb-hm-modal__head{
  padding:16px 18px;
  border-bottom:1px solid rgba(0,0,0,.1);
  display:flex;
  justify-content:space-between;
}

.eb-hm-modal__head h3{
  margin:0;
}

.eb-hm-modal__hint{
  margin-top:6px;
  opacity:.7;
  font-size:13px;
}

.eb-hm-modal__close{
  background:rgba(0,0,0,.08);
  border:0;
  width:34px;
  height:34px;
  border-radius:10px;
  cursor:pointer;
  font-size:18px;
}

.eb-hm-modal__close:hover{
  background:rgba(0,0,0,.15);
}

#ebHmForm{
  padding:16px 18px;
}

.eb-hm-formgrid{
  display:grid;
  grid-template-columns:1.4fr .6fr 1fr 1fr;
  gap:12px;
  margin-bottom:12px;
}

.eb-hm-formgrid--2{
  grid-template-columns:1fr 1fr;
}

.eb-hm-field label{
  font-weight:600;
  margin-bottom:6px;
  display:block;
}

.eb-hm-field input{
  width:100%;
  padding:8px 10px;
  border-radius:8px;
  border:1px solid rgba(0,0,0,.2);
}

/* Tabs del modal */
.eb-hm-tabs2{
  display:flex;
  gap:8px;
  margin:12px 0;
  border-bottom:1px solid rgba(0,0,0,.12);
  padding-bottom:10px;
  flex-wrap:wrap;
}

.eb-hm-tab2{
  padding:8px 12px;
  border-radius:10px;
  border:1px solid rgba(0,0,0,.2);
  background:#fff;
  cursor:pointer;
  font-weight:600;
}

.eb-hm-tab2.is-active{
  border-color:#0b5ed7;
  box-shadow:0 0 0 3px rgba(11,94,215,.15);
}

.eb-hm-panel{
  display:none;
}

.eb-hm-panel.is-active{
  display:block;
}

/* Footer modal */
.eb-hm-modal__foot{
  padding:14px 18px;
  border-top:1px solid rgba(0,0,0,.1);
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}

.eb-hm-modal__footLeft{
  display:flex;
  gap:10px;
  align-items:center;
}

.ebHmDelete{
  background:#dc3545 !important;
  border-color:#dc3545 !important;
  color:#fff !important;
}

.ebHmDelete:hover{
  filter:brightness(.95);
}

/* ==============================
   Responsive
   ============================== */

@media (max-width:900px){
  .eb-hm-formgrid{
    grid-template-columns:1fr;
  }

  .eb-hm-header{
    flex-direction:column;
    gap:10px;
  }

  .eb-hm-wrap table.dataTable thead th{
    font-size:12px;
  }

  .eb-hm-wrap table.dataTable tbody td{
    font-size:13px;
  }

  .eb-hm-wrap table.dataTable thead tr:nth-child(2) th{
    font-size:10.5px !important;
  }
}











/* FIX: botón Editar visible sin agrandarlo */
.dataTables_wrapper table.dataTable tbody td:last-child button,
.dataTables_wrapper table.dataTable tbody td:last-child .button,
.dataTables_wrapper table.dataTable tbody td:last-child a.button,
.dataTables_wrapper table.dataTable tbody td:last-child input[type="button"],
.dataTables_wrapper table.dataTable tbody td:last-child input[type="submit"] {
  color: #005bb5 !important;
  border-color: #005bb5 !important;
  background: #ffffff !important;
  opacity: 1 !important;
  visibility: visible !important;
  text-indent: 0 !important;
  text-decoration: none !important;
}

/* Hover normal */
.dataTables_wrapper table.dataTable tbody td:last-child button:hover,
.dataTables_wrapper table.dataTable tbody td:last-child .button:hover,
.dataTables_wrapper table.dataTable tbody td:last-child a.button:hover,
.dataTables_wrapper table.dataTable tbody td:last-child input[type="button"]:hover,
.dataTables_wrapper table.dataTable tbody td:last-child input[type="submit"]:hover {
  color: #ffffff !important;
  background: #005bb5 !important;
  border-color: #005bb5 !important;
}