/* =============================================================
   Casino Table Block  –  styled to match Casino Card Block
   ============================================================= */

/* ── Shared design tokens (mirrors casino-card-block) ────────── */
:root {
  --ctb-green:       #44be4c;
  --ctb-gold:        #ffc106;
  --ctb-red:         #e53935;
  --ctb-text:        #1d2730;
  --ctb-text-muted:  #4a5b68;
  --ctb-bg:          #f7f8fa;
  --ctb-bg-alt:      #eef0f4;
  --ctb-border:      #e2e6ec;
  --ctb-radius:      10px;
  --ctb-shadow:      0 2px 16px rgba(29,39,48,.09);
  --ctb-header-bg:   #1d2730;
}

/* ── Wrapper ────────────────────────────────────────────────── */
.ctb-wrap {
  margin: 1.75em 0;
  font-family: inherit;
  font-size: 1rem;
}

/* ── Caption (SEO title inside <table>) ─────────────────────── */
.ctb-caption {
  caption-side: top;
  text-align: left;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ctb-text);
  padding: 0 0 .65em;
  background: transparent;
}

/* ── Scroll shell — same card look as .ccb-casino-card ──────── */
.ctb-scroll {
  position: relative;
  /* overflow-x: scroll always creates a scroll container on iOS,
     preventing the "snaps back" bug where auto finds no overflow */
  overflow-x: scroll;
  overflow-y: visible; /* keep visible so position:sticky works in Safari */
  /* Contain horizontal overscroll bounce (iOS 16+, all Android) */
  overscroll-behavior-x: contain;
  /* Tell the browser: horizontal panning belongs to this element,
     vertical panning passes to the page — stops double-scroll / bounce
     on iOS < 16 as well */
  touch-action: pan-x pan-y;
  background: #fff;
  border: 1px solid var(--ctb-border);
  border-radius: var(--ctb-radius);
  box-shadow: var(--ctb-shadow);
  /* right-edge fade hints there's more to scroll */
  background-image: linear-gradient(to left, rgba(29,39,48,.06) 0%, transparent 48px);
  background-repeat: no-repeat;
  background-position: right center;
  background-color: #fff;
}

/* ── Table ──────────────────────────────────────────────────── */
.ctb-table {
  width: 100%;
  /* Wide enough for 6 columns on a 375 px phone without columns squashing */
  min-width: 720px;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: .9rem;
  background: transparent;
}

/* ── Header row — same dark tone as ccb-card-outer background ── */
.ctb-table thead tr {
  background: var(--ctb-header-bg);
}

.ctb-th {
  padding: 12px 18px;
  color: rgba(255,255,255,.78);
  font-weight: 600;
  font-size: .78em;
  letter-spacing: .03em;
  white-space: nowrap;
  text-align: left;
  border: none;
}

/* Sticky casino header cell */
.ctb-th--casino {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--ctb-header-bg);
}

/* ── Body rows ──────────────────────────────────────────────── */
.ctb-table tbody tr {
  background: #fff;
  border-bottom: 1px solid var(--ctb-border);
  transition: background .12s ease;
}

.ctb-table tbody tr:nth-child(even) {
  background: var(--ctb-bg);
}

.ctb-table tbody tr:last-child {
  border-bottom: none;
}

.ctb-table tbody tr:hover,
.ctb-table tbody tr:nth-child(even):hover {
  background: var(--ctb-bg-alt);
}

/* ── Cells ──────────────────────────────────────────────────── */
.ctb-td {
  padding: 14px 18px;
  vertical-align: middle;
  color: var(--ctb-text);
  border: none;
  white-space: nowrap;
}

/* Per-column minimum widths — prevents any column from disappearing */
.ctb-th--rating,       .ctb-td--rating       { min-width: 110px; }
.ctb-th--established,  .ctb-td--established  { min-width: 100px; }
.ctb-th--min_deposit,  .ctb-td--min_deposit  { min-width: 100px; }
.ctb-th--payout_speed, .ctb-td--payout_speed { min-width: 110px; }
.ctb-th--licence,      .ctb-td--licence      { min-width: 110px; }

