/* =========================================================
   COMPETITORI – TABLE UI (Glass / Dark) + Tooltip (Works with scroll)
   ========================================================= */

.competitori-wrap {
  font-family:
    "Poppins",
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  color: rgba(255, 255, 255, 0.88);
}

.competitori-toolbar {
  margin-bottom: 14px;
}

#competitori-search {
  width: 360px;
  max-width: 100%;
  padding: 12px 14px;
  border-radius: 16px;

  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  outline: none;

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}
#competitori-search::placeholder {
  color: rgba(255, 255, 255, 0.55);
}
#competitori-search:focus {
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

/* =========================================================
   IMPORTANT STRUCTURE
   Outer = card (overflow visible)
   Inner = scroll on X
   ========================================================= */

.competitori-table-wrap {
  position: relative;
  overflow: visible; /* tooltip can overflow */

  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.competitori-scroll {
  overflow-x: auto; /* horizontal scroll ONLY here */
  overflow-y: visible;
  border-radius: 22px;
}

/* Table */
#competitori-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

/* Header */
#competitori-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;

  text-align: left;
  font-weight: 600;
  letter-spacing: 0.2px;

  padding: 14px 16px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(8, 18, 48, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Cells */
#competitori-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: middle;
  color: rgba(255, 255, 255, 0.82);
  overflow: visible; /* don't clip tooltip */
}

/* Rows */
#competitori-table tbody tr {
  position: relative;
  transition: background 0.15s ease;
}
#competitori-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
  z-index: 10;
}
#competitori-table tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}

/* Columns */
#competitori-table .c-rank {
  width: 56px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}
#competitori-table .c-name {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}
#competitori-table .c-score {
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
}
#competitori-table .c-league {
  font-weight: 600;
}

/* League badge */
.c-league .league-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;

  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
}
.c-league .league-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.95);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.14);
}

/* League colors */
.league-master .league-badge {
  border-color: rgba(250, 214, 165, 0.45);
  background: rgba(250, 214, 165, 0.1);
}
.league-master .league-dot {
  background: rgba(250, 214, 165, 0.98);
  box-shadow: 0 0 0 4px rgba(250, 214, 165, 0.18);
}

.league-liga-1 .league-badge {
  border-color: rgba(156, 122, 203, 0.45);
  background: rgba(156, 122, 203, 0.1);
}
.league-liga-1 .league-dot {
  background: rgba(156, 122, 203, 0.95);
  box-shadow: 0 0 0 4px rgba(156, 122, 203, 0.16);
}

.league-liga-2 .league-badge {
  border-color: rgba(45, 212, 191, 0.4);
  background: rgba(45, 212, 191, 0.08);
}
.league-liga-2 .league-dot {
  background: rgba(45, 212, 191, 0.95);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.16);
}

.league-liga-3 .league-badge {
  border-color: rgba(120, 190, 255, 0.35);
  background: rgba(120, 190, 255, 0.08);
}
.league-liga-3 .league-dot {
  background: rgba(120, 190, 255, 0.95);
  box-shadow: 0 0 0 4px rgba(120, 190, 255, 0.14);
}

.league-liga-4 .league-badge {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
}
.league-liga-4 .league-dot {
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1);
}

.league-liga-5 .league-badge {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
}
.league-liga-5 .league-dot {
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

/* =========================================================
   Tooltip on Name (hover + focus-within for mobile)
   ========================================================= */

.name-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.name-wrap.has-tooltip {
  cursor: pointer;
}

.name-wrap .medal {
  font-size: 16px;
  line-height: 1;
  transform: translateY(1px);
  opacity: 0.95;
}

.name-wrap.has-tooltip .name-text {
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.18);
  text-underline-offset: 4px;
}

.name-wrap .tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 10px);

  min-width: 260px;
  max-width: 420px;

  padding: 12px 14px;
  border-radius: 14px;

  background: rgba(8, 18, 48, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.9);

  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);

  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  visibility: hidden;

  transition:
    opacity 0.14s ease,
    transform 0.14s ease,
    visibility 0.14s ease;
  z-index: 9999;
}

.name-wrap .tooltip::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 18px;
  width: 14px;
  height: 14px;
  background: rgba(8, 18, 48, 0.92);
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  transform: rotate(45deg);
}

/* show tooltip desktop */
.name-wrap.has-tooltip:hover .tooltip {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

/* show tooltip mobile (tap -> focus) */
.name-wrap.has-tooltip:focus .tooltip,
.name-wrap.has-tooltip:focus-within .tooltip {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

.name-wrap.has-tooltip:focus {
  outline: none;
}

/* =========================================================
   TOP 3 highlight
   ========================================================= */
#competitori-table tbody tr.rank-1 {
  background: linear-gradient(
    90deg,
    rgba(250, 214, 165, 0.16),
    rgba(255, 255, 255, 0.02)
  );
  box-shadow:
    inset 0 0 0 1px rgba(250, 214, 165, 0.22),
    0 18px 60px rgba(250, 214, 165, 0.1);
}
#competitori-table tbody tr.rank-2 {
  background: linear-gradient(
    90deg,
    rgba(200, 210, 230, 0.14),
    rgba(255, 255, 255, 0.02)
  );
  box-shadow:
    inset 0 0 0 1px rgba(200, 210, 230, 0.2),
    0 18px 60px rgba(200, 210, 230, 0.08);
}
#competitori-table tbody tr.rank-3 {
  background: linear-gradient(
    90deg,
    rgba(205, 140, 95, 0.14),
    rgba(255, 255, 255, 0.02)
  );
  box-shadow:
    inset 0 0 0 1px rgba(205, 140, 95, 0.2),
    0 18px 60px rgba(205, 140, 95, 0.08);
}

#competitori-table tbody tr.rank-1 .c-rank {
  color: rgba(250, 214, 165, 0.98);
  font-weight: 800;
}
#competitori-table tbody tr.rank-2 .c-rank {
  color: rgba(200, 210, 230, 0.98);
  font-weight: 800;
}
#competitori-table tbody tr.rank-3 .c-rank {
  color: rgba(205, 140, 95, 0.98);
  font-weight: 800;
}

/* Responsive */
@media (max-width: 640px) {
  #competitori-table {
    min-width: 680px;
  }
  .name-wrap .tooltip {
    min-width: 220px;
    max-width: 280px;
  }
}
