/*
 * Delasport Odds Widget — responsive table design
 * Class prefix: dow-
 * Design tokens: mirrors player-props.css (:root) — self-contained so
 * this file can load on pages where player-props.css is absent.
 * Desktop: semantic <table> with 1X2 odd-button columns.
 * Mobile (≤640px): same <table>, CSS turns rows into match cards.
 * No duplicate markup, no display:none copies.
 */

/* ══════════════════════════════════════════════════════════════
   DESIGN TOKENS — identical values to player-props.css :root
   Safe to include on the same page: duplicate :root is harmless.
   ══════════════════════════════════════════════════════════════ */
:root {
  /* Brand palette */
  --slotimo-primary:       #1C68EC;
  --slotimo-primary-dark:  #1552BC;
  --slotimo-accent:        #45B723;
  --slotimo-dark:          #333333;
  --slotimo-text:          #333333;
  --slotimo-text-muted:    #666666;
  --slotimo-bg-content:    #F5F5F7;
  --slotimo-bg-subtle:     #ebebed;
  --slotimo-border:        #e0e0e2;

  /* Surface */
  --surface:               #ffffff;

  /* Tints (derived from primary) */
  --primary-tint-04:       rgba(28, 104, 236, 0.04);
  --primary-tint-08:       rgba(28, 104, 236, 0.08);
  --primary-ring:          rgba(28, 104, 236, 0.40);

  /* Radii */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  /* Typography */
  --font-heading: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body:    "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* ── Widget wrapper ──────────────────────────────────────────── */
.dow-widget {
  font-family: var(--font-body);
  color: var(--slotimo-text);
  margin: var(--s-6) 0 var(--s-5);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Header ─────────────────────────────────────────────────── */
.dow-header {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-bottom: var(--s-2);
}

.dow-header__title-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.dow-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--slotimo-dark);
}

.dow-title__scope {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--slotimo-text-muted);
  margin-left: var(--s-1);
}

.dow-updated {
  font-size: 0.78rem;
  color: var(--slotimo-text-muted);
  white-space: nowrap;
}

/* ── LIVE badge ─────────────────────────────────────────────── */
.dow-badge--live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  vertical-align: middle;
}

.dow-badge--inline {
  font-size: 10px;
  padding: 2px 6px;
}

.dow-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
  animation: dow-pulse 1.8s ease-in-out infinite;
}

@keyframes dow-pulse {
  0%, 100% { opacity: 1;   box-shadow: 0 0 0 2px rgba(255,255,255,0.25); }
  50%       { opacity: 0.5; box-shadow: 0 0 0 5px rgba(255,255,255,0.05); }
}

/* ── Table wrapper ──────────────────────────────────────────── */
.dow-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
}

/* ── Table base ─────────────────────────────────────────────── */
.dow-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  min-width: 520px;
}

/* Column widths */
.dow-col-event  { width: auto;  min-width: 180px; }
.dow-col-time   { width: 90px;  }
.dow-col-odd    { width: 72px;  }
.dow-col-action { width: 100px; }

/* ── thead ──────────────────────────────────────────────────── */
.dow-table thead th {
  background: var(--slotimo-bg-content);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slotimo-text-muted);
  padding: var(--s-2) var(--s-3);
  border-bottom: 2px solid var(--slotimo-border);
  text-align: center;
  white-space: nowrap;
}

.dow-table thead .dow-col-event { text-align: left; }

/* ── tbody rows ─────────────────────────────────────────────── */
.dow-row {
  transition: background 0.12s;
}

.dow-row + .dow-row {
  border-top: 1px solid var(--slotimo-border);
}

/* Zebra stripe */
.dow-row:nth-child(even) {
  background: var(--slotimo-bg-content);
}

.dow-row:hover {
  background: var(--primary-tint-04);
}

.dow-row--live {
  background: #fff8f8;
}

.dow-row--live:hover {
  background: #fff0f0;
}

/* Featured row — thin accent left border + very light primary tint */
.dow-row--featured {
  background: var(--primary-tint-04);
  box-shadow: inset 3px 0 0 var(--slotimo-primary);
}

.dow-row--featured:hover {
  background: var(--primary-tint-08);
}

/* ── Cells ──────────────────────────────────────────────────── */
.dow-cell {
  padding: var(--s-3);
  vertical-align: middle;
  text-align: center;
}

.dow-cell--event {
  text-align: left;
  min-width: 0;
}

.dow-cell--time {
  color: var(--slotimo-text-muted);
  font-size: 13px;
  white-space: nowrap;
}

.dow-cell--action {
  text-align: right;
  padding-right: var(--s-3);
}

