/* NovaChess Tournament Detail
   Scoped to .nc-tournament-detail only */

.nc-tournament-detail {
  --td-bg: #111020;
  --td-panel: #1b1729;
  --td-panel-alt: #24182e;
  --td-gold: #d9a441;
  --td-text: #f5f0e9;
  --td-muted: #beb3c4;
  --td-border: rgba(245, 240, 233, 0.1);

  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px 56px;
  background: var(--td-bg);
  color: var(--td-text);
  font-family: "Manrope", "DM Sans", sans-serif;
  box-sizing: border-box;
  border-radius: 16px;
}

.nc-tournament-detail.hidden,
.nc-tournament-detail [hidden],
.nc-tournament-detail .hidden {
  display: none !important;
}

.nc-tournament-detail *,
.nc-tournament-detail *::before,
.nc-tournament-detail *::after {
  box-sizing: border-box;
}

.nc-tournament-detail button,
.nc-tournament-detail input,
.nc-tournament-detail select {
  font: inherit;
}

.nc-tournament-detail button {
  cursor: pointer;
}

.nc-tournament-detail button:focus-visible,
.nc-tournament-detail a:focus-visible,
.nc-tournament-detail select:focus-visible {
  outline: 2px solid var(--td-gold);
  outline-offset: 3px;
}

/* Header */

.nc-tournament-detail .nc-td-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 22px;
  color: var(--td-muted);
  font-size: 11px;
}

.nc-tournament-detail .nc-td-breadcrumb a,
.nc-tournament-detail .nc-td-breadcrumb button {
  color: var(--td-gold);
  text-decoration: none;
  background: transparent;
  border: 0;
  padding: 0;
  font-weight: 700;
}

.nc-tournament-detail .nc-td-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.nc-tournament-detail .nc-td-title-group {
  min-width: 0;
}

.nc-tournament-detail .nc-td-status-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 12px;
}

.nc-tournament-detail .nc-td-status,
.nc-tournament-detail .nc-td-format {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.nc-tournament-detail .nc-td-status--upcoming {
  background: rgba(217, 164, 65, 0.13);
  color: var(--td-gold);
}

.nc-tournament-detail .nc-td-status--live {
  background: rgba(91, 214, 162, 0.12);
  color: #5bd6a2;
}

.nc-tournament-detail .nc-td-status--completed {
  background: rgba(190, 179, 196, 0.12);
  color: var(--td-muted);
}

.nc-tournament-detail .nc-td-format {
  border: 1px solid var(--td-border);
  color: var(--td-muted);
}

.nc-tournament-detail .nc-td-title-group h1 {
  margin: 0;
  font-size: clamp(28px, 4.5vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.045em;
  font-weight: 800;
}

.nc-tournament-detail .nc-td-title-group > p {
  max-width: 650px;
  margin: 10px 0 0;
  color: var(--td-muted);
  font-size: 13px;
  line-height: 1.7;
}

.nc-tournament-detail .nc-td-primary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.nc-tournament-detail .nc-td-btn {
  min-height: 43px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  transition: transform 0.2s ease, background 0.2s ease;
}

.nc-tournament-detail .nc-td-btn:hover {
  transform: translateY(-2px);
}

.nc-tournament-detail .nc-td-btn--gold {
  background: var(--td-gold);
  color: #17111f;
}

.nc-tournament-detail .nc-td-btn--gold:hover {
  background: #e8b958;
}

.nc-tournament-detail .nc-td-btn--outline {
  border-color: var(--td-border);
  background: transparent;
  color: var(--td-text);
}

.nc-tournament-detail .nc-td-btn--outline:hover {
  border-color: var(--td-gold);
}

/* Overview stats */

.nc-tournament-detail .nc-td-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.nc-tournament-detail .nc-td-overview-item {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--td-border);
  border-radius: 15px;
  background: var(--td-panel);
}

.nc-tournament-detail .nc-td-overview-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  background: rgba(217, 164, 65, 0.1);
  color: var(--td-gold);
  font-size: 20px;
}

.nc-tournament-detail .nc-td-overview-item div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.nc-tournament-detail .nc-td-overview-item small {
  color: var(--td-muted);
  font-size: 9px;
}

.nc-tournament-detail .nc-td-overview-item strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tabs */

.nc-tournament-detail .nc-td-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 20px;
  padding: 5px;
  border: 1px solid var(--td-border);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
}

.nc-tournament-detail .nc-td-tab {
  min-height: 38px;
  flex: 0 0 auto;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--td-muted);
  font-size: 11px;
  font-weight: 700;
  transition: background 0.2s ease, color 0.2s ease;
}

.nc-tournament-detail .nc-td-tab:hover {
  color: var(--td-text);
}

.nc-tournament-detail .nc-td-tab.is-active {
  background: var(--td-gold);
  color: #17111f;
}

/* Main layout */

.nc-tournament-detail .nc-td-content {
  display: none;
}

.nc-tournament-detail .nc-td-content.is-active {
  display: block;
}

.nc-tournament-detail .nc-td-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  align-items: start;
  gap: 18px;
}

.nc-tournament-detail .nc-td-main-column,
.nc-tournament-detail .nc-td-side-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.nc-tournament-detail .nc-td-panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--td-border);
  border-radius: 17px;
  background: linear-gradient(145deg, #1d192b, #191526);
}

.nc-tournament-detail .nc-td-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 18px;
}

.nc-tournament-detail .nc-td-eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--td-gold);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.nc-tournament-detail .nc-td-panel h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.nc-tournament-detail .nc-td-round-number {
  padding: 6px 10px;
  border: 1px solid var(--td-border);
  border-radius: 8px;
  color: var(--td-muted);
  font-size: 10px;
  white-space: nowrap;
}

