/**
 * Player Page Styles
 * Colors: #305180 (navy), #e1fa59 (lime), #90c50e (green)
 * Mobile-first, WTA-inspired design
 */

:root {
    --tst-navy: #305180;
    --tst-navy-dark: #1d3350;
    --tst-navy-light: #4a6b9e;
    --tst-lime: #e1fa59;
    --tst-green: #90c50e;
    --tst-white: #ffffff;
    --tst-gray-100: #f8f9fa;
    --tst-gray-200: #e9ecef;
    --tst-gray-600: #6c757d;
    --tst-gray-900: #1a1a1a;
}

.tst-player-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--tst-gray-100);
    min-height: 100vh;
}

/* Player Header */
.tst-player-header {
    background: linear-gradient(135deg, var(--tst-navy-dark), var(--tst-navy), var(--tst-navy-light));
    color: var(--tst-white);
    padding: 48px 24px 32px;
    position: relative;
    overflow: hidden;
}

.tst-player-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(225, 250, 89, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.tst-player-header-content {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.tst-player-photo-section {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
}

.tst-player-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--tst-white);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--tst-navy), var(--tst-navy-light));
}

.tst-player-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tst-player-photo-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: 700;
    color: var(--tst-lime);
}

.tst-player-title-section {
    flex: 1;
}

.tst-player-country-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.tst-player-country-flag {
    font-size: 18px;
}

.tst-player-name {
    font-size: 42px;
    font-weight: 700;
    line-height: 1.1;
    margin: 0 0 16px;
    letter-spacing: -0.5px;
}

.tst-player-name-first {
    color: var(--tst-lime);
}

.tst-player-name-last {
    color: var(--tst-white);
}

.tst-player-rankings {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.tst-ranking-badge {
    text-align: center;
}

.tst-ranking-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    opacity: 0.8;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tst-ranking-value {
    display: block;
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
}

.tst-ranking-value.official {
    color: var(--tst-white);
}

.tst-ranking-value.live {
    color: var(--tst-white);
}

.tst-ranking-value.best {
    color: var(--tst-green);
}

/* Navigation Tabs */
.tst-player-tabs {
    background: var(--tst-white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.tst-player-tabs-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tst-player-tabs-inner::-webkit-scrollbar {
    display: none;
}

.tst-tab-button {
    flex: 1;
    min-width: 120px;
    padding: 20px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 15px;
    font-weight: 600;
    color: var(--tst-gray-600);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tst-tab-button:hover {
    color: var(--tst-navy);
    background: var(--tst-gray-100);
}

.tst-tab-button.active {
    color: var(--tst-navy);
    border-bottom-color: var(--tst-navy);
}

/* Tab Content */
.tst-player-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.tst-tab-pane {
    display: none;
}

.tst-tab-pane.active {
    display: block;
    animation: tst-fade-in 0.4s ease;
}

@keyframes tst-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Overview Tab */
.tst-overview-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.tst-card {
    background: var(--tst-white);
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.tst-card h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--tst-navy);
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--tst-gray-200);
}

.tst-stats-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tst-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--tst-gray-200);
}

.tst-stat-item:last-child {
    border-bottom: none;
}

.tst-stat-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--tst-gray-600);
}

.tst-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--tst-gray-900);
}

/* Biography Tab */
.tst-bio-content ul {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
}

.tst-bio-content li {
    position: relative;
    padding: 12px 0 12px 32px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--tst-gray-900);
}

.tst-bio-content li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--tst-green);
    font-size: 20px;
    font-weight: bold;
}

.tst-bio-disclaimer {
    padding: 16px;
    background: var(--tst-gray-100);
    border-left: 4px solid var(--tst-green);
    border-radius: 8px;
    font-size: 13px;
    color: var(--tst-gray-600);
    font-style: italic;
}

/* Matches Section */
.tst-matches-section h3 {
    margin-bottom: 24px;
}

.tst-match-card {
    background: linear-gradient(135deg, var(--tst-navy-dark), var(--tst-navy));
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    color: var(--tst-white);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tst-match-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(48, 81, 128, 0.3);
}

.tst-match-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.tst-match-tournament {
    flex: 1;
}

