:root {
    --dp-accent: #9747FF;
}

.navbar-brand span {
    font-weight: 700;
    letter-spacing: 0.2px;
}

.page-header h1 {
    font-weight: 800;
}

.card {
    border-radius: 1rem;
}

.metric {
    font-size: 1.25rem;
}

.btn-primary, .page-item.active .page-link, .btn-apply {
    background-color: #9747FF !important;
    border-color: #9747FF !important;
}

.btn-primary:hover, .page-item.active .page-link:hover, .btn-apply:hover {
    background-color: #8539E5 !important;
    border-color: #8539E5 !important;
}

.page-link {
    color: #9747FF !important;
}

.page-link:hover {
    color: #8539E5 !important;
}


/* v5.4.7: Enforce brand purple and fix sizes */
:root .btn.btn-primary {
    background-color: #9747FF !important;
    border-color: #9747FF !important;
    color: #fff !important;
}

:root .btn.btn-primary:hover,
:root .btn.btn-primary:focus {
    background-color: #8539E5 !important;
    border-color: #8539E5 !important;
    color: #fff !important;
}

/* Pagination colors */
.pagination .page-link {
    color: #9747FF !important;
    border-color: rgba(151, 71, 255, 0.35) !important;
    background: transparent !important;
}

.pagination .page-link:hover {
    color: #8539E5 !important;
    border-color: rgba(133, 57, 229, 0.5) !important;
    background: rgba(151, 71, 255, 0.06) !important;
}

.pagination .page-item.active .page-link {
    color: #fff !important;
    background-color: #9747FF !important;
    border-color: #9747FF !important;
}

/* ✅ Fix pagination overflow on mobile */
#pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem;
    overflow-x: auto;
    max-width: 100%;
    box-sizing: border-box;
}

#pagination .pagination {
    flex-wrap: wrap;
    justify-content: center;
    margin: 0;
}

/* Optional: make page buttons smaller on tight screens */
@media (max-width: 480px) {
    #pagination .page-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.85rem;
    }

    #pagination {
        gap: 0.15rem;
    }
}


