/* GLOBAL ------------------------------------------------------- */

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: #121212;
    color: white;
}

/* HEADER BAR --------------------------------------------------- */

.header-bar {
    background-color: #003f91;   /* Blue Header (default) */
    padding: 20px;
    text-align: center;
    color: white;
    font-size: 26px;
    font-weight: bold;
}

.header-admin {
    background-color: #8B0000 !important;  /* Deep red in Admin mode */
}

/* SEASON DROPDOWN ---------------------------------------------- */

.season-select {
    margin-top: 8px;
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 4px;
}

/* SECTION TITLE ------------------------------------------------ */

.section-title {
    margin-top: 15px;
    font-size: 22px;
    text-align: center;
    font-weight: bold;
}

/* BUTTON STYLING ---------------------------------------------- */

button {
    padding: 7px 15px;
    margin: 8px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: bold;
}

#adminLoginBtn {
    background-color: #0056b3;
    color: white;
}

#saveChangesBtn {
    background-color: #007bff;
    color: white;
}

.admin-mode-btn {
    background-color: #b30000 !important;
    color: white !important;
}

/* ADD PLAYER BUTTON -------------------------------------------- */

#addPlayerBtn {
    background-color: #444;
    color: white;
    display: none; /* only shown in admin mode */
}

.admin-mode #addPlayerBtn {
    display: inline-block;
}

/* TABLE CONTAINER --------------------------------------------- */

.table-wrapper {
    padding: 20px;
}

/* TABLE FORMATTING --------------------------------------------- */

table {
    width: 100%;
    border-collapse: collapse;
    background-color: #1e1e1e;
}

thead {
    background-color: #003f91;  /* Blue header row */
}

thead th {
    padding: 10px;
    font-size: 14px;
    color: white;
    cursor: pointer;  /* Click to sort */
    border-bottom: 2px solid #222;
    text-align: center;
}

/* Admin Mode Header Color */
.admin-mode thead {
    background-color: #8B0000 !important;
}

tbody tr {
    border-bottom: 1px solid #333;
}

tbody tr:hover {
    background-color: #2a2a2a;
}

tbody td {
    padding: 10px;
    text-align: center !important;  /* CENTER ALL DATA */
}

/* ============================================================
   COLUMN GROUPING (visual blocks like your red boxes)
   Columns:
   1 ID
   2 Player
   3 Registered HC
   4 Points
   5 Season Won
   6 Season Lost
   7 Lifetime Won
   8 Lifetime Lost
   9 Lifetime Win %
   10 Projected HC
   11 Actions
   ============================================================ */

:root{
    --group-divider: 3px;
    --group-divider-color: rgba(255,255,255,0.20);
}

/* Add a LEFT divider at the start of each group */
.statsTable thead th:nth-child(4),
.statsTable tbody td:nth-child(4),
.statsTable thead th:nth-child(7),
.statsTable tbody td:nth-child(7),
.statsTable thead th:nth-child(10),
.statsTable tbody td:nth-child(10),
.statsTable thead th:nth-child(11),
.statsTable tbody td:nth-child(11) {
    border-left: var(--group-divider) solid var(--group-divider-color);
}

/* Add a RIGHT divider at the end of each group */
.statsTable thead th:nth-child(3),
.statsTable tbody td:nth-child(3),
.statsTable thead th:nth-child(6),
.statsTable tbody td:nth-child(6),
.statsTable thead th:nth-child(9),
.statsTable tbody td:nth-child(9) {
    border-right: var(--group-divider) solid var(--group-divider-color);
}

/* Optional: tighten the divider look so it feels like “panels” */
.statsTable thead th,
.statsTable tbody td {
    border-top: 1px solid rgba(255,255,255,0.03);
}

/* Editable inputs --------------------------------------------- */

.editable-cell input {
    width: 80px;
    text-align: center !important;
    padding: 4px;
    border-radius: 4px;
    border: 1px solid #666;
    background-color: #2d2d2d;
    color: white;
}

/* Player name cells */
.player-name-cell input {
    width: 150px;
    text-align: center !important;
}

/* ACTION BUTTONS ---------------------------------------------- */

.delete-btn {
    background-color: #b30000;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.delete-btn:hover {
    background-color: #ff0000;
}

/* ADD PLAYER POPUP -------------------------------------------- */

#addPlayerPopup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #1f1f1f;
    padding: 25px;
    border-radius: 8px;
    border: 2px solid #444;
    display: none;
    z-index: 9999;
}

#addPlayerPopup select,
#addPlayerPopup input {
    width: 90%;
    padding: 6px;
    margin: 8px 0;
    border-radius: 4px;
    border: 1px solid #555;
    background-color: #2c2c2c;
    color: white;
}

#confirmAddBtn {
    background-color: #007bff;
    color: white;
}

#closeAddBtn {
    background-color: #555;
    color: white;
}

.header-logo {
    width: 90px;         /* Same as the 9-ball size */
    height: 90px;        /* Must match width for perfect circle */
    border-radius: 50%;  /* Make it round */
    object-fit: cover;   /* Prevent distortion */
    margin-right: 15px;  /* Space between logo and text */
}

/* Freeze player column titles while scrolling (desktop and mobile). */
#playerTable thead th {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #003f91;
}

/* Preserve the existing red header in admin mode. */
.admin-mode #playerTable thead th {
    background-color: #8B0000;
}