/* ── Casino column — sticky, inherits row bg ────────────────── */
.ctb-th--row,
.ctb-td--casino {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 160px;
  white-space: normal;
  background: inherit;
  /* subtle separator shadow so sticky cell looks clean over scrolled content */
  box-shadow: 3px 0 8px -3px rgba(29,39,48,.12);
}

.ctb-table tbody tr:nth-child(even) .ctb-th--row,
.ctb-table tbody tr:nth-child(even) .ctb-td--casino {
  background: var(--ctb-bg);
}

.ctb-table tbody tr:hover .ctb-th--row,
.ctb-table tbody tr:hover .ctb-td--casino {
  background: var(--ctb-bg-alt);
}

/* Row-header cell (<th scope="row">) resets */
.ctb-th--row {
  font-weight: normal;
  text-align: left;
  padding: 14px 18px;
}

/* ── Casino name — matches .ccb-title ───────────────────────── */
.ctb-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ctb-text);
  line-height: 1.35;
}

/* ── Rating — matches ccb-meta__score + ccb-stars ───────────── */
.ctb-rating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.ctb-rating-num {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ctb-text);
  line-height: 1;
}

.ctb-stars {
  display: inline-flex;
  align-items: center;
}

/* poka_affiliate_rating() wraps icons in <div class="rating"> */
.ctb-stars .rating {
  display: inline-flex;
  align-items: center;
}

.ctb-stars .icon,
.ctb-stars .rating .icon {
  font-family: "pokatheme" !important;
  font-style: normal;
  speak: none;
  color: var(--ctb-gold) !important;
  font-size: .95rem !important;
  line-height: 1;
  margin: 0 1px;
}

/* ── Bonus cell — matches .ccb-bonus pill ───────────────────── */
.ctb-bonus {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ctb-green);
  background: rgba(68,190,76,.08);
  border: 1px solid rgba(68,190,76,.22);
  border-radius: 5px;
  padding: .3rem .65rem;
  line-height: 1.4;
  white-space: normal;
  max-width: 260px;
}

.ctb-bonus strong {
  color: var(--ctb-green);
  font-weight: 800;
}

.ctb-td--bonus {
  white-space: normal;
}

/* ── Stat pill — matches .ccb-meta__stat ────────────────────── */
.ctb-pill {
  display: inline-block;
  background: var(--ctb-bg-alt);
  border-radius: 4px;
  padding: .22rem .55rem;
  font-size: .8rem;
  color: var(--ctb-text-muted);
  white-space: nowrap;
}

/* ── Dash ───────────────────────────────────────────────────── */
.ctb-dash {
  color: #c5cdd6;
  font-size: .85em;
}

/* ── Licence ────────────────────────────────────────────────── */
.ctb-licence {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .8rem;
  color: var(--ctb-text-muted);
}

.ctb-flag {
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Editor placeholder ─────────────────────────────────────── */
.ctb-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5em;
  background: var(--ctb-bg);
  border: 2px dashed var(--ctb-border);
  border-radius: var(--ctb-radius);
  color: var(--ctb-text-muted);
  gap: .65em;
}

.ctb-placeholder--warning {
  border-color: #ffc107;
  background: #fff3cd;
  color: #7a5800;
}

/* ── Editor token field ─────────────────────────────────────── */
.ctb-review-token-wrap {
  margin-bottom: 8px;
}

.ctb-token--dragging {
  opacity: .45;
  cursor: grabbing !important;
}

/* ── Mobile — compact table, horizontal scroll ──────────────── */
@media ( max-width: 680px ) {

  .ctb-th,
  .ctb-td,
  .ctb-th--row {
    padding: 11px 13px;
    font-size: .82em;
  }

  .ctb-name {
    font-size: .9rem;
  }

  .ctb-rating-num {
    font-size: 1.05rem;
  }

  .ctb-stars .icon,
  .ctb-stars .rating .icon {
    font-size: .82rem !important;
  }

  .ctb-bonus {
    font-size: .78rem;
    padding: .22rem .5rem;
    max-width: 220px;
  }

  .ctb-td--bonus {
    min-width: 200px;
    white-space: normal;
    word-break: break-word;
  }

  .ctb-scroll {
    border-radius: 8px;
  }
}
