/* Players Page Styles */

.players-page {
    background: var(--black);
    height: fit-content;
}
    
/* Page-Specific Nav Styling */
.players-page .top-nav {
    backdrop-filter: blur(10px) saturate(1.2);
    -webkit-backdrop-filter: blur(10px) saturate(1.2);
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.25) 0%,
        rgba(30, 30, 30, 0.3) 25%,
        rgba(0, 0, 0, 0.35) 50%,
        rgba(30, 30, 30, 0.3) 75%,
        rgba(0, 0, 0, 0.25) 100%
    );
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.players-page .top-nav::before {
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.08) 0%,
        rgba(255, 255, 255, 0.03) 70%,
        transparent 100%
    );
    content: '';
    height: 60%;
    left: 0;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 0;
    z-index: -1;
}

.players-page .search-input-container.active {
    background: none;
}

.players-page .search-results {
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.25) 0%,
        rgba(30, 30, 30, 0.3) 25%,
        rgba(0, 0, 0, 0.35) 50%,
        rgba(30, 30, 30, 0.3) 75%,
        rgba(0, 0, 0, 0.25) 100%
    );
}

.players-page .search-backdrop {
    backdrop-filter: blur(10px) saturate(1.2);
    -webkit-backdrop-filter: blur(10px) saturate(1.2);
}

.players-page .search-result-item {
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.04) 0%,
        rgba(255, 255, 255, 0.02) 100%
    );
}

.players-page .bottom-nav {
    bottom: 0;
    box-sizing: border-box;
    justify-content: center;
    left: 0;
    margin-top: 0;
    position: absolute;
    right: 0;
    width: 100%;
}

.players-page .bottom-nav::before {
    background: linear-gradient(
        0deg,
        rgba(255, 255, 255, 0.08) 0%,
        rgba(255, 255, 255, 0.03) 70%,
        transparent 100%
    );
    bottom: 0;
    content: '';
    height: 60%;
    left: 0;
    pointer-events: none;
    position: absolute;
    right: 0;
    z-index: -1;
}