/* ── Matchup block ──────────────────────────────────────────── */
.dow-matchup {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.dow-matchup__league {
  font-size: 11px;
  color: var(--slotimo-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dow-matchup__country {
  color: var(--slotimo-text-muted);
}

.dow-matchup__teams {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  min-width: 0;
}

.dow-matchup__home,
.dow-matchup__away {
  font-weight: 600;
  font-family: var(--font-heading);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  color: var(--slotimo-dark);
}

.dow-matchup__vs {
  color: var(--slotimo-text-muted);
  font-size: 11px;
  font-weight: 400;
  flex-shrink: 0;
}

/* ── Odd buttons ────────────────────────────────────────────── */
.dow-odd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 44px;
  padding: var(--s-1) var(--s-2);
  background: var(--primary-tint-04);
  color: var(--slotimo-primary);
  border: 1px solid rgba(28, 104, 236, 0.18);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
  cursor: pointer;
}

.dow-odd-btn:hover,
.dow-odd-btn:focus-visible {
  background: var(--primary-tint-08);
  border-color: var(--slotimo-primary);
  color: var(--slotimo-primary-dark);
  text-decoration: none;
  transform: translateY(-1px);
}

.dow-odd-btn:focus-visible {
  outline: 2px solid var(--slotimo-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--primary-ring);
}

.dow-odd-btn--disabled {
  background: var(--slotimo-bg-content);
  color: var(--slotimo-text-muted);
  border-color: var(--slotimo-border);
  cursor: not-allowed;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 13px;
  transform: none;
}

/* ── CTA "Bet now" button ────────────────────────────────────── */
.dow-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: var(--s-1) var(--s-3);
  background: var(--slotimo-primary);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s, transform 0.08s;
  cursor: pointer;
  vertical-align: middle;
}

.dow-cta-btn:hover,
.dow-cta-btn:focus-visible {
  background: var(--slotimo-primary-dark);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

.dow-cta-btn:focus-visible {
  outline: 2px solid var(--slotimo-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--primary-ring);
}

/* ── Visually hidden (a11y / SEO-safe) ─────────────────────── */
.dow-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Empty state ────────────────────────────────────────────── */
.dow-empty {
  background: var(--slotimo-bg-content);
  border: 1px solid var(--slotimo-border);
  border-radius: var(--r-md);
  padding: var(--s-5) var(--s-4);
  margin: var(--s-2) 0 var(--s-4);
}

.dow-empty__msg {
  margin: 0;
  color: var(--slotimo-text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* ── Disclaimer ─────────────────────────────────────────────── */
.dow-disclaimer {
  font-size: 0.72rem;
  color: var(--slotimo-text-muted);
  margin: var(--s-2) 0 0;
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════════
   SPECIFICITY OVERRIDE — theme conflict fix
   Problem: .slotimo-article__content a { color: var(--slotimo-primary) !important;
   text-decoration: underline !important; } uses !important and cannot be
   beaten by specificity alone. Fix: matching !important on the properties
   the theme overrides (color, text-decoration). Background and geometry
   are not touched by the theme rule, so no !important there.
   This block MUST appear BEFORE the mobile media queries below so that
   the mobile flat-style overrides (same specificity + !important) win by
   source order (last declaration wins when importance + specificity match).
   ══════════════════════════════════════════════════════════════ */

/* CTA "Bet now" — white text on blue background.
   Covers both the header CTA and per-row CTA inside tbody.
   !important on color + text-decoration only — these are what the theme
   forces via its own !important. Background stays blue from .dow-cta-btn. */
.dow-widget a.dow-cta-btn {
  color: #fff !important;
  text-decoration: none !important;
}

.dow-widget a.dow-cta-btn:hover,
.dow-widget a.dow-cta-btn:focus-visible {
  color: #fff !important;
  text-decoration: none !important;
}

/* Odd buttons 1/X/2 — chip appearance on desktop.
   Theme forces color + text-decoration via !important on all <a> inside
   .slotimo-article__content. We restore chip look with !important on the
   four visual properties the theme can flatten: background, border,
   border-radius, text-decoration. Color stays blue (--slotimo-primary) —
   theme's own value is fine here, so color does NOT get !important.
   min-height (≥44px) and padding are geometry not touched by the theme.
   Mobile (≤640px) media query below overrides back to flat style. */
.dow-widget a.dow-odd-btn {
  background: var(--primary-tint-08) !important;
  border: 1px solid var(--slotimo-border) !important;
  border-radius: var(--r-md) !important;
  text-decoration: none !important;
  padding: var(--s-1) var(--s-2);
  min-height: 44px;
}

.dow-widget a.dow-odd-btn:hover,
.dow-widget a.dow-odd-btn:focus-visible {
  background: var(--primary-tint-08) !important;
  border-color: var(--slotimo-primary) !important;
  text-decoration: none !important;
}

/* disabled variant — <span>, not <a>, theme rule does not apply.
   Keep the same box geometry so it aligns with active odd buttons. */
.dow-widget .dow-odd-btn--disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 44px;
  padding: var(--s-1) var(--s-2);
}

/* ══════════════════════════════════════════════════════════════
   MOBILE ≤ 640px
   Same <table> DOM — CSS transforms rows into match cards.
   One source of markup, no duplicate content, no display:none copy.
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* Table wrapper: remove horizontal scroll — cards are block */
  .dow-table-wrap {
    overflow-x: visible;
    border: none;
    border-radius: 0;
    background: transparent;
  }

  /* Hide thead visually but keep in DOM (a11y / SEO safe).
     Screenreaders use data-label on each <td> instead.
     No display:none — that would remove it from accessibility tree. */
  .dow-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  /* table → block flow */
  .dow-table,
  .dow-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  /* Each row → a card */
  .dow-table .dow-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto auto;
    background: var(--surface);
    border: 1px solid var(--slotimo-border);
    border-radius: var(--r-lg);
    margin-bottom: var(--s-3);
    overflow: hidden;
  }

  .dow-table .dow-row:nth-child(even) {
    background: var(--surface);
  }

  .dow-table .dow-row--live {
    border-color: #fca5a5;
    background: #fff8f8;
  }

  /* Featured card: accent left border + light primary tint */
  .dow-table .dow-row--featured {
    border-left: 3px solid var(--slotimo-primary);
    background: var(--primary-tint-04);
    box-shadow: none;
  }

  .dow-table .dow-row + .dow-row {
    border-top: 1px solid var(--slotimo-border);
  }

  /* ── Card row 1: event info spans full width ── */
  .dow-cell--event {
    grid-column: 1 / -1;
    grid-row: 1;
    padding: var(--s-3) var(--s-3) var(--s-2);
    border-bottom: 1px solid var(--slotimo-border);
    background: var(--slotimo-bg-content);
    text-align: left;
  }

  /* Date/time cell hidden on cards — info in event row area via data-label */
  .dow-cell--time {
    display: none;
  }

  /* Odd cells: row 2, columns 1–3 */
  .dow-cell--home {
    grid-column: 1;
    grid-row: 2;
  }
  .dow-cell--draw {
    grid-column: 2;
    grid-row: 2;
    border-left: 1px solid var(--slotimo-border);
  }
  .dow-cell--away {
    grid-column: 3;
    grid-row: 2;
    border-left: 1px solid var(--slotimo-border);
  }

  /* Outcome label (1 / X / 2) above the coefficient button */
  .dow-cell--odd::before {
    content: attr(data-label);
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--slotimo-text-muted);
    text-align: center;
    padding-top: var(--s-1);
    line-height: 1;
  }

  /* CTA: row 3, full width */
  .dow-cell--action {
    grid-column: 1 / -1;
    grid-row: 3;
    border-top: 1px solid var(--slotimo-border);
    padding: var(--s-2) var(--s-3);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  /* Odd cells: center content, full-height touch target */
  .dow-cell--odd {
    padding: var(--s-2) var(--s-1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  /* Odd buttons: fill cell, larger touch area.
     Specificity raised to .dow-widget a.dow-odd-btn + !important on the
     same properties as the bottom override, so mobile flat style wins
     over the desktop chip override when inside ≤640px media query. */
  .dow-widget a.dow-odd-btn {
    min-width: unset;
    width: 100%;
    min-height: 44px;
    font-size: 16px;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--slotimo-primary);
  }

  .dow-widget a.dow-odd-btn:hover,
  .dow-widget a.dow-odd-btn:focus-visible {
    background: var(--primary-tint-08) !important;
    border: none !important;
    transform: none;
    color: var(--slotimo-primary-dark);
  }

  .dow-odd-btn--disabled {
    background: transparent;
    color: var(--slotimo-text-muted);
    border: none;
    min-height: 44px;
  }

  /* CTA button: full-width row — generous touch target (≥44px) */
  .dow-cta-btn {
    min-height: 48px;
    padding: var(--s-2) var(--s-4);
    font-size: 13px;
    border-radius: var(--r-md);
    width: 100%;
    justify-content: center;
  }

  /* Matchup: show full team names, allow wrap */
  .dow-matchup__home,
  .dow-matchup__away {
    white-space: normal;
    font-size: 14px;
  }

  .dow-matchup__teams {
    flex-wrap: wrap;
  }

}

/* ── Controls block (filters="1" mode) ─────────────────────── */
/*
 * Desktop: search right, country-select left.
 * Mobile (≤640px): search on top (order:-1 + full width),
 *   country-select below it (also full width) — inline, no drawer.
 * Pattern mirrors player-props.css .controls / .controls-inner.
 */
.dow-controls {
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(160%) blur(8px);
  -webkit-backdrop-filter: saturate(160%) blur(8px);
  border-top: 1px solid var(--slotimo-border);
  border-bottom: 1px solid var(--slotimo-border);
  margin-bottom: var(--s-3);
}

.dow-controls-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0;
}

/* Country select wrapper */
.dow-country-wrap {
  display: inline-flex;
  align-items: center;
  order: 2;
}

/* Country select — styled to match .control from player-props.css */
.dow-country-select {
  height: 36px;
  padding: 0 var(--s-3);
  border: 1px solid var(--slotimo-border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--slotimo-text);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-width: 160px;
  appearance: auto;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dow-country-select:hover {
  border-color: rgba(28, 104, 236, 0.4);
}

.dow-country-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-ring);
  border-color: var(--slotimo-primary);
}

/* Search input wrapper — mirrors .search-input from player-props.css */
.dow-search-input {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  border: 1px solid var(--slotimo-border);
  border-radius: var(--r-md);
  padding: 6px 10px;
  background: var(--surface);
  color: var(--slotimo-text-muted);
  height: 36px;
  flex: 1 1 auto;
  min-width: 160px;
  max-width: 280px;
  cursor: text;
  order: 3;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dow-search-input svg {
  flex: 0 0 auto;
  color: var(--slotimo-text-muted);
}

.dow-search-input:focus-within {
  border-color: var(--slotimo-primary);
  box-shadow: 0 0 0 2px var(--primary-ring);
}

/* The actual <input> inside .dow-search-input */
.dow-search {
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--slotimo-text);
  width: 100%;
  outline: none;
  min-width: 0;
}

.dow-search::placeholder {
  color: var(--slotimo-text-muted);
}

/* No-results message */
.dow-no-results {
  margin: var(--s-3) 0;
  padding: var(--s-3) var(--s-4);
  background: var(--slotimo-bg-content);
  border: 1px solid var(--slotimo-border);
  border-radius: var(--r-md);
  color: var(--slotimo-text-muted);
  font-size: 0.9rem;
  text-align: center;
}

/* ── Controls: mobile ≤640px ─────────────────────────────────── */
@media (max-width: 640px) {
  .dow-controls-inner {
    padding-left: 0;
    padding-right: 0;
    gap: var(--s-2);
  }

  /* Search on top */
  .dow-search-input {
    order: -1;
    flex: 1 1 100%;
    max-width: 100%;
  }

  /* Country select full width below search */
  .dow-country-wrap {
    order: 0;
    flex: 1 1 100%;
  }

  .dow-country-select {
    width: 100%;
    height: auto;
    min-height: 44px;
    padding-top: var(--s-2);
    padding-bottom: var(--s-2);
  }

  /* Touch target: raise search wrapper to ≥44px on mobile */
  .dow-search-input {
    height: auto;
    min-height: 44px;
    padding-top: var(--s-2);
    padding-bottom: var(--s-2);
  }
}

/* ── Very small screens (375px / 320px) overflow guard ─────── */
@media (max-width: 375px) {
  .dow-widget {
    margin-left: 0;
    margin-right: 0;
  }

  .dow-matchup__home,
  .dow-matchup__away {
    font-size: 13px;
  }

  /* Keep the 3 odd cols in equal grid; CTA is on its own row */
  .dow-table .dow-row {
    grid-template-columns: 1fr 1fr 1fr;
  }

  /* 2-way: keep 2 equal cols on very small screens */
  .dow-widget--2way .dow-table .dow-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* ══════════════════════════════════════════════════════════════
   2-WAY OUTCOMES (basketball / tennis / baseball)
   .dow-widget--2way is set by PHP when $odds['outcomes'] < 3.
   Desktop: draw column is absent from DOM — no CSS needed there.
   Mobile (≤640px): change 3-col grid to 2-col for odd cells.
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  /* 2-way card: two equal odd columns */
  .dow-widget--2way .dow-table .dow-row {
    grid-template-columns: 1fr 1fr;
  }

  /* home col 1, away col 2 — no draw cell exists */
  .dow-widget--2way .dow-cell--home {
    grid-column: 1;
  }

  .dow-widget--2way .dow-cell--away {
    grid-column: 2;
    border-left: 1px solid var(--slotimo-border);
  }

  /* CTA still spans full width */
  .dow-widget--2way .dow-cell--action {
    grid-column: 1 / -1;
  }
}

