/* Таблицы: аккуратный горизонтальный скролл вместо «расползания».
   Единый источник для статей (single-post) и уроков курса (course-prose). */

/* Общий вид таблицы (в тексте и во весь экран) */
body.single-post .wp-block-table table,
.course-prose .wp-block-table table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 0.9375em;
  line-height: 1.55;
}

body.single-post .wp-block-table th,
body.single-post .wp-block-table td,
.course-prose .wp-block-table th,
.course-prose .wp-block-table td {
  min-width: 12em;
  padding: 0.75em 1em;
  text-align: left;
  vertical-align: top;
  word-break: normal;
  border-bottom: 1px solid #E9E9E9;
  border-left: none;
  border-right: none;
  border-top: none;
}

body.single-post .wp-block-table th,
.course-prose .wp-block-table th {
  background: #F5F5F5;
  font-weight: 600;
  color: #1E1E1E;
  white-space: nowrap;
}

body.single-post .wp-block-table tbody tr:nth-child(even),
.course-prose .wp-block-table tbody tr:nth-child(even) {
  background: #FDFDFD;
}

body.single-post .wp-block-table tbody tr:last-child td,
.course-prose .wp-block-table tbody tr:last-child td {
  border-bottom: none;
}

/* Контейнер таблицы внутри статьи/урока */
body.single-post .entry-content .wp-block-table,
.course-prose .wp-block-table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5em 0 2em;
  border: 1px solid #E9E9E9;
  border-radius: 0.625em;
  background: #fff;
}

/* Обёртка с кнопкой разворачивания */
body.single-post .entry-content .table-wrap,
.course-prose .table-wrap {
  position: relative;
  margin: 1.5em 0 2em;
}

body.single-post .entry-content .table-wrap > .wp-block-table,
.course-prose .table-wrap > .wp-block-table {
  margin: 0;
}

body.single-post .entry-content .table-expand-btn,
.course-prose .table-expand-btn {
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.4em 0.7em;
  border: 1px solid #E9E9E9;
  border-radius: 0.625em;
  background: rgba(255, 255, 255, 0.92);
  color: #1E1E1E;
  font-family: Onest, sans-serif;
  font-size: 0.8125em;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(30, 30, 30, 0.05);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

body.single-post .entry-content .table-expand-btn:hover,
.course-prose .table-expand-btn:hover {
  background: #ECFBF8;
  border-color: #01A97D;
  color: #029F76;
}

body.single-post .entry-content .table-expand-btn svg,
.course-prose .table-expand-btn svg {
  width: 1em;
  height: 1em;
}

/* Полноэкранный просмотр таблицы */
body.table-fullscreen-open {
  overflow: hidden;
}

.table-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1em;
  background: rgba(30, 30, 30, 0.65);
}

.table-fullscreen__dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 96vw;
  max-height: 92vh;
  background: #fff;
  border-radius: 0.625em;
  overflow: hidden;
}

.table-fullscreen__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  padding: 0.75em 1em;
  border-bottom: 1px solid #E9E9E9;
}

.table-fullscreen__title {
  font-family: Onest, sans-serif;
  font-weight: 600;
  color: #1E1E1E;
}

.table-fullscreen__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2em;
  height: 2em;
  border: none;
  border-radius: 50%;
  background: #F5F5F5;
  color: #1E1E1E;
  font-size: 1.125em;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.table-fullscreen__close:hover {
  background: #E9E9E9;
}

.table-fullscreen__scroll {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1em;
}

.table-fullscreen__scroll .wp-block-table {
  display: block;
  margin: 0;
  border: none;
  border-radius: 0;
  background: #fff;
}
