/* assets/css/tournaments.css
   TopRated Competitive Platform – Tournaments frontend
   Palette:
   Primary:   #7c5cff
   Secondary: #9b87ff
   BG:        #1b1636
   Card:      #281f4c
   Dark:      #231c43
   Text:      #f1f0f6
   Muted:     #c9c6dd
   Danger:    #ff5c7a
*/

:root {
  --trcp-primary: #7c5cff;
  --trcp-secondary: #9b87ff;
  --trcp-bg: #1b1636;
  --trcp-card: #281f4c;
  --trcp-dark: #231c43;
  --trcp-text: #f1f0f6;
  --trcp-muted: #c9c6dd;
  --trcp-danger: #ff5c7a;

  --trcp-border: rgba(255,255,255,.10);
  --trcp-border-strong: rgba(255,255,255,.16);
  --trcp-shadow: 0 20px 40px rgba(0,0,0,.35);
  --trcp-radius: 18px;
}

/* -------------------------------------------------------------------------- */
/* Page wrapper                                                                */
/* -------------------------------------------------------------------------- */
.trcp-tournament-page {
  background: radial-gradient(circle at top, rgba(155,135,255,.16) 0%, rgba(27,22,54,1) 60%);
  color: var(--trcp-text);
  padding-bottom: 40px;
}

/* Force text colors inside tournament page (theme-proof) */
.trcp-tournament-page,
.trcp-tournament-page p,
.trcp-tournament-page li,
.trcp-tournament-page td,
.trcp-tournament-page th,
.trcp-tournament-page h1,
.trcp-tournament-page h2,
.trcp-tournament-page h3,
.trcp-tournament-page h4 {
  color: var(--trcp-text);
}

.trcp-tournament-page .trcp-muted {
  color: var(--trcp-muted) !important;
}

/* -------------------------------------------------------------------------- */
/* Hero                                                                         */
/* -------------------------------------------------------------------------- */
.trcp-tournament-hero {
  position: relative;
  border-radius: var(--trcp-radius);
  overflow: hidden;
  min-height: 170px;
  background: linear-gradient(180deg, rgba(35,28,67,.95), rgba(27,22,54,.98));
  box-shadow: var(--trcp-shadow);
  border: 1px solid rgba(255,255,255,.08);
  margin-bottom: 14px;
}

.trcp-tournament-hero__overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(155,135,255,.18) 0%, rgba(0,0,0,.45) 70%);
}

.trcp-tournament-hero__inner {
  position: relative;
  padding: 22px 20px;
}

.trcp-tournament-title {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 900;
  color: var(--trcp-text);
  text-shadow: 0 10px 30px rgba(0,0,0,.35);
}

.trcp-tournament-subtitle {
  margin-top: 6px;
  opacity: .92;
  font-weight: 700;
  color: var(--trcp-muted);
}

/* -------------------------------------------------------------------------- */
/* Tabs                                                                         */
/* -------------------------------------------------------------------------- */
.trcp-tournament-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 14px 0;
  padding: 0 2px;
}

.trcp-tournament-tab {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none !important;
  border: 1px solid rgba(255,255,255,.12);
  font-weight: 900;
  color: var(--trcp-muted) !important;
  background: rgba(255,255,255,.05);
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.trcp-tournament-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(155,135,255,.35);
  background: rgba(155,135,255,.10);
}

.trcp-tournament-tab.is-active {
  border-color: rgba(124,92,255,.60);
  background: linear-gradient(135deg, var(--trcp-primary), var(--trcp-secondary));
  color: #fff !important;
}

/* -------------------------------------------------------------------------- */
/* Content + Cards                                                              */
/* -------------------------------------------------------------------------- */
.trcp-tournament-content {
  margin-top: 6px;
}

/* Theme-proof: if Neve styles .trcp-card white, we override inside tournament */
.trcp-tournament-page .trcp-card,
.trcp-tournament-page .trcp-tournament-card {
  background: linear-gradient(180deg, rgba(40,31,76,.96), rgba(27,22,54,.98)) !important;
  border: 1px solid var(--trcp-border) !important;
  border-radius: var(--trcp-radius) !important;
  box-shadow: var(--trcp-shadow);
  padding: 18px 18px;
  margin-bottom: 14px;
}

