/* TCDecks incremental UI layer.
   Keep this file small and page-agnostic while old inline styles are migrated. */

:root {
  --tc-primary: #434686;
  --tc-primary-strong: #34376f;
  --tc-accent: #d38c52;
  --tc-text-muted: #697283;
  --tc-border: #dddddd;
  --tc-border-soft: #d8d8e8;
  --tc-surface-soft: #f7f7fb;
  --tc-row-alt: #f3f3f3;
  --tc-success: #207245;
  --tc-danger: #b3261e;
  --tc-radius-sm: 2px;
}

.tc-muted {
  color: var(--tc-text-muted);
}

.tc-info-cell {
  border: 1px solid #fff;
}

.tc-link-strong {
  font-weight: bold;
}

.admin-inline-action {
  display: inline;
  margin: 0;
  padding: 0;
  line-height: inherit;
}

.admin-link-button {
  display: inline;
  border: 0;
  background: transparent;
  color: #369;
  cursor: pointer;
  font: inherit;
  line-height: inherit;
  padding: 0;
  margin: 0;
  text-decoration: underline;
  vertical-align: baseline;
  appearance: none;
  -webkit-appearance: none;
}

.admin-nav-button {
  margin-bottom: 1px;
  width: 120px;
}

.admin-filter-button {
  width: 150px;
}

.tc-note {
  margin: 10px 0 15px 0;
  line-height: 1.5;
}

.tc-panel {
  border: 1px solid var(--tc-border);
  padding: 10px;
  margin-bottom: 15px;
  background: #fff;
}

.tc-panel-narrow {
  max-width: 420px;
}

.tc-inline-form {
  margin: 8px 0 0 0;
}

.tc-action-bar {
  margin: 10px 0;
}

.tc-page-head {
  margin: 18px 0 16px;
  padding: 16px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(67,70,134,0.16);
}

.tc-page-head h1 {
  margin: 0 0 8px;
  color: var(--tc-primary);
  font-size: 34px;
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: 0;
}

.tc-page-head p {
  margin: 0;
  padding: 0;
  color: var(--tc-text-muted);
  line-height: 1.45;
}

.tc-format-head {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  padding: 20px;
  background-color: var(--tc-primary);
  background-position: center;
  background-size: cover;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.tc-format-head h1,
.tc-format-head p {
  position: relative;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.45);
}

.tc-format-head p {
  color: rgba(255,255,255,0.88);
  font-weight: 700;
}

.tc-archetype-head {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  position: relative;
  background: rgba(255,255,255,0.94);
}

.tc-archetype-head h1,
.tc-archetype-head p {
  max-width: 48%;
  position: relative;
  z-index: 2;
}

.tc-archetype-head h1 {
  text-shadow: 0 1px 0 rgba(255,255,255,0.7);
}

.tc-archetype-art {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 68%;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  z-index: 0;
}

.tc-archetype-head::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 34%, rgba(255,255,255,0.78) 48%, rgba(255,255,255,0.05) 100%);
  z-index: 1;
}

.tc-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 10px 0 14px;
}

.tc-toolbar select {
  min-width: 240px;
  max-width: 100%;
  box-sizing: border-box;
  height: 34px;
  border: 1px solid var(--tc-border-soft);
  background: #fff;
  color: #333;
}

.tc-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tc-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.tc-pagination .btn,
.tc-pagination .btn-1 {
  margin: 0;
  border: 1px solid var(--tc-border-soft);
  border-radius: var(--tc-radius-sm);
  box-shadow: none;
}

.tc-compact-toolbar {
  margin: 0;
}

.tc-filter-label {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  color: var(--tc-text-muted);
  font-size: 0.9em;
  font-weight: 700;
}

.tc-archetype-layout {
  align-items: flex-start;
}

.tc-archetype-image {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 auto 14px;
  border-radius: var(--tc-radius-sm);
  box-shadow: 0 1px 6px rgba(0,0,0,0.18);
}