/* Make the main search button match the large input height without using .btn-lg */
.input-group.input-group-lg > .btn {
    padding: 0.5rem 1rem !important; /* match lg input */
    font-size: 1.25rem !important;
    line-height: 1.5 !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

/* Ensure the text input has matching right-side radius */
.input-group.input-group-lg > .position-relative > .form-control {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}


/* === v5.4.8 FORCE PURPLE THEME OVERRIDES === */
:root {
    --dp-accent: #9747FF;
    --dp-accent-hover: #8539E5;
}

/* Buttons */
.btn-primary,
.btn-primary:focus,
.btn-primary:active,
.btn-primary:disabled {
    background-color: #9747FF !important;
    border-color: #9747FF !important;
    color: #fff !important;
}

.btn-primary:hover {
    background-color: #8539E5 !important;
    border-color: #8539E5 !important;
    color: #fff !important;
}

/* Links */
a,
.link-primary {
    color: #9747FF !important;
}

a:hover,
.link-primary:hover {
    color: #8539E5 !important;
}

/* Pagination */
.pagination .page-link {
    color: #9747FF !important;
    border-color: rgba(151, 71, 255, 0.35) !important;
    background: transparent !important;
}

.pagination .page-link:hover {
    color: #8539E5 !important;
    border-color: rgba(133, 57, 229, 0.50) !important;
    background: rgba(151, 71, 255, 0.06) !important;
}

.pagination .page-item.active .page-link {
    color: #fff !important;
    background-color: #9747FF !important;
    border-color: #9747FF !important;
}

/* Forms focus */
.form-select:focus,
.form-control:focus {
    border-color: #9747FF !important;
    box-shadow: 0 0 0 .25rem rgba(151, 71, 255, 0.25) !important;
}

/* Input-group large: align button height with large input without relying on .btn-lg */
.input-group.input-group-lg > .btn,
.input-group.input-group-lg > .input-group-append > .btn {
    height: calc(1.5em + 1rem + 2px) !important;
    padding: .5rem 1rem !important;
    font-size: 1.25rem !important;
    line-height: 1.5 !important;
}

.input-group.input-group-lg > .form-control,
.input-group.input-group-lg > .position-relative > .form-control {
    height: calc(1.5em + 1rem + 2px) !important;
}

/* Seamless join between input and button */
.input-group.input-group-lg > .btn {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

.input-group.input-group-lg > .position-relative > .form-control {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

/* === END v5.4.8 === */


/* v5.4.10 - Global link color adjustments */
a,
a:visited {
    color: #ffffff !important;
    text-decoration: none;
}

a:hover,
a:focus {
    color: #9747FF !important;
    text-decoration: underline;
}


/* v5.4.11 - Fix main search bar alignment */
.input-group.input-group-lg > .form-control,
.input-group.input-group-lg > .position-relative > .form-control {
    height: calc(1.5em + 1rem + 2px) !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.input-group.input-group-lg > .btn {
    height: calc(1.5em + 1rem + 2px) !important;
    padding: 0 1.25rem !important;
    line-height: 1.5 !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-top-right-radius: 0.375rem !important;
    border-bottom-right-radius: 0.375rem !important;
    background-color: #9747FF !important;
    border-color: #9747FF !important;
}


/* v5.4.12 - Main search bar final alignment */
.input-group.dp-main-search > .position-relative > .form-control {
    height: auto !important; /* let browser compute */
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.input-group.dp-main-search > .btn {
    height: auto !important; /* JS will sync exact height */
    padding: 0 1.25rem !important;
    line-height: 1.5 !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-top-right-radius: .375rem !important;
    border-bottom-right-radius: .375rem !important;
    background-color: #9747FF !important;
    border-color: #9747FF !important;
}


/* v5.4.13 - Main search bar: use proper input-group adjacency */
.dp-main-search > .form-control {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.dp-main-search > .btn {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    background-color: #9747FF !important;
    border-color: #9747FF !important;
    color: #fff !important;
}

.dp-main-search > .btn:hover {
    background-color: #8539E5 !important;
    border-color: #8539E5 !important;
}


/* v5.4.14 - Perfect main search alignment fix */
.dp-main-search > .form-control {
    height: 46px !important; /* Force both to equal fixed height */
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.dp-main-search > .btn {
    height: 46px !important; /* Match exactly */
    padding: 0 1.25rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    background-color: #9747FF !important;
    border-color: #9747FF !important;
    color: #fff !important;
}

.dp-main-search > .btn:hover {
    background-color: #8539E5 !important;
    border-color: #8539E5 !important;
}


/* v5.4.15 - Autocomplete dropdown styling */
.dropdown-menu {
    background-color: #1E1E1E !important;
    border: 1px solid #2A2A2A !important;
}

.dropdown-menu .dropdown-item {
    color: #ffffff !important;
}

.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item.active {
    background-color: #9747FF !important;
    color: #ffffff !important;
}


/* Base styling for tabs */
.nav-tabs .nav-link {
    color: #ffffff !important;
    border: none !important;
    opacity: 0.85;
    position: relative;
    transition: color 0.2s ease,
    opacity 0.2s ease,
    background-color 0.2s ease;
}

/* Hover text brighter */
.nav-tabs .nav-link:hover {
    color: #ffffff !important;
    opacity: 1;
}

/* Underline animation */
.nav-tabs .nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 1px; /* ✅ above border instead of below */
    width: 0%;
    height: 3px;
    background-color: #9747FF;
    transition: width 0.25s ease-in-out;
    border-radius: 2px;
}

/* Hover underline */
.nav-tabs .nav-link:hover::after {
    width: 100%;
}

/* ✅ Active tab: Purple background + purple underline + solid opacity */
.nav-tabs .nav-link.active {
    color: #ffffff !important;
    background-color: #9747FF !important;
    opacity: 1;
    bottom: 1px;
    border: none !important;
}

.nav-tabs .nav-link.active::after {
    width: 100%;
    background-color: #9747FF !important; /* ✅ fix: match theme */
}


/* Make leaderboard columns consistent */
#leaderboard-body table,
.table.fixed {
    table-layout: fixed;
    width: 100%;
}

.table.fixed th:nth-child(1),
.table.fixed td:nth-child(1) {
    width: 23px; /* Rank column */
}

.table.fixed th:nth-child(2),
.table.fixed td:nth-child(2) {
    width: 63%; /* Player column */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table.fixed th:nth-child(3),
.table.fixed td:nth-child(3) {
    width: 30%; /* Metric column */
    text-align: right;
}

.table.fixed td img {
    vertical-align: middle;
}

.table.fixed td a {
    max-width: 80%;
    display: inline-block;
    vertical-align: middle;
}


/* ✅ Responsive fix for leaderboard rank column */
@media (max-width: 768px) {
    .table.fixed th:nth-child(1),
    .table.fixed td:nth-child(1) {
        width: 12%; /* proportional instead of fixed */
        min-width: 40px; /* ensure room for up to 5-digit ranks */
        white-space: nowrap; /* prevent line breaks */
        text-align: center;
    }

    .table.fixed th:nth-child(2),
    .table.fixed td:nth-child(2) {
        width: 58%; /* slightly narrower to balance layout */
    }

    .table.fixed th:nth-child(3),
    .table.fixed td:nth-child(3) {
        width: 30%;
    }
}

@media (max-width: 480px) {
    .table.fixed th:nth-child(1),
    .table.fixed td:nth-child(1) {
        width: 15%;
        min-width: 45px;
        font-size: 0.9rem;
    }

    .table.fixed th:nth-child(2),
    .table.fixed td:nth-child(2) {
        width: 55%;
        font-size: 0.9rem;
    }

    .table.fixed th:nth-child(3),
    .table.fixed td:nth-child(3) {
        width: 30%;
        font-size: 0.9rem;
    }
}


.text-purple {
    color: #c084fc !important;
}

/* Tailwind purple-400 */
/* ✅ Override leaderboard rank link color */
.leader-rank-badge {
    color: inherit !important; /* allow class to control color */
    text-decoration: none !important;
}

/* Hide spinner arrows on number inputs */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield; /* Firefox */
}