/* Card headings */
.trcp-tournament-page .trcp-card h2,
.trcp-tournament-page .trcp-tournament-card h2 {
  margin: 0 0 12px 0;
  font-weight: 900;
  letter-spacing: .01em;
}

/* Richtext links */
.trcp-tournament-page .trcp-richtext a {
  color: var(--trcp-secondary) !important;
  text-decoration: none;
  border-bottom: 1px solid rgba(155,135,255,.35);
}
.trcp-tournament-page .trcp-richtext a:hover {
  border-bottom-color: rgba(155,135,255,.65);
}

/* -------------------------------------------------------------------------- */
/* Lists (Quick rules style like ladders)                                       */
/* -------------------------------------------------------------------------- */
.trcp-tournament-page .trcp-quickrules {
  margin: 0;
  padding-left: 18px;
}

.trcp-tournament-page .trcp-quickrules li {
  margin: 8px 0;
  color: var(--trcp-text);
}

.trcp-tournament-page .trcp-quickrules strong {
  color: var(--trcp-muted);
}

/* -------------------------------------------------------------------------- */
/* Tables                                                                       */
/* -------------------------------------------------------------------------- */
.trcp-tournament-page .trcp-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--trcp-border);
  border-radius: 14px;
  overflow: hidden;
}

.trcp-tournament-page .trcp-table th,
.trcp-tournament-page .trcp-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
  color: var(--trcp-text);
}

.trcp-tournament-page .trcp-table thead th {
  background: rgba(255,255,255,.04);
  font-weight: 900;
  color: var(--trcp-muted);
}

.trcp-tournament-page .trcp-table tbody tr:hover td {
  background: rgba(155,135,255,.06);
}

/* Mobile table readability */
@media (max-width: 720px) {
  .trcp-tournament-page .trcp-table,
  .trcp-tournament-page .trcp-table thead,
  .trcp-tournament-page .trcp-table tbody,
  .trcp-tournament-page .trcp-table th,
  .trcp-tournament-page .trcp-table td,
  .trcp-tournament-page .trcp-table tr {
    display: block;
    width: 100%;
  }

  .trcp-tournament-page .trcp-table thead {
    display: none;
  }

  .trcp-tournament-page .trcp-table {
    border: none;
    background: transparent;
  }

  .trcp-tournament-page .trcp-table tr {
    border: 1px solid var(--trcp-border);
    border-radius: 14px;
    overflow: hidden;
    margin: 0 0 12px 0;
    background: rgba(255,255,255,.03);
  }

  .trcp-tournament-page .trcp-table td {
    border-bottom: 1px solid rgba(255,255,255,.08);
  }

  .trcp-tournament-page .trcp-table td:last-child {
    border-bottom: none;
  }
}

/* -------------------------------------------------------------------------- */
/* Buttons (for signup / actions later)                                         */
/* -------------------------------------------------------------------------- */
.trcp-tournament-page .button,
.trcp-tournament-page button,
.trcp-tournament-page input[type="submit"] {
  border-radius: 12px;
}

.trcp-tournament-page .button.button-primary,
.trcp-tournament-page button.button-primary,
.trcp-tournament-page input[type="submit"].button-primary {
  background: linear-gradient(135deg, var(--trcp-primary), var(--trcp-secondary)) !important;
  border: 0 !important;
  color: #fff !important;
  font-weight: 900;
  box-shadow: 0 18px 34px rgba(124,92,255,.22);
}

.trcp-tournament-page .button.button-primary:hover,
.trcp-tournament-page button.button-primary:hover,
.trcp-tournament-page input[type="submit"].button-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

/* -------------------------------------------------------------------------- */
/* Notices (if you show signup_ok / signup_error)                               */
/* -------------------------------------------------------------------------- */
.trcp-tournament-page .notice {
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 0 14px 0;
  border: 1px solid var(--trcp-border);
  background: rgba(255,255,255,.04);
  color: var(--trcp-text);
}

.trcp-tournament-page .notice.notice-success {
  border-color: rgba(124,255,168,.25);
  background: rgba(124,255,168,.08);
}

.trcp-tournament-page .notice.notice-error {
  border-color: rgba(255,92,122,.35);
  background: rgba(255,92,122,.10);
}