.tc-compare-action {
  margin: 0;
  padding: 6px 14px;
  border: 1px solid var(--tc-primary) !important;
  background: var(--tc-primary) !important;
  color: #fff !important;
  box-shadow: none;
  cursor: pointer;
  font-weight: 700;
}

.tc-compare-action:disabled {
  border-color: #696ba0 !important;
  background: #696ba0 !important;
  color: #fff !important;
  opacity: 1;
  cursor: not-allowed;
}

.tc-archetype-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 18px;
  align-items: start;
  margin: 10px 0 12px;
  padding: 10px;
  border: 1px solid rgba(67,70,134,0.16);
  background: rgba(255,255,255,0.62);
}

.tc-archetype-controls .tc-toolbar,
.tc-archetype-controls .tc-pagination {
  margin: 0;
}

.tc-archetype-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: flex-start;
  min-width: 0;
}

.tc-archetype-controls .tc-toolbar {
  display: flex;
  min-width: 0;
}

.tc-archetype-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.tc-archetype-controls .tc-pagination {
  justify-content: flex-end;
  white-space: nowrap;
}

.tc-compare-slot {
  justify-self: end;
  text-align: right;
}

.tc-compare-help {
  display: block;
  margin-top: 4px;
  color: var(--tc-text-muted);
  font-size: 11px;
  font-weight: 700;
}

.tc-compare-warning {
  margin-top: 6px;
  color: var(--tc-danger);
  font-size: 12px;
  font-weight: 800;
}

.tc-archetype-table {
  table-layout: fixed;
}

.tc-archetype-table .tc-col-compare { width: 38px; }
.tc-archetype-table .tc-col-deck { width: 17%; }
.tc-archetype-table .tc-col-player { width: 18%; }
.tc-archetype-table .tc-col-event { width: auto; }
.tc-archetype-table .tc-col-date { width: 104px; }
.tc-archetype-table .tc-col-position { width: 86px; }

.tc-archetype-table th:first-child,
.tc-archetype-table td.tc-compare-cell {
  width: 36px;
  text-align: center;
}

.tc-archetype-table td {
  vertical-align: middle;
}

.tc-archetype-table td a {
  line-height: 1.25;
}

.tc-archetype-table .tc-nowrap {
  white-space: nowrap;
}

.tc-card-stat-link {
  display: inline-block;
  margin: 7px 0 4px;
  color: var(--tc-primary);
  font-weight: 800;
}

.tc-card-stat-link:hover {
  color: var(--tc-primary-strong);
}

.tc-side-panel .progress-container {
  border-radius: 999px;
  background: #d8d8e8;
  overflow: hidden;
}

.tc-side-panel .progress-bar {
  border-radius: 999px;
  padding-right: 10px;
}

.tc-source-head {
  width: 28px;
  text-align: center;
}

.tc-source-cell {
  text-align: center;
}

.src-ico {
  display: inline-block;
  width: 32px;
  height: 32px;
  background-image: url('../img/sourceicon.png');
  background-repeat: no-repeat;
  background-size: 32px 96px;
  vertical-align: middle;
}

.src-ico.src-paper {
  background-color: transparent;
  background-position: 0 0;
}

.src-ico.src-webcam {
  background-color: transparent;
  background-position: 0 -32px;
}

.src-ico.src-mol {
  background-color: transparent;
  background-position: 0 -64px;
}

.tc-side-panel {
  margin: 18px 0;
  padding: 14px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(67,70,134,0.16);
}

.tc-side-panel legend {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  float: left;
  margin: 0 0 12px;
  padding: 0;
  color: var(--tc-primary);
  font-weight: 900;
}

.tc-side-panel legend + * {
  clear: both;
}

.tc-side-panel legend h3 {
  margin: 0;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--tc-primary);
  color: var(--tc-primary);
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
  word-break: normal;
  overflow-wrap: anywhere;
}

.tc-side-panel a {
  text-decoration: none;
}

.tc-chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.tc-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  background: var(--tc-primary);
  color: #fff;
  box-sizing: border-box;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
}