/* Progress */

.nc-tournament-detail .nc-td-progress-track {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
}

.nc-tournament-detail .nc-td-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a8782e, var(--td-gold));
  transition: width 0.4s ease;
}

.nc-tournament-detail .nc-td-progress-labels {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: var(--td-muted);
  font-size: 10px;
}

.nc-tournament-detail .nc-td-round-content {
  margin-top: 18px;
}

/* Personal statistics */

.nc-tournament-detail .nc-td-my-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.nc-tournament-detail .nc-td-my-stats > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 13px;
  border: 1px solid var(--td-border);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
}

.nc-tournament-detail .nc-td-my-stats small {
  color: var(--td-muted);
  font-size: 9px;
}

.nc-tournament-detail .nc-td-my-stats strong {
  font-size: 17px;
  font-weight: 800;
}

/* Placeholder & Pairing Rows */

.nc-tournament-detail .nc-td-placeholder {
  padding: 20px 14px;
  border: 1px dashed var(--td-border);
  border-radius: 11px;
  color: var(--td-muted);
  font-size: 12px;
  line-height: 1.65;
  text-align: center;
}

.nc-tournament-detail .nc-td-pair-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid var(--td-border);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  font-size: 12px;
}

/* Tables */

.nc-tournament-detail .nc-td-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.nc-tournament-detail .nc-td-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  white-space: nowrap;
}

.nc-tournament-detail .nc-td-table th {
  padding: 12px 13px;
  border-bottom: 1px solid var(--td-border);
  color: var(--td-muted);
  font-size: 10px;
  font-weight: 700;
}

.nc-tournament-detail .nc-td-table td {
  padding: 12px 13px;
  border-bottom: 1px solid rgba(245, 240, 233, 0.06);
  font-size: 12px;
}

.nc-tournament-detail .nc-td-table tbody tr:last-child td {
  border-bottom: 0;
}

.nc-tournament-detail .nc-td-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.nc-tournament-detail .nc-td-table-empty {
  padding: 24px !important;
  color: var(--td-muted);
  text-align: center;
}

.nc-tournament-detail .nc-td-text-action {
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--td-gold);
  font-size: 11px;
  font-weight: 800;
}

.nc-tournament-detail .nc-td-text-action:hover {
  text-decoration: underline;
}

/* Information side panels */

.nc-tournament-detail .nc-td-info-list {
  display: flex;
  flex-direction: column;
  margin-top: 14px;
}

.nc-tournament-detail .nc-td-info-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--td-border);
}

.nc-tournament-detail .nc-td-info-list > div:last-child {
  border-bottom: 0;
}

.nc-tournament-detail .nc-td-info-list span {
  color: var(--td-muted);
  font-size: 11px;
}

.nc-tournament-detail .nc-td-info-list strong {
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}

.nc-tournament-detail .nc-td-organizer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
}

.nc-tournament-detail .nc-td-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid rgba(217, 164, 65, 0.3);
  border-radius: 50%;
  background: var(--td-panel-alt);
  color: var(--td-gold);
  font-size: 16px;
  font-weight: 800;
}

.nc-tournament-detail .nc-td-organizer > div:last-child {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.nc-tournament-detail .nc-td-organizer strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
}

.nc-tournament-detail .nc-td-organizer small {
  color: var(--td-muted);
  font-size: 10px;
}

/* Pairings, players and rules content */

.nc-tournament-detail .nc-td-round-select {
  max-width: 180px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--td-border);
  border-radius: 9px;
  background: var(--td-panel-alt);
  color: var(--td-text);
  font-size: 11px;
}

.nc-tournament-detail .nc-td-pairings,
.nc-tournament-detail .nc-td-player-list,
.nc-tournament-detail .nc-td-rules {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nc-tournament-detail .nc-td-rules {
  margin-top: 14px;
  color: var(--td-muted);
  font-size: 12px;
  line-height: 1.8;
}

/* RTL support */

[dir="rtl"] .nc-tournament-detail {
  direction: rtl;
}

[dir="rtl"] .nc-tournament-detail .nc-td-table {
  text-align: right;
}

[dir="rtl"] .nc-tournament-detail .nc-td-info-list strong {
  text-align: left;
}

/* Responsive */

@media (max-width: 950px) {
  .nc-tournament-detail .nc-td-main-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .nc-tournament-detail .nc-td-side-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nc-tournament-detail .nc-td-organizer-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .nc-tournament-detail {
    padding: 22px 15px 42px;
  }

  .nc-tournament-detail .nc-td-heading-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .nc-tournament-detail .nc-td-primary-actions {
    width: 100%;
  }

  .nc-tournament-detail .nc-td-primary-actions .nc-td-btn {
    flex: 1;
  }

  .nc-tournament-detail .nc-td-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nc-tournament-detail .nc-td-side-column {
    display: flex;
  }

  .nc-tournament-detail .nc-td-my-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nc-tournament-detail .nc-td-panel {
    padding: 17px;
  }

  .nc-tournament-detail .nc-td-tab {
    padding: 0 14px;
  }
}

@media (max-width: 420px) {
  .nc-tournament-detail .nc-td-overview-item {
    padding: 13px 10px;
    gap: 9px;
  }

  .nc-tournament-detail .nc-td-overview-icon {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .nc-tournament-detail .nc-td-panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .nc-tournament-detail .nc-td-round-select {
    max-width: 100%;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nc-tournament-detail *,
  .nc-tournament-detail *::before,
  .nc-tournament-detail *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