/* -------------------------------------------------------------------------- */
/* Small helpers                                                                */
/* -------------------------------------------------------------------------- */
.trcp-tournament-page code {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.10);
  color: var(--trcp-text);
  padding: 2px 6px;
  border-radius: 8px;
}

/* -----------------------------------------
   Tournament Matches (Grouped by rounds)
------------------------------------------ */

.trcp-tm-round-title{
  margin: 0 0 10px 0;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.trcp-tm-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 840px){
  .trcp-tm-grid{ grid-template-columns: 1fr; }
}

.trcp-tm-match{
  border: 1px solid rgba(241,240,246,.12);
  border-radius: 16px;
  padding: 12px;
  background: rgba(17, 12, 40, 0.25);
  box-shadow: 0 10px 18px rgba(0,0,0,.18);
}

.trcp-tm-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.trcp-tm-title{
  font-weight: 900;
  opacity: .95;
}

.trcp-tm-status{
  font-size: 12px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(241,240,246,.14);
  background: rgba(241,240,246,.06);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.trcp-tm-sides{
  display:flex;
  flex-direction:column;
  gap: 8px;
}

.trcp-tm-side{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(241,240,246,.12);
  background: rgba(0,0,0,.12);
}

.trcp-tm-side.is-winner{
  border-color: rgba(124,92,255,.55);
  background: rgba(124,92,255,.14);
}

.trcp-tm-name{
  font-weight: 900;
  color: var(--tr-text, #f1f0f6);
}

.trcp-tm-score{
  font-weight: 900;
  min-width: 34px;
  text-align:right;
  opacity: .95;
  color: var(--tr-text, #f1f0f6);
}

.trcp-tm-actions{
  margin-top: 10px;
  display:flex;
  justify-content:flex-end;
}

.trcp-tm-link{
  text-decoration:none;
  font-weight: 900;
  border: 1px solid rgba(241,240,246,.16);
  padding: 8px 14px;
  border-radius: 999px;
  display:inline-block;
  color: var(--tr-accent, #7c5cff);
  background: rgba(241,240,246,.06);
}

.trcp-tm-link:hover{
  color: var(--tr-accent-hover, #9b87ff);
  border-color: rgba(155,135,255,.45);
}

/* Special highlights */
.trcp-tm-match--final{
  border-color: rgba(124,92,255,.55);
  background: rgba(124,92,255,.10);
}

.trcp-tm-match--thirdplace{
  border-color: rgba(255, 92, 122, .55);
  background: rgba(255, 92, 122, .10);
}

/* -------------------------------------------------------------------------- */
/* NEW: Separate section styles (Final vs Third place cards)                    */
/* -------------------------------------------------------------------------- */

/* These classes are on the ROUND container cards (not the match cards) */
.trcp-tournament-page .trcp-tm-round--final{
  border-color: rgba(124,92,255,.22) !important;
  box-shadow: 0 22px 44px rgba(124,92,255,.10);
}

.trcp-tournament-page .trcp-tm-round--thirdplace{
  border-color: rgba(255,92,122,.22) !important;
  box-shadow: 0 22px 44px rgba(255,92,122,.10);
}

/* Title accents */
.trcp-tournament-page .trcp-tm-round--final .trcp-tm-round-title{
  color: var(--trcp-text);
  text-shadow: 0 12px 30px rgba(124,92,255,.18);
}

.trcp-tournament-page .trcp-tm-round--thirdplace .trcp-tm-round-title{
  color: var(--trcp-text);
  text-shadow: 0 12px 30px rgba(255,92,122,.18);
}

/* Optional subtle badge feeling on the section title */
.trcp-tournament-page .trcp-tm-round--final .trcp-tm-round-title::after{
  content: " • Trophy";
  font-size: 12px;
  font-weight: 900;
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(124,92,255,.30);
  background: rgba(124,92,255,.10);
  color: rgba(241,240,246,.92);
  vertical-align: middle;
}

.trcp-tournament-page .trcp-tm-round--thirdplace .trcp-tm-round-title::after{
  content: " • Bronze";
  font-size: 12px;
  font-weight: 900;
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,92,122,.30);
  background: rgba(255,92,122,.10);
  color: rgba(241,240,246,.92);
  vertical-align: middle;
}

/* On very small screens, avoid title badge wrapping weirdly */
@media (max-width: 420px){
  .trcp-tournament-page .trcp-tm-round--final .trcp-tm-round-title::after,
  .trcp-tournament-page .trcp-tm-round--thirdplace .trcp-tm-round-title::after{
    display: inline-block;
    margin-top: 8px;
    margin-left: 0;
  }
}

/* -------------------------------------------------------------------------- */
/* Smash.gg-style Bracket Layout                                               */
/* -------------------------------------------------------------------------- */

.trcp-tbr-bracket{
  position: relative;
}

.trcp-tbr-bracket__scroll{
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 6px 18px 6px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.12);
}

.trcp-tbr-bracket__grid{
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 280px;
  gap: 16px;
  padding: 10px;
  min-height: 260px;
}

.trcp-tbr-col{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.trcp-tbr-col__header{
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
}

.trcp-tbr-col__title{
  font-weight: 900;
  color: var(--trcp-text);
  letter-spacing: .01em;
}

.trcp-tbr-col__matches{
  display:flex;
  flex-direction:column;
  gap: 14px;
  padding-bottom: 6px;
}

.trcp-tbr-empty{
  padding: 12px;
  border: 1px dashed rgba(255,255,255,.18);
  border-radius: 14px;
  color: var(--trcp-muted);
  background: rgba(255,255,255,.03);
  font-weight: 800;
}

/* Match node */
.trcp-tbr-node{
  position: relative;
  border: 1px solid rgba(241,240,246,.12);
  border-radius: 16px;
  padding: 12px;
  background: rgba(17, 12, 40, 0.25);
  box-shadow: 0 10px 18px rgba(0,0,0,.18);
}

.trcp-tbr-node.is-final{
  border-color: rgba(124,92,255,.55);
  background: rgba(124,92,255,.10);
}

.trcp-tbr-node.is-thirdplace{
  border-color: rgba(255, 92, 122, .55);
  background: rgba(255, 92, 122, .10);
}

.trcp-tbr-node__top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.trcp-tbr-node__mnum{
  font-weight: 900;
  opacity: .95;
}

.trcp-tbr-node__status{
  font-size: 12px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(241,240,246,.14);
  background: rgba(241,240,246,.06);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.trcp-tbr-node__badge{
  display:inline-block;
  margin: 0 0 8px 0;
  font-size: 12px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(124,92,255,.45);
  background: rgba(124,92,255,.12);
}

.trcp-tbr-node__badge--third{
  border-color: rgba(255,92,122,.55);
  background: rgba(255,92,122,.14);
}

.trcp-tbr-node__sides{
  display:flex;
  flex-direction:column;
  gap: 8px;
}

.trcp-tbr-side{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(241,240,246,.12);
  background: rgba(0,0,0,.12);
}

.trcp-tbr-side.is-winner{
  border-color: rgba(124,92,255,.55);
  background: rgba(124,92,255,.14);
}

.trcp-tbr-name{
  font-weight: 900;
  color: var(--trcp-text);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width: 190px;
}

.trcp-tbr-score{
  font-weight: 900;
  min-width: 34px;
  text-align:right;
  opacity: .95;
  color: var(--trcp-text);
}

.trcp-tbr-node__actions{
  margin-top: 10px;
  display:flex;
  justify-content:flex-end;
}

.trcp-tbr-link{
  text-decoration:none !important;
  font-weight: 900;
  border: 1px solid rgba(241,240,246,.16);
  padding: 8px 14px;
  border-radius: 999px;
  display:inline-block;
  color: var(--trcp-primary);
  background: rgba(241,240,246,.06);
}

.trcp-tbr-link:hover{
  color: var(--trcp-secondary);
  border-color: rgba(155,135,255,.45);
}

/* SVG overlay for connector lines */
.trcp-tbr-bracket__svgwrap{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index: 1;
}

.trcp-tbr-bracket__svg{
  width: 100%;
  height: 100%;
  display:block;
}

.trcp-tbr-bracket__grid,
.trcp-tbr-col__header,
.trcp-tbr-node{
  z-index: 2;
}

.trcp-tbr-line{
  stroke: rgba(201,198,221,.55);
  stroke-width: 2;
  fill: none;
}

.trcp-tbr-line.is-final{
  stroke: rgba(124,92,255,.70);
}

.trcp-tbr-line.is-thirdplace{
  stroke: rgba(255,92,122,.75);
}