/* AltCodeWP — Fanbase Table Styles */

/* ── Wrapper ─────────────────────────────────────────── */
.altcodewp-fanbase-table,
.altcodewp-trophy-table,
.altcodewp-players-table,
.altcodewp-revenue-table,
.altcodewp-confederation-league-multiplier {
    width: 100%;
}

/* ── Heading ─────────────────────────────────────────── */
.fb-heading {
    font-weight: 700;
    margin-bottom: 1rem;
}

/* ── Header bottom (description + download button row) ── */
.fb-header-bottom {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.fb-header-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ── Description ─────────────────────────────────────── */
.fb-description {
    color: #6b7280;
    margin: 0;
    line-height: 1.6;
    flex: 1;
    min-width: 180px;
}

/* ── Buttons ─────────────────────────────────────────── */
.fb-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5625rem 1.125rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.fb-btn-primary {
    background: #122B4D;
    color: #fff;
    height: 40px;
}

.fb-btn-primary:hover {
    background: #175592;
    color: #fff;
}

/* ── Controls bar ────────────────────────────────────── */
.fb-controls {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

.fb-controls-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    order: 2;
    margin-left: auto;
}

/* ── Search ──────────────────────────────────────────── */
.fb-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.fb-search-icon {
    position: absolute;
    left: 0.625rem;
    color: #9ca3af;
    pointer-events: none;
    flex-shrink: 0;
}

.fb-search {
    padding: 0.4375rem 0.75rem 0.4375rem 2rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.8125rem;
    min-width: 200px;
    outline: none;
    line-height: 1.4;
    color: #374151;
    background: #fff;
    transition: border-color 0.15s ease;
}

.fb-search:focus {
    border-color: #1d62a6;
}

.fb-search-wrap .fb-search {
    padding: 10px 35px;
}
/* ── Count ───────────────────────────────────────────── */
.fb-count {
    font-size: 0.8125rem;
    color: #6b7280;
    order: 2;
}

/* ── Empty state ─────────────────────────────────────── */
.fb-empty {
    padding: 2rem;
    text-align: center;
    color: #6b7280;
}

/* ── Table wrapper ───────────────────────────────────── */
.fb-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

/* ── Table ───────────────────────────────────────────── */
table.fb-datatable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

/* ── Table head ──────────────────────────────────────── */
table.fb-datatable thead th {
    background-color: #1d62a6;
    color: rgba(255, 255, 255, 0.65);
    padding: 15px 10px;
    font-weight: 600;
    font-size: 0.75rem;
    text-align: left;
    white-space: nowrap;
}
table.fb-datatable thead th,
table.fb-datatable tbody td {
    padding: 15px 10px !important;
}

/* Sort icons — keep them visible on dark bg */
table.fb-datatable thead th.dt-orderable-asc span.dt-column-order::before,
table.fb-datatable thead th.dt-orderable-desc span.dt-column-order::after,
table.fb-datatable thead th.dt-ordering-asc span.dt-column-order::before,
table.fb-datatable thead th.dt-ordering-desc span.dt-column-order::after {
    opacity: 0.6;
}

/* Keep a small gap between the title and the sort icon. */
table.fb-datatable thead th .dt-column-order {
    margin-left: 4px;
}

/* DataTables reverses the header flex for numeric columns (Attendance %,
   Social %, Fan Base %), which puts the sort icon BEFORE the title. Restore
   the normal order so the icon always sits after the column header title. */
table.fb-datatable thead th.dt-type-numeric div.dt-column-header,
table.fb-datatable thead th.dt-type-numeric div.dt-column-footer {
    flex-direction: row !important;
}

/* ── Table body ──────────────────────────────────────── */
table.fb-datatable tbody td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid #f0f0f0;
    color: #374151;
    white-space: nowrap;
}

table.fb-datatable tbody tr:last-child td {
    border-bottom: none;
}

