/* =========================================================
   JUPITER SCIENCE ACADEMY — TABLE WIDTH FIX
   Restores native table layout inside Course/Lesson/Quiz content.
   The scroll container is the wrapper, NOT the <table> itself.
========================================================= */

/* Override the older Academy rule that made the actual table display:block. */
.jsa .zcm-template-content table,
.jsa .zcm-template-content table.wp-block-table{
  display:table!important;
  width:100%!important;
  min-width:100%!important;
  max-width:none!important;
  table-layout:auto!important;
  box-sizing:border-box!important;
  margin-left:0!important;
  margin-right:0!important;
}

/* Gutenberg wrapper scrolls; the child table remains a real table. */
.jsa .zcm-template-content .wp-block-table,
.jsa .wp-block-table{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  box-sizing:border-box!important;
}

.jsa .zcm-template-content .wp-block-table > table,
.jsa .wp-block-table > table{
  display:table!important;
  width:100%!important;
  min-width:100%!important;
  max-width:none!important;
  table-layout:auto!important;
}

/* Zartom rich table wrappers use the same principle. */
.jsa .zcm-template-content .tmp-table-wrap,
.jsa .zcm-template-content .zbg-table-wrap,
.jsa .tmp-table-wrap,
.jsa .zbg-table-wrap{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  box-sizing:border-box!important;
}

.jsa .zcm-template-content .tmp-table-wrap > table,
.jsa .zcm-template-content .zbg-table-wrap > table,
.jsa .tmp-table-wrap > table,
.jsa .zbg-table-wrap > table{
  display:table!important;
  width:100%!important;
  min-width:100%!important;
  max-width:none!important;
  table-layout:auto!important;
}

/* Preserve native table semantics even if theme/Divi styles interfere. */
.jsa .zcm-template-content table thead{
  display:table-header-group!important;
}
.jsa .zcm-template-content table tbody{
  display:table-row-group!important;
}
.jsa .zcm-template-content table tfoot{
  display:table-footer-group!important;
}
.jsa .zcm-template-content table tr{
  display:table-row!important;
}
.jsa .zcm-template-content table th,
.jsa .zcm-template-content table td{
  display:table-cell!important;
  box-sizing:border-box!important;
}

/* Mobile: wrapper may scroll horizontally if a genuinely wide table needs it. */
@media(max-width:766px){
  .jsa .zcm-template-content .wp-block-table,
  .jsa .zcm-template-content .tmp-table-wrap,
  .jsa .zcm-template-content .zbg-table-wrap{
    -webkit-overflow-scrolling:touch;
  }
}