.tst-tournament-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--tst-white);
    margin-bottom: 4px;
}

.tst-tournament-city {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.tst-match-date {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.tst-match-result {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.tst-match-badge {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 800;
}

.tst-match-badge.win {
    background: var(--tst-green);
    color: var(--tst-white);
}

.tst-match-badge.loss {
    background: rgba(255, 255, 255, 0.2);
    color: var(--tst-white);
}

.tst-match-opponent {
    flex: 1;
}

.tst-opponent-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--tst-white);
    margin-bottom: 4px;
}

.tst-match-score {
    font-size: 15px;
    font-weight: 600;
    color: var(--tst-lime);
}

.tst-match-round {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--tst-white);
}

/* Responsive */
@media (min-width: 768px) {
    .tst-player-header {
        padding: 64px 32px 48px;
    }
    
    .tst-player-photo {
        width: 160px;
        height: 160px;
    }
    
    .tst-player-name {
        font-size: 56px;
    }
    
    .tst-ranking-value {
        font-size: 40px;
    }
    
    .tst-overview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tst-player-content {
        padding: 48px 32px;
    }
}

@media (min-width: 1024px) {
    .tst-player-photo-section {
        gap: 32px;
    }
    
    .tst-overview-grid {
        grid-template-columns: 2fr 1fr;
    }
}

/* ========================================
   NEWS SECTION STYLES - EN LISTA DENTRO DE CARD
   ======================================== */

.tst-news-list {
    margin-top: 16px;
}

.tst-news-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--tst-gray-200);
}

.tst-news-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.tst-news-item-thumb {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
}

.tst-news-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.tst-news-item:hover .tst-news-item-thumb img {
    transform: scale(1.05);
}

.tst-news-item-content {
    flex: 1;
}

.tst-news-item-content h4 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.3;
}

.tst-news-item-content h4 a {
    color: var(--tst-navy);
    text-decoration: none;
    transition: color 0.2s ease;
}

.tst-news-item-content h4 a:hover {
    color: var(--tst-green);
}

.tst-news-item-meta {
    font-size: 12px;
    color: var(--tst-gray-600);
    margin-bottom: 8px;
}

.tst-news-item-excerpt {
    font-size: 14px;
    line-height: 1.5;
    color: var(--tst-gray-900);
    margin-bottom: 10px;
}

.tst-news-item-link {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: var(--tst-green);
    text-decoration: none;
    transition: color 0.2s ease;
}

.tst-news-item-link:hover {
    color: var(--tst-navy);
}

/* AdSense Container */
.tst-adsense-container {
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid var(--tst-gray-200);
}

/* Social Media */
.tst-social-media {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--tst-gray-200);
}

.tst-social-media h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--tst-navy);
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tst-social-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tst-social-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.tst-social-link.twitter {
    background: #1DA1F2;
    color: #ffffff;
}

.tst-social-link.twitter:hover {
    background: #1a8cd8;
}

.tst-social-link.instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: #ffffff;
}

.tst-social-link.instagram:hover {
    opacity: 0.9;
}

.tst-social-link.facebook {
    background: #1877F2;
    color: #ffffff;
}

.tst-social-link.facebook:hover {
    background: #166fe5;
}

/* Wikipedia Source */
.tst-wiki-source {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--tst-gray-200);
    font-size: 13px;
    color: var(--tst-gray-600);
}

.tst-wiki-source a {
    color: var(--tst-green);
    text-decoration: none;
    font-weight: 600;
}

.tst-wiki-source a:hover {
    color: var(--tst-navy);
    text-decoration: underline;
}

/* Biography Source */
.tst-bio-source {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid var(--tst-gray-200);
    color: var(--tst-gray-600);
    font-size: 13px;
}

.tst-bio-source small {
    font-size: 12px;
}

/* ========================================
   ACTIVITY TAB STYLES
   ======================================== */

.tst-upcoming-matches {
    margin-top: 16px;
}

.tst-upcoming-match {
    background: var(--tst-gray-100);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid var(--tst-green);
}

.tst-upcoming-match .tst-tournament-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--tst-navy);
    margin-bottom: 4px;
}