/* Mobile nav */
.players-page .mobile-nav-links a {
    background: linear-gradient(
        180deg,
        rgba(30, 30, 30, 0.4) 0%,
        rgba(30, 30, 30, 0.7) 50%,
        rgba(30, 30, 30, 0.4) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0px;
}

.players-page .mobile-search-wrapper {
    background: linear-gradient(
        180deg,
        rgba(30, 30, 30, 0.6) 0%,
        rgba(30, 30, 30, 0.8) 50%,
        rgba(30, 30, 30, 0.6) 100%
    );
}

.players-page .mobile-search-wrapper:focus-within {
    background: linear-gradient(
        180deg,
        rgba(30, 30, 30, 0.8) 0%,
        rgba(30, 30, 30, 0.9) 50%,
        rgba(30, 30, 30, 0.8) 100%
    );
    border: 1px solid rgba(255, 255, 255, .6);
}

/*Main content */
.players-main {
    background: 
        url('../images/backgrounds/players_bg.png');
    background-attachment: fixed;
    background-position: center;
    background-size: cover;
    box-sizing: border-box;
    display: flex;
    font-family: "Source Sans 3", sans-serif;
    font-optical-sizing: auto;
    justify-content: center;
    min-height: 100vh;
    padding-top: 1rem;
    width: 100%;
}

.players-container {
    background: transparent;
    border-radius: 20px 20px 0 0;
    margin: 8vh 0 8vh 0;
    max-width: min(1500px, 95vw);
    width: 90%;
}

/* Header Section */
.players-header {
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.header-section {
    align-items: center;
    display: flex;
    justify-content: flex-start;
    padding: .4em 1.5em;
}

.header-title {
    align-items: center;
    background: var(--leaderboard-green);
    flex-direction: row;
    justify-content: space-between;
}

.hp-logo-blue {
    flex-shrink: 0;
    transform: translateY(1px);
    width: clamp(25px, 3vw, 36px);
}

.title-row-left {
    align-items: center;
    display: flex;
    flex-direction: row;
    flex: 1;
    gap: 0.75rem;
}

.title-content {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.players-title {
    color: var(--white);
    font-family: "Jost", sans-serif;
    font-size: clamp(1em, 5vw, 1.5em);
    font-weight: 500;
    margin: 0;
    text-transform: uppercase;
    white-space: nowrap;
}

.players-subtitle {
    color: var(--white);
    font-family: "Jost", sans-serif;
    font-size: clamp(.66em, 2.5vw, 1em);
    font-weight: 400;
    margin-top: -8px;
}

.title-row-right {
    align-items: center;
    display: flex;
    flex-shrink: 0;
}

.info-icon-container {
    align-items: center;
    cursor: help;
    display: flex;
}

.info-icon {
    width: clamp(16px, 3vw, 24px);
}

/* Info Row */
.info-row {
    background: var(--white);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    color: var(--black);
    max-height: 0;
    overflow: hidden;
    padding: 0;
    transition: max-height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease;
}

.info-row.show {
    max-height: 300px;
    transition: max-height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease;
}

.info-content {
    font-size: 0.75em;
    line-height: 1.5;
    padding: 1em 1.5em;
    text-align: left;
    width: 99%;
}

.info-content p {
    margin-bottom: 1em;
}

.info-content p:last-child {
    margin-bottom: 0;
}

.info-item {
    align-items: flex-start;
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1em;
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-item svg {
    fill: #1f1f1f !important;
    flex-shrink: 0;
    margin-top: 0.1em;
}

.info-item p {
    margin: 0;
}

/* Loading and Error States */
.loading-message, .error-message {
    background: rgba(239, 237, 238, .9);
    color: #666;
    padding: 3rem 2rem;
    text-align: center;
}

.error-message {
    color: #b22234;
}

/* Main Players Table */
.table-container {
    overflow: visible;
    position: relative;
    z-index: 1;
}

.players-table {
    font-size: 0.85em;
    width: 100%;
}

.rankings-title-row {
    background-color: var(--dark-blue);
    color: var(--white);
    height: fit-content;
    padding: 0.15em;
}

.section-title {
    color: var(--white);
    font-family: "Source Sans 3", sans-serif;
    font-size: 0.8em;
    font-weight: 500;
    text-align: center;
}

.rankings-buttons-row {
    display: flex;
    flex-wrap: no-wrap;
    justify-content: stretch;
}

.tour-button {
    align-items: center;
    border-left: 1px solid rgba(47, 92, 102, 0.45);
    cursor: pointer;
    display: flex;
    flex: 1;
    font-family: "Source Sans 3", sans-serif;
    font-size: 0.75em;
    font-weight: 700;
    justify-content: center;
    min-height: 32px;
    overflow: hidden;
    padding: 0.4em 0.6em;
    position: relative;
    text-align: center;
    transition: all 0.3s ease;
    user-select: none;
    white-space: nowrap;
}

.tour-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
}

.tour-button:first-child {
    border-left: none;
}

.tour-button.active {
    background: var(--white);
    color: var(--black);
}

.tour-button:not(.active) {
    background: rgba(242, 243, 244, 0.8);
    border-color: rgba(47, 92, 102, 0.5);
    color: rgba(13, 13, 13, 0.7);
}

.tour-button:not(.active) .tour-button-logo {
    filter: grayscale(75%);
    opacity: 0.75;
}

.tour-button-logo {
    height: 20px;
    max-width: 75%;
    object-fit: contain;
    transition: all 0.3s ease;
    width: 60px;
}

.tour-button[data-tour="owgr"] .tour-button-logo {
    transform: translateY(1px);
}

.tour-button[data-tour="euro"] .tour-button-logo {
    transform: translateY(1px);
}

#ranking-header {
    position: relative;
}

#ranking-header .tour-logo {
    height: auto;
    object-fit: contain;
    width: 70%;
}

#ranking-header:hover::after,
#ranking-header.active::after {
    background-color: var(--white);
    bottom: 2px;
    content: '';
    height: .5px;
    left: 50%;
    position: absolute;
    transform: translateX(-50%);
    transition: all 0.2s ease;
    width: 50%;
}

.ranking-text {
    color: var(--white);
    font-size: 0.8em;
    font-weight: 600;
}

#ranking-header.text-mode .owgr-logo {
    display: none;
}

#ranking-header.text-mode .ranking-text {
    display: block;
}

#ranking-header:not(.text-mode) .ranking-text {
    display: none;
}

#ranking-header:not(.text-mode) .owgr-logo {
    display: block;
}

/* Table Header */
.table-header {
    background-color: var(--dark-blue);
    border-bottom: 1px solid var(--white);
    display: flex;
    padding: 0.15em 0;
    position: sticky;
    top: 35px;
    transition: box-shadow 0.2s ease;
    z-index: 99;
}

.header-cell {
    align-items: center;
    color: var(--white);
    cursor: pointer;
    display: flex;
    font-size: .8em;
    font-weight: 600;
    justify-content: center;
    padding-right: 2em;
    padding: 2px;
    position: relative;
    text-align: center;
    transition: background-color 0.2s ease;
    user-select: none;
    white-space: nowrap;
}

