/* Pestaña Partidos: calendario por día. */

#panel-partidos {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 760px;
  margin: 0 auto;
}

.day-card { scroll-margin-top: 150px; }

.day-title {
  text-transform: capitalize;
  color: var(--dim);
  font-size: 0.9rem;
}

.day-today { border-color: var(--accent); }

.day-today .day-title { color: var(--text); }

.today-tag {
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.6px;
}

.day-matches { display: flex; flex-direction: column; }

.match-row {
  display: grid;
  grid-template-columns: 26px 1fr 84px 1fr 86px;
  align-items: center;
  gap: 8px;
  padding: 9px 4px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.match-row:first-child { border-top: 0; }

.match-row.row-live {
  background: rgba(255, 77, 109, 0.06);
  border-radius: 8px;
}

.match-group {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--dim);
  font-size: 0.66rem;
  font-weight: 800;
}

.match-team {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.match-team .team-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-home { justify-content: flex-end; text-align: right; }

.match-score {
  text-align: center;
  font-size: 1.02rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 4px 0;
}

.match-score-empty { color: var(--dim); font-weight: 600; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-live { background: rgba(255, 77, 109, 0.14); color: var(--live); }
.badge-final { background: var(--surface-2); color: var(--dim); }
.badge-pending { background: var(--surface-2); color: var(--dim); font-variant-numeric: tabular-nums; }

/* ============================================================= tooltip */

.match-row-wrapper {
  position: relative;
}

.match-row-wrapper:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

.match-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  z-index: 50;
  width: max-content;
  max-width: min(300px, calc(100vw - 32px));
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.16s, transform 0.16s, visibility 0.16s;
}

/* Arrow pointing down toward the match row */
.match-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--surface-2);
}

/* Border ring for the arrow */
.match-tooltip::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 1px;
  border: 6px solid transparent;
  border-top-color: var(--border);
  z-index: -1;
}

.match-row-wrapper:hover .match-tooltip,
.match-row-wrapper:focus-within .match-tooltip,
.match-row-wrapper.tooltip-open .match-tooltip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Live indicator row */
.tt-live-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--live);
  margin-bottom: 6px;
}

.tt-live-row .live-dot { width: 7px; height: 7px; flex-shrink: 0; }

/* Section title */
.tt-section {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--dim);
  margin-top: 6px;
  margin-bottom: 2px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--border);
}

/* Individual event row */
.tt-event {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.79rem;
  padding: 2px 0;
  white-space: nowrap;
}

/* Away team events: reversed layout (name on left visually = right in logical order) */
.tt-event-away {
  flex-direction: row-reverse;
}

.tt-min {
  font-size: 0.73rem;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  min-width: 26px;
}

.tt-icon { font-size: 0.85rem; }

.tt-name {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.tt-team {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 110px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--dim);
  font-size: 0.68rem;
  font-weight: 700;
  overflow: hidden;
}

.tt-team .flag {
  width: 16px;
  height: 11px;
  flex: none;
}

.tt-team span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card rectangles */
.tt-card {
  display: inline-block;
  width: 10px;
  height: 13px;
  border-radius: 2px;
  flex-shrink: 0;
}

.tt-card-yellow { background: #eab308; }
.tt-card-red { background: #ef4444; }
.tt-card-yr { background: linear-gradient(135deg, #eab308 50%, #ef4444 50%); }

/* Empty / no-data message */
.tt-empty {
  font-size: 0.78rem;
  color: var(--dim);
  font-style: italic;
}

/* ------------------------------------------------------------- móvil */
@media (max-width: 540px) {
  .match-row {
    grid-template-columns: 20px 1fr 64px 1fr 56px;
    gap: 5px;
    font-size: 0.8rem;
    padding: 8px 2px;
  }

  .match-score { font-size: 0.9rem; }

  .badge { padding: 3px 5px; font-size: 0.62rem; }

  .match-team .flag { width: 18px; height: 13px; }
}

@media (max-width: 540px) {
  .match-tooltip {
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    transform: translateY(6px);
  }

  .match-row-wrapper:hover .match-tooltip,
  .match-row-wrapper:focus-within .match-tooltip,
  .match-row-wrapper.tooltip-open .match-tooltip {
    transform: translateY(0);
  }

  .match-tooltip::before,
  .match-tooltip::after { display: none; }
}
