/**
 * TODO SOBRE TENIS - Player Search Styles
 * Mobile-first, WTA-inspired design
 */

:root {
    --tst-navy: #305180;
    --tst-lime: #e1fa59;
    --tst-green: #90c50e;
    --tst-navy-dark: #1d3350;
    --tst-navy-light: #4a6b9e;
}

/* ==================== BUSCADOR ==================== */

.tst-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.tst-search-input {
    width: 100%;
    padding: 14px 48px 14px 16px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tst-search-input:focus {
    outline: none;
    border-color: var(--tst-green);
    box-shadow: 0 0 0 3px rgba(144, 197, 14, 0.1);
}

.tst-search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.tst-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.tst-search-results.active {
    display: block;
}

.tst-search-result-item {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tst-search-result-item:hover {
    background: #f8f9fa;
}

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

.tst-result-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tst-navy), var(--tst-navy-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: 14px;
    flex-shrink: 0;
}

.tst-result-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.tst-result-info {
    flex: 1;
}

.tst-result-name {
    font-weight: 500;
    color: #2c2c2a;
    margin-bottom: 2px;
}

.tst-result-meta {
    font-size: 13px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tst-result-flag {
    width: 20px;
    height: 14px;
    border-radius: 2px;
}

.tst-loading {
    padding: 20px;
    text-align: center;
    color: #888;
}

/* ==================== MODAL PERFIL ==================== */

.tst-profile-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.tst-profile-modal.active {
    display: flex;
}

.tst-profile-container {
    background: white;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.tst-profile-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.tst-profile-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Header del perfil */
.tst-profile-header {
    background: linear-gradient(135deg, var(--tst-navy-dark) 0%, var(--tst-navy) 50%, var(--tst-navy-light) 100%);
    padding: 3rem 2rem;
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: 280px;
}

.tst-profile-photo-wrapper {
    position: absolute;
    right: 60px;
    bottom: 0;
    width: 220px;
    height: 280px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.tst-profile-photo {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    font-weight: 500;
    color: white;
    margin-bottom: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.tst-profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.tst-profile-info {
    flex: 1;
    z-index: 1;
}

.tst-profile-country {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(225, 250, 89, 0.2);
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.tst-profile-country-flag {
    width: 24px;
    height: 18px;
    border-radius: 2px;
}

.tst-profile-country-name {
    font-size: 14px;
    color: var(--tst-lime);
    font-weight: 500;
    text-transform: uppercase;
}

.tst-profile-name {
    font-size: 48px;
    font-weight: 500;
    margin: 0 0 8px;
    color: var(--tst-lime);
    text-transform: uppercase;
    letter-spacing: -1px;
    line-height: 1;
}

.tst-profile-name-last {
    font-size: 48px;
    font-weight: 500;
    margin: 0 0 16px;
    color: white;
    text-transform: uppercase;
    letter-spacing: -1px;
    line-height: 1;
}

.tst-profile-rankings-header {
    display: flex;
    gap: 24px;
    margin-top: 16px;
}

.tst-profile-ranking-item {
    flex: 0 0 auto;
}

.tst-profile-ranking-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 4px;
}

.tst-profile-ranking-value {
    font-size: 28px;
    font-weight: 500;
    color: white;
}

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

/* Tabs de navegación */
.tst-profile-tabs {
    border-bottom: 2px solid #f0f0f0;
    padding: 0 2rem;
    background: white;
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.tst-profile-tab {
    padding: 16px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-size: 15px;
    font-weight: 500;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.tst-profile-tab:hover {
    color: var(--tst-navy);
}

/* Contenido de tabs */
.tst-profile-content {
    padding: 2rem;
}

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

.tst-tab-panel.active {
    display: block;
}

/* Sección de noticias */
.tst-news-section {
    margin-bottom: 3rem;
}

.tst-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tst-section-title {
    font-size: 20px;
    font-weight: 500;
    margin: 0;
    color: #2c2c2a;
}

.tst-section-link {
    font-size: 14px;
    color: var(--tst-navy);
    text-decoration: none;
    font-weight: 500;
}

.tst-news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    overflow-x: auto;
}

.tst-news-card {
    aspect-ratio: 3/4;
    background: linear-gradient(135deg, var(--tst-navy), var(--tst-navy-light));
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.tst-news-card:hover {
    transform: translateY(-4px);
}

.tst-news-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--tst-green);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
}

.tst-news-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}

.tst-news-title {
    font-size: 11px;
    color: white;
    font-weight: 500;
    line-height: 1.3;
    margin: 0;
}

/* Biografía */
.tst-bio-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid #f0f0f0;
    margin-bottom: 2rem;
}

.tst-bio-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
}

.tst-bio-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tst-bio-content li {
    margin-bottom: 14px;
    padding-left: 24px;
    position: relative;
    font-size: 15px;
    line-height: 1.6;
    color: #3d3d3a;
}

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

.tst-bio-sidebar {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.tst-bio-data-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.tst-bio-data-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.tst-bio-data-label {
    font-size: 13px;
    color: #888;
    margin-bottom: 4px;
}

.tst-bio-data-value {
    font-size: 15px;
    font-weight: 500;
    color: #2c2c2a;
}

.tst-bio-disclaimer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
    font-size: 12px;
    color: #888;
    font-style: italic;
}

.tst-bio-disclaimer a {
    color: var(--tst-navy);
    text-decoration: none;
}

/* Partidos */
.tst-matches-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tst-year-filter {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    font-size: 14px;
    cursor: pointer;
}

.tst-matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.tst-match-card {
    background: linear-gradient(135deg, var(--tst-navy-dark), var(--tst-navy));
    border-radius: 8px;
    padding: 1.25rem;
    color: white;
}

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

.tst-match-tournament {
    font-size: 13px;
    opacity: 0.7;
    margin-bottom: 4px;
}

.tst-match-date {
    font-size: 11px;
    opacity: 0.5;
}

.tst-match-result {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.tst-match-result.win {
    background: rgba(100, 255, 100, 0.2);
    color: #6bff6b;
}

.tst-match-result.loss {
    background: rgba(255, 100, 100, 0.2);
    color: #ff6b6b;
}

.tst-match-players {
    font-size: 13px;
    margin-bottom: 6px;
}

.tst-match-players strong {
    font-weight: 500;
}

.tst-match-opponent {
    opacity: 0.8;
    margin-bottom: 12px;
}

.tst-match-score {
    font-size: 12px;
    opacity: 0.6;
    font-family: monospace;
}

/* Mobile responsivo */
@media (max-width: 768px) {
    .tst-profile-header {
        padding: 2rem 1.5rem;
        min-height: 240px;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .tst-profile-photo-wrapper {
        position: static;
        width: auto;
        height: auto;
        margin-bottom: 1rem;
    }
    
    .tst-profile-photo {
        width: 100px;
        height: 100px;
        font-size: 42px;
        margin-bottom: 0;
    }
    
    .tst-profile-name,
    .tst-profile-name-last {
        font-size: 32px;
    }
    
    .tst-profile-rankings-header {
        justify-content: center;
    }
    
    .tst-profile-tabs {
        padding: 0 1.5rem;
    }
    
    .tst-profile-tab {
        padding: 14px 16px;
        font-size: 14px;
    }
    
    .tst-profile-content {
        padding: 1.5rem;
    }
    
    .tst-bio-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .tst-news-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .tst-matches-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading spinner */
.tst-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--tst-green);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