table.fb-datatable tbody tr:hover td {
    background-color: #f9fafb;
}

/* ── Remove vertical borders (column dividers) ───────── */
/* Strip any left/right cell borders coming from DataTables' base CSS or the
   theme, so only the horizontal row separators remain. */
table.fb-datatable thead th,
table.fb-datatable tbody td {
    border-left: 0 !important;
    border-right: 0 !important;
}

/* ── Club cell ───────────────────────────────────────── */
.fb-club-cell {
    font-weight: 500;
    color: #111827;
}

/* ── Rank cell ───────────────────────────────────────── */
.fb-rank-cell {
    font-weight: 600;
    color: #93a4cf;
    font-variant-numeric: tabular-nums;
}

/* ── Numeric columns (Attendance / Social / Fan Base) ── */
table.fb-datatable th.fb-th-num,
table.fb-datatable td.fb-num {
    text-align: right;
}

table.fb-datatable td.fb-num {
    font-variant-numeric: tabular-nums;
}

/* ── Fan Base % progress bar ─────────────────────────── */
.fb-fanbase-cell {
    min-width: 130px;
}

.fb-bar {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.625rem;
    width: 100%;
}

.fb-bar-track {
    flex: 0 0 64px;
    width: 64px;
    height: 6px;
    background: #edf0f5;
    border-radius: 999px;
    overflow: hidden;
}

.fb-bar-fill {
    display: block;
    height: 100%;
    min-width: 4px;
    border-radius: 999px;
    background: #3b5bdb;
    transition: width 0.3s ease;
}

/* Higher scores read brighter, lower scores read as deep navy
   (matches the reference design). Tune the 65 threshold in the
   widget render if a different split is desired. */
.fb-bar-fill.is-high {
    background: #3b5bdb;
}

.fb-bar-fill.is-low {
    background: #16233f;
}

.fb-bar-value {
    min-width: 1.75rem;
    text-align: right;
    font-weight: 700;
    color: #111827;
    font-variant-numeric: tabular-nums;
}

.altcodewp-fanbase-table table.fb-datatable thead th{
    border-top: 0;
    border-bottom: 0;
}
/* ── DataTables overrides ────────────────────────────── */
.altcodewp-fanbase-table .dataTables_wrapper,
.altcodewp-trophy-table .dataTables_wrapper,
.altcodewp-players-table .dataTables_wrapper,
.altcodewp-revenue-table .dataTables_wrapper,
.altcodewp-confederation-league-multiplier .dataTables_wrapper {
    padding: 0;
}

.altcodewp-fanbase-table .dataTables_paginate,
.altcodewp-trophy-table .dataTables_paginate,
.altcodewp-players-table .dataTables_paginate,
.altcodewp-revenue-table .dataTables_paginate,
.altcodewp-confederation-league-multiplier .dataTables_paginate {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.altcodewp-fanbase-table .paginate_button,
.altcodewp-trophy-table .paginate_button,
.altcodewp-players-table .paginate_button,
.altcodewp-revenue-table .paginate_button,
.altcodewp-confederation-league-multiplier .paginate_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border-radius: 4px;
    font-size: 0.8125rem;
    cursor: pointer;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #374151;
    transition: background 0.15s ease, color 0.15s ease;
    user-select: none;
}

.altcodewp-fanbase-table .paginate_button:hover:not(.disabled):not(.current),
.altcodewp-trophy-table .paginate_button:hover:not(.disabled):not(.current),
.altcodewp-players-table .paginate_button:hover:not(.disabled):not(.current),
.altcodewp-revenue-table .paginate_button:hover:not(.disabled):not(.current),
.altcodewp-confederation-league-multiplier .paginate_button:hover:not(.disabled):not(.current) {
    background: #f3f4f6;
    color: #111827;
}