.tst-upcoming-match .tst-match-round {
    font-size: 13px;
    color: var(--tst-gray-600);
    margin-bottom: 8px;
}

.tst-upcoming-match .tst-opponent-info {
    font-size: 15px;
    color: var(--tst-gray-900);
    margin-bottom: 8px;
}

.tst-upcoming-match .tst-match-date {
    font-size: 13px;
    color: var(--tst-gray-600);
}

.tst-matches-table {
    margin-top: 16px;
}

.tst-match-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid var(--tst-gray-200);
    transition: background 0.2s ease;
}

.tst-match-row:hover {
    background: var(--tst-gray-100);
}

.tst-match-result-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
}

.tst-match-result-icon.win {
    background: var(--tst-green);
    color: var(--tst-white);
}

.tst-match-result-icon.loss {
    background: var(--tst-gray-200);
    color: var(--tst-gray-600);
}

.tst-match-details {
    flex: 1;
}

.tst-match-details .tst-match-opponent {
    font-size: 16px;
    font-weight: 600;
    color: var(--tst-gray-900);
    margin-bottom: 4px;
}

.tst-match-details .tst-match-tournament-small {
    font-size: 13px;
    color: var(--tst-gray-600);
}

.tst-match-score-display {
    font-size: 15px;
    font-weight: 600;
    color: var(--tst-green);
    min-width: 80px;
    text-align: center;
}

.tst-match-date-small {
    font-size: 13px;
    color: var(--tst-gray-600);
    min-width: 80px;
    text-align: right;
}

/* ========================================
   STATS TAB STYLES
   ======================================== */

.tst-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.tst-stat-box {
    background: linear-gradient(135deg, var(--tst-navy-dark), var(--tst-navy));
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    color: var(--tst-white);
}

