:root {
    --table-title-height: 30px;
    --thead-bg-alt-color: var(--clay-light-hex);
}


.player-card {
    display: flex;
    flex-direction: column;
    align-items: center;     /* horizontal centering */
    text-align: center;      /* text centering */
    gap: 12px;
    /* position: sticky;
    top: var(--navbar-height); */

}

.player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.player-card h1 {
    margin-top: 12px;
}

.player-photo {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    
}

.player-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;     /* important */
    border-radius: 50%;
    display: block;        /* remove inline gap */
    
}

.player-name {
    margin: 0;
}

.player-gender {
    font-size: 1.2em;
    margin-left: 6px;
}

.not-linked {
    color: var(--clay-light-hex);
    font-style: italic;
}

/* Table base */
.tbl-player {
    --bs-table-hover-bg: rgba(0, 0, 0, 0.075);
    width: 100%;
    border-collapse: separate;   /* ← KEY CHANGE */
    border-spacing: 0;
    margin-top: 6px;
    font-size: 0.75rem;



}


/* 1️⃣ Header row styling */
.tbl-player thead th {
    position: sticky;
    top: 0;
    z-index: 5; /* above body cells but below scrollbar overlay */
    background-color: var(--bs-body-bg);/*#D85C32; /* header color */
    background-image: radial-gradient(
    rgba(0, 0, 0, 0.04) 2px,
    transparent 2px
    );
    background-size: 30px 30px;
    color: #fff;
    text-align: center;
    font-weight: 500;
    border: 1px solid #ffffff;
    padding-left: 5px;
    padding-right: 5px;
    padding: 0;

}

.tbl-player thead th:last-child {
    border-top-right-radius: 12px;
    border: 1px solid #ffffff;
}

.tbl-player tbody tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}

.tbl-player tbody tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}


/* 2️⃣ First column cells styling */
.tbl-player td.tbl-player-1col {
    background-color: var(--bs-body-bg); /*#D85C32; /* first column color */
    color: white;
    text-align: center;
    padding-left: 5px;
    padding-right: 5px;
    font-weight: 500;
    border: 1px solid #ffffff;
}

/* 3️⃣ Special top-left cell (header + first column) */
.tbl-player thead th:first-child {
    border-top-left-radius: 12px;
    border: 1px solid #ffffff;
    background-color: var(--thead-bg-alt-color); /*unique color for cell 1-1 */
    color: rgb(0, 0, 0)!important;
    padding-left: 5px;
    padding-right: 5px;
    text-align: center;           /* align like first column */
    font-weight: 600;
}

.tbl-player.tbl--no-corner {
    border-top: none;
    border-left: none;
}

/* Variant: hide top-left cell completely */
.tbl-player.tbl--no-corner thead th:first-child {
    padding: 0;
    border-color: transparent;
}


.tbl-player th.tbl-player-header {
    border: none !important;
    background-color: var(--bs-body-bg)!important;
    text-align: center !important; 
    font-size: 1.2em; 
    color: #000000; 
    border-top-left-radius: 0;
}

.tbl-player th.alt-color-header {
    background-color: var(--thead-bg-alt-color); 
    color: rgb(0, 0, 0)!important;
    font-weight: 600;
}

/* Other body cells */
.tbl-player tbody td {
    border: 1px solid var(--bs-body-bg);
    color: #333;
    text-align: center;
    background-color: #ffffff;
    background-image: radial-gradient(
    rgba(255,255,255,0.04) 1px,
    transparent 1px
    );
    background-size: 4px 4px;
    padding-left: 5px;
    padding-right: 5px;
}

.tbl-player tbody td a {
    color: white;
    font-weight: 500;
}

.tbl-player thead th:first-child > .btn {
    display: flex;
    align-items: center;
    justify-content: center;

    width: calc(100% - 0.25rem);
    height: calc(100% - 0.25rem);

    margin: 0.15rem;

    border-radius: 4px;
}

.table-scroll {
    max-height: 80vh;
    overflow-y: auto;
    position:relative;

    /* 🔑 This clips sticky headers correctly */
    border-radius: 12px;
}

.table-scroll::after {
  content: "";
  position: sticky;
  top: 0;
  /* right: 0; */

  width: 16px;          /* scrollbar width */
  height: 100%;

  background-color: var(--bs-body-bg);
  z-index: 6;

  pointer-events: none;
}


.btn-player {
    all: unset;                 /* 💥 removes bootstrap */
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;

    width: calc(100% - 1.5rem);
    height: 100%;
    margin-left: 0.40rem;
    margin-top: 0.1rem;

    font-size: 0.9em;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid #c19464;
    background-color: #f0d7be;
    color: #1a1a1a;
    cursor: pointer;
    padding-left: 5px;
    padding-right: 5px;
}

.btn-player:focus-visible {
    box-shadow: inset 0 0 0 2px #c19464;
}

.table-title {
    position: sticky;
    top: 0px; /* below navbar and table header */

    font-size: 1.2em;
    font-weight: 500;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: var(--bs-body-bg);
    height: 1lh /*calc(var(--table-title-height) + 1lh);*/;
    color: #000000;
    margin-bottom: 3px;
}

.htmx-indicator {
    display: none;
    text-align: center;
    padding: 12px;
    color: #666;
    font-style: italic;
}

/* HTMX toggles this automatically */
.htmx-request .htmx-indicator {
    display: block;
}

.spinner {
    width: 24px;
    height: 24px;
    margin: 12px auto;
    border: 3px solid #ddd;
    border-top-color: #333;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.player-tgram-linked {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--steel-light-hex);
    font-weight: 500;
    font-size: 18px;
}

.player-unlinked {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--clay-light-hex);
    font-weight: 500;
    font-size: 18px;
    font-style: italic;
    /* font-family: Arial, Helvetica, sans-serif; */
}


.tbl-wrap {
  border-radius: 12px;
  overflow: hidden;
}

/* Header table */
.tbl-head {
  margin-bottom: 0;
}

.tbl-head th {
  background: var(--bs-body-bg);
  text-align: center;
}

/* Scroll area */
.tbl-body-scroll {
  max-height: 60vh;
  overflow-y: auto;
}

/* Body table */
.tbl-body {
  margin-top: 0;
}

/* Ensure column alignment */
.tbl-head,
.tbl-body {
  table-layout: fixed;
  width: 100%;
}