.altcodewp-fanbase-table .paginate_button.current,
.altcodewp-fanbase-table .paginate_button.current:hover,
.altcodewp-trophy-table .paginate_button.current,
.altcodewp-trophy-table .paginate_button.current:hover,
.altcodewp-players-table .paginate_button.current,
.altcodewp-players-table .paginate_button.current:hover,
.altcodewp-revenue-table .paginate_button.current,
.altcodewp-revenue-table .paginate_button.current:hover,
.altcodewp-confederation-league-multiplier .paginate_button.current,
.altcodewp-confederation-league-multiplier .paginate_button.current:hover {
    background: #1d62a6;
    color: #fff;
    border-color: #1d62a6;
}

.altcodewp-fanbase-table .paginate_button.disabled,
.altcodewp-fanbase-table .paginate_button.disabled:hover,
.altcodewp-trophy-table .paginate_button.disabled,
.altcodewp-trophy-table .paginate_button.disabled:hover,
.altcodewp-players-table .paginate_button.disabled,
.altcodewp-players-table .paginate_button.disabled:hover,
.altcodewp-revenue-table .paginate_button.disabled,
.altcodewp-revenue-table .paginate_button.disabled:hover,
.altcodewp-confederation-league-multiplier .paginate_button.disabled,
.altcodewp-confederation-league-multiplier .paginate_button.disabled:hover {
    opacity: 0.4;
    cursor: default;
}

/* ── DataTables scroll body ──────────────────────────── */
.altcodewp-fanbase-table .dataTables_scrollBody,
.altcodewp-trophy-table .dataTables_scrollBody,
.altcodewp-players-table .dataTables_scrollBody,
.altcodewp-revenue-table .dataTables_scrollBody,
.altcodewp-confederation-league-multiplier .dataTables_scrollBody {
    outline: none;
}

.altcodewp-fanbase-table .dataTables_scrollBody table.dataTable,
.altcodewp-fanbase-table .dataTables_scrollHead table.dataTable,
.altcodewp-trophy-table .dataTables_scrollBody table.dataTable,
.altcodewp-trophy-table .dataTables_scrollHead table.dataTable,
.altcodewp-players-table .dataTables_scrollBody table.dataTable,
.altcodewp-players-table .dataTables_scrollHead table.dataTable,
.altcodewp-revenue-table .dataTables_scrollBody table.dataTable,
.altcodewp-revenue-table .dataTables_scrollHead table.dataTable,
.altcodewp-confederation-league-multiplier .dataTables_scrollBody table.dataTable,
.altcodewp-confederation-league-multiplier .dataTables_scrollHead table.dataTable {
    margin: 0 !important;
}

.dt-paging {
    background: #1d62a6;
}
div.dt-container .dt-paging .dt-paging-button {
    color: rgba(255, 255, 255, 0.5) !important;
}
div.dt-container .dt-paging .dt-paging-button.current,
div.dt-container .dt-paging .dt-paging-button.current, 
div.dt-container .dt-paging .dt-paging-button.current:hover,
div.dt-container .dt-paging .dt-paging-button:hover,
div.dt-container .dt-paging .dt-paging-button:focus-visible { 
    color: #FFFFFF !important;
    background: none !important;
    border: 0;
}

/* ── Load More button (replaces pagination) ──────────── */
.dt-load-more-wrap {
	display: flex;
	justify-content: center;
	padding: 1rem 0 0.5rem;
}

.dt-load-more-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	padding: 0.5625rem 1.75rem;
	background: #0d1422;
	border: 1.5px solid #0d1422;
	border-radius: 6px;
	font-size: 0.8125rem !important;
	font-weight: 600;
	color: #ffffff;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.dt-load-more-btn:hover {
	background: #1a3a5c;
	border-color: #1a3a5c;
	color: #ffffff;
}

.dt-load-more-btn:focus,
.dt-load-more-btn:active,
.dt-load-more-btn:focus-visible {
	outline: none;
	box-shadow: none;
	background: #1d62a6;
	color: #ffffff;
}