.player-search-header {
    cursor: default;
    flex: 1;
    justify-content: flex-start;
    min-width: 100px;
    padding-left: 6px;
    text-align: left;
}

.player-search-header .player-search-container {
    width: 100%;
    max-width: 150px;
    height: 20px;
    border-radius: 0;
    align-items: center;
    background: var(--white);
    display: flex;
}

.player-search-header .player-search-icon .material-icons {
    font-size: 14px !important;
    line-height: 1.2 !important;
}

.player-search-icon {
    align-items: center;
    aspect-ratio: 1 / 1;
    background: var(--neutral-gray);
    color: var(--white);
    display: flex;
    flex-shrink: 0;
    font-size: 14px;
    height: 100%;
    justify-content: center;
}

.player-search-input {
    background: transparent;
    border: none;
    color: var(--black);
    flex: 1;
    font-family: "Source Sans 3", sans-serif;
    font-size: .9em;
    font-weight: 400;
    height: 100%;
    outline: none;
    padding: 0 8px;
    width: 90%;
}

.player-search-input::placeholder {
    color: rgba(16, 16, 16, 0.6);
    font-style: italic;
}

.player-search-container:focus-within {
    box-shadow: inset 0 0 0 2px rgba(41, 78, 70, 0.25);
}

.player-name-cell {
    flex: 1;
    justify-content: flex-start;
    min-width: 120px;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mental-score-header,
.mental-score-cell {
    flex: 0 0 10%;
    justify-content: center;
}

.last-updated-header,
.last-updated-cell {
    flex: 0 0 10%;
    justify-content: center;
}

.confidence-header,
.confidence-cell {
    flex: 0 0 10%;
    justify-content: center;
}

.confidence-cell {
    color: var(--black);
    font-weight: 500;
}

.conviction-abbreviated {
    display: none; /* Full text on desktop, abbreviated on tablet */
}

.owgr-header,
.owgr-cell {
    flex: 0 0 7.5%;
    justify-content: center;
    min-width: 58px;
}

.header-cell.sortable:not(.owgr-header):hover,
.header-cell.sortable:not(.owgr-header).active {
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: all 0.2s ease;
}

.owgr-header {
    position: relative;
}

.owgr-header:hover::after,
.owgr-header.active::after {
    background-color: var(--white);
    bottom: 5px;
    content: '';
    height: .5px;
    left: 50%;
    position: absolute;
    transform: translateX(-50%);
    transition: all 0.2s ease;
    width: 60%;
}

.sort-indicator {
    color: var(--white);
    font-size: 0.5em;
    position: absolute;
    right: 15%;
    top: 50%;
    transform: translateY(-50%);
}

#ranking-header .sort-indicator {
    right: 2%;
}

.confidence-header .sort-indicator {
    right: 5px;
}


.sortable.active .sort-indicator {
    color: #f8f9fa;
}

.sort-indicator-spacer {
    display: inline-block;
    font-size: 0.7em;
    margin-left: 0.25em;
    text-align: center;
    visibility: hidden; /* Hidden but takes up space */
    width: 1em;
}

.table-row {
    border-bottom: 1px solid rgba(200, 200, 200, .25);
    display: flex;
    justify-content: space-between;
}

.player-row {
    align-items: center;
    background: rgba(220, 220, 220, .95);
    min-height: 2vh;
}

/* Group the right-side columns together */
.right-columns {
    display: flex;
    gap: 0;
    flex-shrink: 1;
}

.table-cell {
    align-items: center;
    display: flex;
    overflow: hidden;
    padding: 2.5px;
}

.players-player-name {
    color: var(--black);
    font-weight: 700;
    margin-left: 0.25rem;
    margin-right: 0.25rem;
}

.player-name-link {
    color: inherit;
    cursor: pointer;
    display: inline-block;
    text-decoration: none;
    transition: all 0.2s ease;
}

.player-name-link:hover {
    text-decoration-color: var(--black);
    text-decoration: underline;
    text-underline-offset: 2px;
    transform: scale(1.02);
}

.player-name-link:active {
    transform: scale(0.98);
}

.player-name-link .players-player-name {
    color: var(--black);
    font-weight: 700;
    pointer-events: none; /* Prevent double-click issues */
}

.player-country {
    color: var(--neutral-gray);
    font-size: .7em;
    font-weight: normal;
}

.mental-score-cell {
    justify-content: center;
}

.mental-score {
    border-radius: 3px;
    color: #f8f9fa;
    font-weight: bold;
    padding: 0.1rem 0.3rem;
    text-align: center;
}

.mental-score-cell.score-negative {
    background-color: var(--dark-red);
}

