/* ============================================================
   Tabla Pro League — Premium Public CSS
   Inspiración: Sofascore, Champions League, SaaS Premium
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
.tpl-wrapper {
  --tpl-bg:            #ffffff;
  --tpl-bg-secondary:  #f8fafc;
  --tpl-header-bg:     #0f1923;
  --tpl-header-text:   #ffffff;
  --tpl-border:        rgba(226, 232, 240, 0.8);
  --tpl-text-primary:  #1a202c;
  --tpl-text-muted:    #718096;
  --tpl-row-hover:     rgba(59, 130, 246, 0.04);
  --tpl-pts-color:     #1a202c;
  --tpl-shadow:        0 4px 32px rgba(0, 0, 0, 0.08);
  --tpl-shadow-hover:  0 8px 40px rgba(0, 0, 0, 0.12);
  --tpl-radius:        12px;
  --tpl-font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --tpl-transition:    all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  /* Zone colors — overridable per-widget via inline style */
  --tpl-champion:   #FFD700;
  --tpl-qualify:    #3B82F6;
  --tpl-playoff:    #10B981;
  --tpl-relegation: #EF4444;

  /* Form */
  --tpl-win:  #10B981;
  --tpl-draw: #94a3b8;
  --tpl-loss: #EF4444;

  font-family: var(--tpl-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Dark Mode ─────────────────────────────────────────────── */
.tpl-wrapper[data-tpl-theme="dark"] {
  --tpl-bg:           #0f1923;
  --tpl-bg-secondary: #162230;
  --tpl-header-bg:    #070e17;
  --tpl-border:       rgba(30, 45, 61, 0.9);
  --tpl-text-primary: #e2e8f0;
  --tpl-text-muted:   #6b7280;
  --tpl-row-hover:    rgba(59, 130, 246, 0.08);
  --tpl-pts-color:    #f8fafc;
  --tpl-shadow:       0 4px 32px rgba(0, 0, 0, 0.5);
}

/* ── Card Container ────────────────────────────────────────── */
.tpl-wrapper {
  max-width: 100%;
  margin: 0 auto;
}

.tpl-card {
  background: var(--tpl-bg);
  border-radius: var(--tpl-radius);
  box-shadow: var(--tpl-shadow);
  overflow: hidden;
  transition: var(--tpl-transition);
  border: 1px solid var(--tpl-border);
}

.tpl-card:hover {
  box-shadow: var(--tpl-shadow-hover);
}

/* ── Header ────────────────────────────────────────────────── */
.tpl-header {
  background: var(--tpl-header-bg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tpl-tournament-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.tpl-tournament-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: contain;
  background: rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.tpl-tournament-logo-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.tpl-tournament-meta {
  min-width: 0;
}

.tpl-tournament-name {
  color: var(--tpl-header-text);
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tpl-season-name {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ── Dark Mode Toggle ──────────────────────────────────────── */
.tpl-dark-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: var(--tpl-transition);
  flex-shrink: 0;
}

.tpl-dark-toggle:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.tpl-wrapper[data-tpl-theme="light"] .tpl-icon-moon,
.tpl-wrapper[data-tpl-theme="dark"]  .tpl-icon-sun {
  display: block;
}
.tpl-wrapper[data-tpl-theme="light"] .tpl-icon-sun,
.tpl-wrapper[data-tpl-theme="dark"]  .tpl-icon-moon {
  display: none;
}

/* ── Table Container ───────────────────────────────────────── */
.tpl-table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--tpl-border) transparent;
}

.tpl-table-container::-webkit-scrollbar {
  height: 4px;
}
.tpl-table-container::-webkit-scrollbar-track {
  background: transparent;
}
.tpl-table-container::-webkit-scrollbar-thumb {
  background: var(--tpl-border);
  border-radius: 2px;
}

/* ── Table ─────────────────────────────────────────────────── */
.tpl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.4;
}

/* Head */
.tpl-table thead tr {
  background: var(--tpl-header-bg);
}

.tpl-table thead th {
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 10px;
  white-space: nowrap;
  border: none;
}

.tpl-table thead th.tpl-col-team {
  text-align: left;
  padding-left: 16px;
}

.tpl-table thead th.tpl-col-stat,
.tpl-table thead th.tpl-col-pts,
.tpl-table thead th.tpl-col-pos,
.tpl-table thead th.tpl-col-form {
  text-align: center;
}

/* Body rows */
.tpl-row {
  position: relative;
  background: var(--tpl-bg);
  border-bottom: 1px solid var(--tpl-border);
  transition: background 0.15s ease;
  cursor: default;
}

.tpl-row:last-child {
  border-bottom: none;
}

.tpl-row:hover {
  background: var(--tpl-row-hover);
}

/* Row entrance animation */
@media (prefers-reduced-motion: no-preference) {
  .tpl-row {
    animation: tplFadeIn 0.3s ease both;
    animation-delay: calc(var(--row-index, 0) * 30ms);
  }
}

@keyframes tplFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Zone indicator — left border */
.tpl-row[data-zone="champion"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--tpl-champion);
}
.tpl-row[data-zone="qualify"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--tpl-qualify);
}
.tpl-row[data-zone="playoff"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--tpl-playoff);
}
.tpl-row[data-zone="relegation"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--tpl-relegation);
}

