/* Modern Tables — front styles */

.mt-wrap {
  --mt-local-radius: var(--mt-radius, 12px);
  position: relative;
  width: max-content;
  max-width: 100%;
  margin: 1.25em 0;
  box-sizing: border-box;
}

.mt-wrap.is-full-width {
  width: 100%;
  max-width: 100%;
}

.mt-wrap *,
.mt-wrap *::before,
.mt-wrap *::after {
  box-sizing: border-box;
}

.mt-hint {
  display: none;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 0 8px;
  padding: 6px 10px;
  border-radius: 999px;
  width: fit-content;
  margin-left: auto;
  color: var(--mt-hint-color, #64748b);
  background: var(--mt-hint-bg, transparent);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .25s ease, transform .25s ease;
}

/* Visible only when overflow exists AND JS marks hint as active */
.mt-wrap.is-scrollable.is-hint-visible .mt-hint {
  display: inline-flex;
  opacity: 1;
  transform: translateY(0);
}

.mt-wrap.is-hint-hidden .mt-hint {
  display: none !important;
}

.mt-hint__icon {
  position: relative;
  width: 28px;
  height: 18px;
  flex-shrink: 0;
  color: var(--mt-hint-icon, #0d9488);
}

.mt-hint__icon::before,
.mt-hint__icon::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
  animation: mt-hint-nudge 1.4s ease-in-out infinite;
}

.mt-hint__icon::before {
  left: 2px;
  transform: translateY(-50%) rotate(-135deg);
  animation-delay: .15s;
}

.mt-hint__icon::after {
  right: 2px;
}

.mt-hint__icon {
  background:
    linear-gradient(currentColor, currentColor) center / 14px 2px no-repeat;
}

@keyframes mt-hint-nudge {
  0%, 100% { opacity: .35; }
  50% { opacity: 1; }
}

.mt-hint__text:empty {
  display: none;
}

.mt-scroller {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border-radius: var(--mt-local-radius);
  border-top: var(--mt-border-h-width, 1px) var(--mt-border-h-style, solid) var(--mt-border-h-color, #e5e7eb);
  border-bottom: var(--mt-border-h-width, 1px) var(--mt-border-h-style, solid) var(--mt-border-h-color, #e5e7eb);
  border-left: var(--mt-border-v-width, 1px) var(--mt-border-v-style, solid) var(--mt-border-v-color, #e5e7eb);
  border-right: var(--mt-border-v-width, 1px) var(--mt-border-v-style, solid) var(--mt-border-v-color, #e5e7eb);
  background: var(--mt-bg, #fff);
  box-shadow: var(--mt-shadow, none);
  scrollbar-width: thin;
  scrollbar-color: var(--mt-scrollbar, #94a3b8) var(--mt-scrollbar-track, #e2e8f0);
}

.mt-wrap:not(.is-full-width) .mt-scroller {
  width: max-content;
  max-width: 100%;
}

.mt-scroller::-webkit-scrollbar {
  height: 8px;
}
.mt-scroller::-webkit-scrollbar-track {
  background: var(--mt-scrollbar-track, #e2e8f0);
  border-radius: 999px;
}
.mt-scroller::-webkit-scrollbar-thumb {
  background: var(--mt-scrollbar, #94a3b8);
  border-radius: 999px;
}

.mt-wrap .mt-table,
.mt-wrap table,
.mt-wrap .wp-block-table table {
  width: max-content;
  min-width: 0;
  margin: 0 !important;
  border-collapse: separate;
  border-spacing: 0;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--mt-text, #1f2937);
  font-family: var(--mt-font, inherit);
  font-size: var(--mt-font-size, 14px);
  font-weight: var(--mt-font-weight, 400);
  line-height: var(--mt-line-height, 1.45);
}

/* Full width: at least container wide; grow with content when scrollable */
.mt-wrap.is-full-width .mt-table,
.mt-wrap.is-full-width table,
.mt-wrap.is-full-width .wp-block-table table {
  width: max-content;
  min-width: 100%;
}

/* Fits container — stretch columns across full width */
.mt-wrap.is-full-width:not(.is-scrollable) .mt-table,
.mt-wrap.is-full-width:not(.is-scrollable) table,
.mt-wrap.is-full-width:not(.is-scrollable) .wp-block-table table {
  width: 100%;
  min-width: 100%;
}

.mt-wrap .wp-block-table {
  margin: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: visible !important;
}

.mt-wrap .mt-table caption,
.mt-wrap table caption {
  caption-side: top;
  padding: 0 0 10px;
  color: var(--mt-caption-color, #64748b);
  font-size: var(--mt-caption-size, 13px);
  text-align: var(--mt-caption-align, left);
}

.mt-wrap .mt-table th,
.mt-wrap .mt-table td,
.mt-wrap table th,
.mt-wrap table td {
  padding: var(--mt-cell-padding, 12px 14px);
  text-align: var(--mt-cell-align, left);
  vertical-align: top;
  border: 0;
  border-bottom: var(--mt-border-h-width, 1px) var(--mt-border-h-style, solid) var(--mt-border-h-color, #e5e7eb);
  border-right: var(--mt-border-v-width, 1px) var(--mt-border-v-style, solid) var(--mt-border-v-color, #e5e7eb);
  background: transparent;
  color: inherit;
  white-space: nowrap;
}

.mt-wrap .mt-table th:last-child,
.mt-wrap .mt-table td:last-child,
.mt-wrap table th:last-child,
.mt-wrap table td:last-child {
  border-right: 0;
}

.mt-wrap .mt-table tr:last-child th,
.mt-wrap .mt-table tr:last-child td,
.mt-wrap table tr:last-child th,
.mt-wrap table tr:last-child td {
  border-bottom: 0;
}

.mt-wrap .mt-table thead th,
.mt-wrap table thead th {
  background: var(--mt-header-bg, #f8fafc);
  color: var(--mt-header-text, #0f172a);
  font-weight: var(--mt-header-weight, 650);
  border-bottom-color: var(--mt-header-border, #e2e8f0);
}

.mt-wrap.is-striped .mt-table tbody tr:nth-child(even) td,
.mt-wrap.is-striped table tbody tr:nth-child(even) td {
  background: var(--mt-stripe-bg, #f9fafb);
}

.mt-wrap.is-hoverable .mt-table tbody tr:hover td,
.mt-wrap.is-hoverable table tbody tr:hover td {
  background: var(--mt-hover-bg, #f1f5f9);
}

.mt-wrap.is-sticky-header .mt-table thead th,
.mt-wrap.is-sticky-header table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.mt-wrap.is-sticky-first .mt-table tr > *:first-child,
.mt-wrap.is-sticky-first table tr > *:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--mt-bg, #fff);
  box-shadow: 1px 0 0 var(--mt-border-v-color, #e5e7eb);
}

.mt-wrap.is-sticky-first .mt-table thead tr > *:first-child,
.mt-wrap.is-sticky-first table thead tr > *:first-child {
  z-index: 3;
  background: var(--mt-header-bg, #f8fafc);
}

.mt-wrap.is-sticky-first.is-striped .mt-table tbody tr:nth-child(even) > *:first-child,
.mt-wrap.is-sticky-first.is-striped table tbody tr:nth-child(even) > *:first-child {
  background: var(--mt-stripe-bg, #f9fafb);
}

.mt-wrap.is-sticky-first.is-hoverable .mt-table tbody tr:hover > *:first-child,
.mt-wrap.is-sticky-first.is-hoverable table tbody tr:hover > *:first-child {
  background: var(--mt-hover-bg, #f1f5f9);
}

/* When table fits — wrap text on any viewport so columns fill width */
.mt-wrap:not(.is-scrollable) .mt-table th,
.mt-wrap:not(.is-scrollable) .mt-table td,
.mt-wrap:not(.is-scrollable) table th,
.mt-wrap:not(.is-scrollable) table td {
  white-space: normal;
}