.tc-chip:hover {
  background: var(--tc-primary-strong);
  color: #fff;
}

.tc-side-panel > .tc-chip {
  margin-bottom: 7px;
}

.tc-chip .badge {
  margin-left: 8px;
  background: #fff;
  border-color: #fff;
  border-radius: 999px;
  color: var(--tc-primary);
  flex: 0 0 auto;
  min-width: 18px;
  padding: 3px 8px;
  font-weight: 800;
}

.tc-source-dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(67,70,134,0.22);
}

.tc-source-dot.src-paper {
  background: #d38c52;
}

.tc-source-dot.src-webcam {
  background: #3a87ad;
}

.tc-source-dot.src-mol {
  background: #434686;
}

.tc-new-label {
  display: inline-block;
  margin-left: 8px;
  color: #b3261e;
  font-size: 0.78em;
  font-weight: 900;
}

.tc-ad img {
  max-width: 100%;
  height: auto;
}

.tc-deck-hero {
  margin: 18px 0 16px;
  padding: 12px 0 14px;
  background: transparent;
  color: #2f335f;
  border: 0;
  border-bottom: 1px solid rgba(67,70,134,0.18);
}

.tc-deck-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.tc-deck-title h1 {
  margin: 0;
  color: var(--tc-primary);
  font-size: 28px;
  line-height: 1.18;
  font-weight: 900;
  letter-spacing: 0;
}

.tc-deck-source {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

.tc-deck-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.tc-deck-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  background: var(--tc-surface-soft);
  color: var(--tc-primary);
  border: 1px solid var(--tc-border-soft);
  font-weight: 800;
}

.tc-deck-meta .tc-premium-label {
  background: rgba(211,140,82,0.18);
  color: #7a4a22;
}

.tc-deck-table {
  width: 100%;
  margin: 0 0 12px;
  background: transparent;
  border: 1px solid rgba(67,70,134,0.16);
  table-layout: fixed;
}

.tc-deck-table .tc-main-col {
  width: 35%;
}

.tc-deck-table .tc-side-col {
  width: 30%;
}

.tc-deck-table th {
  background: var(--tc-primary);
  color: #fff;
}

.tc-deck-cell {
  padding: 10px;
  vertical-align: top;
  background: transparent;
}

.tc-sideboard-cell {
  background: #fff;
}

.tc-mainboard-cell {
  background: transparent;
}

.tc-card-count {
  text-align: right;
  background: transparent;
}

.tc-mobile-side-count {
  text-align: right;
  background: var(--tc-primary);
  color: #fff;
  font-weight: bold;
}

.tc-deck-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 10px 0 16px;
}

.tc-deck-actions a,
.tc-deck-actions button {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--tc-border-soft);
  background: #fff;
  color: var(--tc-primary);
  font-weight: 800;
  text-decoration: none;
  box-sizing: border-box;
}

.tc-deck-actions a:hover,
.tc-deck-actions button:hover {
  background: var(--tc-primary);
  color: #fff;
}

.tc-section-title {
  margin: 18px 0 8px;
  color: var(--tc-primary);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: 0;
}