/* Cells */
.tpl-table td {
  padding: 11px 10px;
  color: var(--tpl-text-primary);
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
}

/* ── Position Column ───────────────────────────────────────── */
.tpl-pos-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tpl-text-muted);
  border-radius: 6px;
}

.tpl-pos-num.tpl-pos-champion {
  background: rgba(255, 215, 0, 0.12);
  color: #b8860b;
}

.tpl-wrapper[data-tpl-theme="dark"] .tpl-pos-num.tpl-pos-champion {
  background: rgba(255, 215, 0, 0.15);
  color: #FFD700;
}

/* ── Team Cell ─────────────────────────────────────────────── */
.tpl-team-cell {
  text-align: left !important;
  padding-left: 16px !important;
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}

.tpl-team-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
  background: var(--tpl-bg-secondary);
}

.tpl-team-logo-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}

.tpl-team-name {
  font-weight: 600;
  color: var(--tpl-text-primary);
  font-size: 13.5px;
  display: block;
}

.tpl-team-short {
  display: none;
  font-weight: 600;
  font-size: 12px;
  color: var(--tpl-text-primary);
}

/* ── Points Column ─────────────────────────────────────────── */
.tpl-pts {
  font-weight: 700;
  font-size: 15px !important;
  color: var(--tpl-pts-color);
  letter-spacing: -0.01em;
}

/* ── Goal Difference ───────────────────────────────────────── */
.tpl-positive {
  color: #16a34a;
  font-weight: 600;
}

.tpl-negative {
  color: #dc2626;
  font-weight: 600;
}

.tpl-wrapper[data-tpl-theme="dark"] .tpl-positive { color: #4ade80; }
.tpl-wrapper[data-tpl-theme="dark"] .tpl-negative { color: #f87171; }

/* ── Form Badges ───────────────────────────────────────────── */
.tpl-form-cell {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.tpl-form-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  transition: transform 0.15s ease;
}

.tpl-form-badge:hover {
  transform: scale(1.15);
}

.tpl-form-w { background: var(--tpl-win); }
.tpl-form-d { background: var(--tpl-draw); }
.tpl-form-l { background: var(--tpl-loss); }

/* ── Legend ────────────────────────────────────────────────── */
.tpl-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 20px;
  background: var(--tpl-bg-secondary);
  border-top: 1px solid var(--tpl-border);
}

.tpl-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--tpl-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tpl-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.tpl-legend-champion   { background: var(--tpl-champion); }
.tpl-legend-qualify    { background: var(--tpl-qualify); }
.tpl-legend-playoff    { background: var(--tpl-playoff); }
.tpl-legend-relegation { background: var(--tpl-relegation); }

/* ── Footer ────────────────────────────────────────────────── */
.tpl-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-top: 1px solid var(--tpl-border);
  background: var(--tpl-bg-secondary);
}

.tpl-updated,
.tpl-powered {
  font-size: 11px;
  color: var(--tpl-text-muted);
}

.tpl-powered a {
  color: var(--tpl-text-muted);
  text-decoration: none;
}

.tpl-powered a:hover {
  color: var(--tpl-text-primary);
}

/* ── Elementor Placeholder ─────────────────────────────────── */
.tpl-elementor-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  background: #f8fafc;
  border: 2px dashed #cbd5e0;
  border-radius: 8px;
  padding: 24px;
}

.tpl-elementor-placeholder p {
  color: #718096;
  font-family: var(--tpl-font);
  font-size: 14px;
  margin: 0;
}

/* ── Responsive ────────────────────────────────────────────── */

/* Tablet: hide GF/GC/DG */
@media (max-width: 768px) {
  .tpl-hide-sm {
    display: none !important;
  }

  .tpl-team-cell {
    min-width: 130px !important;
  }

  .tpl-table td,
  .tpl-table th {
    padding: 10px 7px;
  }

  .tpl-tournament-name {
    font-size: 14px;
  }
}

/* Mobile: show short name, hide full name and form */
@media (max-width: 480px) {
  .tpl-hide-xs {
    display: none !important;
  }

  .tpl-team-name {
    display: none;
  }

  .tpl-team-short {
    display: block;
  }

  .tpl-team-cell {
    min-width: 100px !important;
  }

  .tpl-header {
    padding: 12px 16px;
  }

  .tpl-tournament-logo,
  .tpl-tournament-logo-placeholder {
    width: 32px;
    height: 32px;
  }

  .tpl-pts {
    font-size: 14px !important;
  }
}

@media (max-width: 360px) {
  .tpl-hide-md {
    display: none !important;
  }
}