.mental-score-cell.score-neutral {
    background-color: var(--neutral-gray);
}

.mental-score-cell.score-positive {
    background-color: var(--leaderboard-green);
}

.no-score {
    color: var(--black);
}

.last-updated-cell {
    border-right: 1px solid rgba(47, 92, 102, 0.3);
    color: var(--black);
    font-weight: 500;
    justify-content: center;
    text-align: center;
}

.insights-header,
.insights-cell {
    justify-content: center;
}

.insights-cell {
    color: var(--black);
    font-weight: 650;
    text-align: center;
}

.owgr-cell {
    color: var(--neutral-gray);
    font-size: .75em;
    font-weight: 650;
    justify-content: center;
}

.owgr-logo {
    height: .8em;
    width: auto;
}

.assessment-row {
    background-color: var(--white);
    min-height: auto;
}

.assessment-row:hover {
    background-color: #fff9e5;
}

.assessment-cell {
    justify-content: flex-start;
    line-height: 1.5;
    padding-left: clamp(5px, 1vw, 7px);
    width: 100%;
}

.assessment-cell-expanded {
    padding-left: 0;
}

.assessment-container {
    align-items: flex-start;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    overflow: hidden;
    transition: background-color 0.2s ease;
    width: 100%;
}

.assessment-container.expanded {
    background-color: #fff9e5 !important;
    cursor: default;
    padding-bottom: 1em;
    padding-left: clamp(5px, 1vw, 7px);
    padding-top: .2em;
    padding-right: 1em;
}

.assessment-content {
    flex: 1;
    font-size: .95em;
    padding-top: 2px;
}

.assessment-text {
    color: rgb(14, 14, 14);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.assessment-full {
    color: rgb(16, 17, 13);
    line-height: 1.6;
    margin-right: 0.5rem;
    white-space: pre-wrap;
}

.expand-icon {
    color: var(--neutral-gray);
    font-size: .5em;
    line-height: 1.5;
    margin-left: .5rem;
    margin-right: 0.3rem;
    margin-top: .93em;
    transition: transform 0.2s ease;
}

.no-assessment {
    color: var(--neutral-gray);
    font-size: .95em;
    font-style: italic;
    padding-left: 1.4em;
}

.full-analysis-link {
    color: var(--dark-blue);
    display: inline;
    font-weight: 600;
    margin-left: 0.25em;
    opacity: 0.9;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.full-analysis-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.full-analysis-link:visited {
    color: var(--dark-blue);
}


/* Tablets */
@media (min-width: 768px) and (max-width: 1024px) {

    .conviction-full {
        display: none;
    }
    
    .conviction-abbreviated {
        display: inline;
    }
}


/* Mobile */
@media (max-width: 767px) {

    .desktop-only {
        display: none !important;
    }

    #ranking-header:hover::after,
    #ranking-header.active::after {
        bottom: 5px;
    }

    .title-row-left {
        margin-left: -10px;
    }

    .players-subtitle {
        font-size: .85em;
    }

    .info-icon-container {
        transform: translateX(5px);
    }

    .info-icon {
        width: 1.5em;
    }

    .info-content {
        padding: 1.5em;
    }

    .mental-score-header,
    .mental-score-cell {
        flex: 0 0 20%;
        justify-content: center;
    }

    .header-description,
    .header-search {
        border-top: 1px solid rgba(0, 132, 61, 0.3);
        margin: 0 3%;
    }

    .assessment-text {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .assessment-cell {
        padding: 0.3em;
        min-height: auto;
    }

    .player-search-header {
        padding-left: 3px;
    }

    .last-updated-header,
    .last-updated-cell {
        flex: 0 0 20%;
        justify-content: center;
    }

    .insights-header,
    .insights-cell {
        flex: 0 0 20%;
        justify-content: center;
    }

    .owgr-header,
    .owgr-cell {
        flex: 0 0 10%;
        justify-content: center;
    }

    #ranking-header .tour-logo {
        width: 80%;
    }

    .players-container {
        margin-top: 6vh;
    }

    .player-search-container {
        margin-left: .25rem;
    }
}

/* Small Mobile */
@media (max-width: 480px) {

    .sort-indicator {
        display: none;
    }

    .owgr-header,
    .owgr-cell {
        min-width: none;
    }
}

/* Mobile touch feedback for links */
@media (hover: none) and (pointer: coarse) {

    .player-name-link:hover {
        transform: none; /* Remove scale effect on touch devices */
    }
    
    .player-name-link:active {
        background-color: rgba(0, 0, 0, 0.05);
        border-radius: 2px;
        margin: -1px -2px;
        padding: 1px 2px;
    }
}