.tc-export-list {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tc-export-button img {
  display: block;
  height: 18px;
  width: auto;
  margin-left: 6px;
}

.tc-chart-box {
  max-width: 500px;
  margin: auto;
}

.tc-card-draw-panel {
  display: none;
  width: 100%;
  max-width: 820px;
  height: auto;
  min-height: 180px;
}

.tc-simulator-overlay {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  overflow: auto;
}

.tc-simulator-content {
  position: relative;
  width: 80%;
  margin: 50px auto;
  padding: 20px;
  background: #fff;
  border-radius: var(--tc-radius-sm);
  overflow: auto;
}

.tc-simulator-close {
  float: right;
}

.tc-simulator-note {
  margin: 10px 0;
  font-weight: bold;
}

.tc-simulator-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.tc-simulator-discards {
  margin-top: 10px;
  margin-bottom: 0;
}

.tc-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.tc-form-row input,
.tc-form-row select,
.tc-form-row textarea {
  box-sizing: border-box;
  color: #111;
}

.tc-field-xl {
  width: 30em;
  max-width: 100%;
}

.tc-field-lg {
  width: 25em;
  max-width: 100%;
}

.tc-field-md {
  width: 13em;
  max-width: 100%;
}

.tc-field-sm {
  width: 10em;
  max-width: 100%;
}

.tc-field-date {
  background-color: #fff !important;
  color: #697283 !important;
}

.tc-field-date::placeholder {
  color: #697283;
  opacity: 1;
}

.tc-table {
  border-collapse: collapse;
  margin: 25px 0;
  font-size: 1.2em;
  font-family: sans-serif;
  min-width: 400px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
}

.tc-table thead tr {
  background-color: var(--tc-primary);
  color: #ffffff;
  text-align: left;
}

.tc-table th,
.tc-table td {
  padding: 12px 15px;
}

.tc-table tbody tr {
  border-bottom: 1px solid var(--tc-border);
}

.tc-table tbody tr:nth-of-type(even) {
  background-color: var(--tc-row-alt);
}

.tc-table tbody tr:last-of-type {
  border-bottom: 2px solid var(--tc-primary);
}

.tc-table tbody tr:hover {
  font-weight: bold;
  color: var(--tc-primary);
  background-color: #fff;
}

.tc-table-accent thead tr {
  background-color: var(--tc-accent);
}

.tc-table-compact {
  width: 80%;
}

.tc-cell-primary {
  color: var(--tc-primary);
}

.tc-cell-position {
  color: var(--tc-primary);
  width: 14px;
}

.tc-top-1 {
  background-color: gold;
  font-weight: bold;
  color: #fff;
}

.tc-top-2 {
  background-color: silver;
  font-weight: bold;
}

.tc-top-3 {
  background-color: #cd7f32;
  font-weight: bold;
}

.tc-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 12px 0;
  line-height: 1.4;
}

.tc-pages a,
.tc-pages span {
  display: inline-block;
  padding: 5px 10px;
  border: 1px solid var(--tc-border-soft);
  background: var(--tc-surface-soft);
  color: var(--tc-primary);
  border-radius: var(--tc-radius-sm);
  font-size: 0.95em;
}

.tc-pages a:hover {
  background: var(--tc-primary);
  color: #fff;
  text-decoration: none;
}

.tc-pages .tc-page-current {
  background: var(--tc-primary);
  color: #fff;
  font-weight: bold;
}

.ranking-controls {
  margin: 12px 0 16px 0;
}

.ranking-controls input[type="text"] {
  width: 220px;
  max-width: 90%;
}

.rank-change {
  font-weight: bold;
  white-space: nowrap;
}

.rank-up {
  color: var(--tc-success);
}

.rank-down {
  color: var(--tc-danger);
}

.rank-same {
  color: var(--tc-text-muted);
}

.rank-player-note {
  color: var(--tc-text-muted);
  font-size: 0.85em;
  font-weight: normal;
}

.rank-top8-icon {
  display: inline-flex;
  width: 23px;
  height: 23px;
  margin-left: 6px;
  vertical-align: -5px;
  align-items: center;
  justify-content: center;
  cursor: help;
}

.rank-top8-icon img {
  display: block;
  max-width: 23px;
  max-height: 23px;
}