.tst-stat-box .tst-stat-label {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tst-stat-box .tst-stat-big {
    font-size: 36px;
    font-weight: 800;
    color: var(--tst-lime);
}

/* ========================================
   MOBILE OPTIMIZATIONS - ULTRA MEJORADO
   ======================================== */

@media (max-width: 767px) {
    /* Fix header */
    .tst-player-header {
        padding: 20px 12px 16px !important;
    }
    
    .tst-player-photo-section {
        gap: 12px;
        align-items: center;
    }
    
    .tst-player-photo {
        width: 70px !important;
        height: 70px !important;
    }
    
    .tst-player-photo-initials {
        font-size: 28px;
    }
    
    /* Fix country badge */
    .tst-player-country-badge {
        font-size: 10px;
        padding: 3px 8px;
        margin-bottom: 6px;
    }
    
    .tst-player-country-flag {
        font-size: 14px;
    }
    
    /* Fix player name - CRÍTICO */
    .tst-player-name {
        font-size: 22px !important;
        line-height: 1.2;
        margin-bottom: 10px !important;
        word-break: break-word;
        hyphens: auto;
    }
    
    .tst-player-name-first,
    .tst-player-name-last {
        display: inline;
    }
    
    /* Fix rankings */
    .tst-player-rankings {
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .tst-ranking-badge {
        min-width: 65px;
    }
    
    .tst-ranking-label {
        font-size: 9px;
        margin-bottom: 2px;
    }
    
    .tst-ranking-value {
        font-size: 20px !important;
    }
    
    /* Fix tabs */
    .tst-player-tabs {
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .tst-player-tabs-inner {
        gap: 2px;
        padding: 0 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .tst-player-tabs-inner::-webkit-scrollbar {
        display: none;
    }
    
    .tst-tab-button {
        min-width: 75px;
        padding: 12px 8px;
        font-size: 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Fix content */
    .tst-player-content {
        padding: 16px 12px !important;
    }
    
    /* Fix cards */
    .tst-card {
        padding: 14px;
        border-radius: 8px;
        margin-bottom: 12px;
    }
    
    .tst-card h3 {
        font-size: 15px;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    
    .tst-card h4 {
        font-size: 14px;
    }
    
    /* Fix stats list */
    .tst-stat-item {
        padding: 8px 0;
        gap: 8px;
    }
    
    .tst-stat-label {
        font-size: 12px;
        flex: 0 0 100px;
    }
    
    .tst-stat-value {
        font-size: 13px;
        text-align: right;
        font-weight: 600;
        word-break: break-word;
    }
    
    /* Fix overview grid */
    .tst-overview-grid {
        gap: 12px;
    }
    
    /* Fix match cards */
    .tst-match-card {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .tst-match-header {
        flex-direction: column;
        gap: 8px;
    }
    
    .tst-tournament-name {
        font-size: 14px;
    }
    
    .tst-tournament-city {
        font-size: 12px;
    }
    
    .tst-match-date {
        font-size: 11px;
        align-self: flex-start;
    }
    
    .tst-opponent-name {
        font-size: 13px;
    }
    
    .tst-match-score {
        font-size: 13px;
    }
    
    .tst-match-badge {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .tst-match-round {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    /* Fix news items */
    .tst-news-item {
        gap: 12px;
        padding: 12px 0;
    }
    
    .tst-news-item-thumb {
        width: 80px;
        height: 80px;
    }
    
    .tst-news-item-content h4 {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .tst-news-item-meta {
        font-size: 11px;
        margin-bottom: 6px;
    }
    
    .tst-news-item-excerpt {
        font-size: 12px;
        margin-bottom: 8px;
        line-height: 1.4;
    }
    
    .tst-news-item-link {
        font-size: 12px;
    }
    
    /* Fix stats grid */
    .tst-stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .tst-stat-box {
        padding: 16px;
    }
    
    .tst-stat-box .tst-stat-label {
        font-size: 11px;
    }
    
    .tst-stat-box .tst-stat-big {
        font-size: 28px;
    }
    
    /* Fix match rows */
    .tst-match-row {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px;
    }
    
    .tst-match-result-icon {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    .tst-match-details {
        flex: 1 1 calc(100% - 45px);
    }
    
    .tst-match-details .tst-match-opponent {
        font-size: 14px;
    }
    
    .tst-match-details .tst-match-tournament-small {
        font-size: 12px;
    }
    
    .tst-match-score-display {
        min-width: auto;
        flex: 0 0 auto;
        font-size: 14px;
    }
    
    .tst-match-date-small {
        flex: 1 1 100%;
        text-align: left;
        font-size: 11px;
        margin-left: 42px;
    }
    
    /* Fix upcoming matches */
    .tst-upcoming-match {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .tst-upcoming-match .tst-tournament-name {
        font-size: 14px;
    }
    
    .tst-upcoming-match .tst-match-round {
        font-size: 12px;
    }
    
    .tst-upcoming-match .tst-opponent-info {
        font-size: 13px;
    }
    
    .tst-upcoming-match .tst-match-date {
        font-size: 12px;
    }
    
    /* Fix AdSense */
    .tst-adsense-container {
        margin-top: 24px;
        padding: 16px 0;
    }
    
    /* Fix social media */
    .tst-social-media {
        margin-top: 16px;
        padding-top: 16px;
    }
    
    .tst-social-media h4 {
        font-size: 12px;
        margin-bottom: 10px;
    }
    
    .tst-social-links {
        gap: 6px;
    }
    
    .tst-social-link {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .tst-social-link svg {
        width: 16px;
        height: 16px;
    }
}

/* Extra small devices */
@media (max-width: 374px) {
    .tst-player-header {
        padding: 16px 10px 14px !important;
    }
    
    .tst-player-photo {
        width: 60px !important;
        height: 60px !important;
    }
    
    .tst-player-photo-initials {
        font-size: 24px;
    }
    
    .tst-player-name {
        font-size: 20px !important;
    }
    
    .tst-ranking-value {
        font-size: 18px !important;
    }
    
    .tst-tab-button {
        min-width: 70px;
        padding: 10px 6px;
        font-size: 11px;
    }
    
    .tst-card {
        padding: 12px;
    }
    
    .tst-news-item-thumb {
        width: 70px;
        height: 70px;
    }
}

/* Tablet */
@media (min-width: 768px) {
    .tst-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tst-news-item-thumb {
        width: 120px;
        height: 120px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .tst-stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