@media (max-width: 680px) {
  .tc-table {
    min-width: 0;
    width: 100%;
    font-size: 1em;
  }

  .tc-table th,
  .tc-table td {
    padding: 8px 7px;
  }

  .tc-table-compact {
    width: 100%;
  }

  .tc-form-row {
    display: block;
  }

  .tc-form-row input,
  .tc-form-row select,
  .tc-form-row textarea {
    width: 100%;
    margin-bottom: 8px;
  }

  .tc-field-xl,
  .tc-field-lg,
  .tc-field-md,
  .tc-field-sm {
    width: 100%;
  }

  .tourney_list2 tr {
    border: 2px solid #000;
    border-radius: 0;
    padding: 3px;
  }

  .tourney_list2 td.head-mobile {
    border-radius: 0;
  }

  .accion {
    background: #ccc;
  }

  .tc-page-head {
    margin-top: 10px;
    padding: 12px;
  }

  .tc-format-head {
    min-height: 92px;
    padding: 14px;
  }

  .tc-archetype-head {
    min-height: 92px;
  }

  .tc-archetype-head h1,
  .tc-archetype-head p {
    max-width: 100%;
  }

  .tc-archetype-art {
    width: 100%;
    opacity: 0.46;
    background-position: center center;
  }

  .tc-archetype-head::before {
    background: linear-gradient(90deg, rgba(255,255,255,0.94) 0%, rgba(255,255,255,0.82) 52%, rgba(255,255,255,0.42) 100%);
  }

  .tc-page-head h1 {
    font-size: 28px;
  }

  .tc-archetype-controls {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .tc-archetype-controls .tc-toolbar {
    display: block;
  }

  .tc-archetype-filters {
    display: grid;
    gap: 8px;
  }

  .tc-archetype-actions {
    justify-items: stretch;
  }

  .tc-archetype-controls .tc-pagination {
    justify-content: flex-start;
    white-space: normal;
  }

  .tc-archetype-table {
    table-layout: auto;
    width: 100%;
    display: block;
  }

  .tc-archetype-table colgroup {
    display: none;
  }

  .tc-archetype-table tbody,
  .tc-archetype-table tr {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  .tc-archetype-table td {
    width: auto;
    box-sizing: border-box;
  }

  .tc-archetype-table td::before {
    flex: 0 0 32%;
  }

  .tc-archetype-table td a {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
  }

  .tc-archetype-table td.head-mobile {
    width: auto;
  }

  .tc-compare-slot {
    justify-self: stretch;
    text-align: left;
  }

  .tc-compare-action {
    width: 100%;
  }

  .tc-toolbar {
    display: block;
  }

  .tc-filter-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 8px;
  }

  .tc-toolbar select {
    width: 100%;
  }

  .tc-chip-grid {
    grid-template-columns: 1fr;
  }

  .tc-deck-hero {
    margin-top: 10px;
    padding: 10px 0 12px;
  }

  .tc-deck-title h1 {
    font-size: 22px;
  }

  .tc-deck-meta {
    gap: 5px;
  }

  .tc-deck-meta span {
    font-size: 0.9em;
  }

  .tc-deck-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tc-deck-actions a,
  .tc-deck-actions button {
    justify-content: center;
    text-align: center;
  }

  .tc-deck-table {
    border-collapse: separate;
    border-spacing: 0;
    border: 2px solid #000;
    overflow: hidden;
    table-layout: auto;
    width: 100%;
    display: block;
  }

  .tc-deck-table colgroup {
    display: none;
  }

  .tc-deck-table tbody,
  .tc-deck-table tr {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  .tc-deck-table tr {
    border: 0;
  }

  .tc-deck-table th,
  .tc-deck-table td {
    box-sizing: border-box;
    width: 100%;
  }

  .tc-deck-table th[colspan],
  .tc-deck-table td[colspan] {
    width: 100%;
    display: block;
  }

  .tc-deck-table [scope="hide"],
  .tc-deck-table th[scope="position"] {
    display: none !important;
  }

  .tc-deck-table td[scope="side_movil"] {
    display: block !important;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    color: var(--tc-primary);
  }

  .tc-deck-table td.tc-mobile-side-count {
    background: var(--tc-primary);
    color: #fff;
  }

  .tc-deck-table .tc-deck-cell:not([scope="hide"]) {
    display: block;
    width: 100%;
  }

  .tc-deck-table .tc-deck-card-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .tc-deck-table .tc-deck-card-row .tc-mainboard-cell {
    width: auto;
  }

  .tc-simulator-content {
    width: calc(100% - 24px);
    margin: 12px auto;
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .tc-deck-table .tc-deck-card-row {
    grid-template-columns: 1fr;
  }
}
