/**
 * Team Page – BVB Kader
 * Ostborussen Design System (Schwarz/Gelb)
 * Tabs: gleicher Stil wie matches.php (matches-tabs)
 */

/* Matches-Tabs auf Team-Seite (1:1 wie Saison/Matches) */
.team-section .matches-tabs .matches-tabs-nav {
    display: flex;
    gap: 0;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.team-section .matches-tabs .matches-tabs-nav::-webkit-scrollbar { display: none; }
.team-section .matches-tabs .matches-tab-btn {
    flex: 0 0 auto;
    padding: 0.5rem 0.85rem 0.6rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    color: rgba(255,255,255,0.55);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}
.team-section .matches-tabs .matches-tab-btn:hover {
    color: rgba(255,255,255,0.85);
}
.team-section .matches-tabs .matches-tab-btn.active {
    color: var(--primary, #fde047);
    border-bottom-color: var(--primary, #fde047);
}
@media (max-width: 600px) {
    .team-section .matches-tabs .matches-tab-btn {
        padding: 0.4rem 0.6rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* Loading / Error */
.team-loading,
.team-error {
    margin: var(--space-lg) 0;
}
.team-section .empty-state {
    padding: var(--space-xl);
}

/* Section Headings */
.team-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-yellow);
    margin: var(--space-lg) 0 var(--space-md);
    padding-bottom: var(--space-xs);
    border-bottom: 2px solid var(--gray-700);
}
.team-section-title:first-child {
    margin-top: 0;
}

/* Grid: 2 mobil, 3 tablet, 4–6 desktop */
.team-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}
@media (min-width: 600px) {
    .team-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (min-width: 900px) {
    .team-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media (min-width: 1200px) {
    .team-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: var(--space-lg);
    }
}

/* Player Card – an post-card/match-card angelehnt */
.team-player-card {
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-sm);
    text-align: center;
}
.team-player-card:hover {
    border-color: var(--primary-yellow);
    box-shadow: 0 8px 30px rgba(253, 225, 0, 0.15);
}
.team-player-card:focus {
    outline: 2px solid var(--primary-yellow);
    outline-offset: 2px;
}
.team-player-card:focus:not(:focus-visible) {
    outline: none;
}

/* Hover/Tap: Zoom + Shadow (reduced-motion beachten) */
@media (hover: hover) {
    .team-player-card:hover .team-player-card-img-wrap img {
        transform: scale(1.06);
    }
    .team-player-card:hover .team-player-card-img-wrap {
        box-shadow: 0 8px 24px rgba(253, 225, 0, 0.2);
    }
}
@media (prefers-reduced-motion: reduce) {
    .team-player-card,
    .team-player-card .team-player-card-img-wrap img {
        transition: none;
    }
    .team-player-card:hover .team-player-card-img-wrap img {
        transform: none;
    }
}

.team-player-card-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    max-height: 220px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--gray-700);
    transition: box-shadow 0.25s ease;
}
.team-player-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.team-player-card-number {
    position: absolute;
    top: var(--space-xs);
    right: var(--space-xs);
    background: var(--primary-black);
    color: var(--primary-yellow);
    font-weight: 800;
    font-size: 1.25rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary-yellow);
}
.team-player-card-name {
    font-weight: 600;
    color: var(--white);
    margin-top: var(--space-sm);
    font-size: 0.95rem;
    line-height: 1.3;
}

/* Karten-Animation: Einflippen / Stagger (nur wenn nicht prefers-reduced-motion) */
.team-content--animated .team-player-card--animate {
    opacity: 0;
    transform: perspective(400px) rotateY(-12deg);
    animation: team-card-flip-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes team-card-flip-in {
    from {
        opacity: 0;
        transform: perspective(400px) rotateY(-18deg) scale(0.92);
    }
    to {
        opacity: 1;
        transform: perspective(400px) rotateY(0) scale(1);
    }
}
@media (prefers-reduced-motion: reduce) {
    .team-content--animated .team-player-card--animate {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* Tooltip */
.team-tooltip {
    position: fixed;
    z-index: 1100;
    max-width: min(360px, calc(100vw - 2 * var(--space-md)));
    pointer-events: none;
}
.team-tooltip-inner {
    position: relative;
    background: var(--gray-800);
    border: 2px solid var(--primary-yellow);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: var(--space-md);
    padding-top: 2rem;
    color: var(--white);
    pointer-events: auto;
}
/* Schließen-Button: oben rechts wie Chart auf der Startseite */
.team-tooltip-close {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    left: auto;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--gray-400);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    pointer-events: auto;
    z-index: 2;
}
.team-tooltip-close:hover,
.team-tooltip-close:focus {
    color: var(--primary-yellow);
    background: rgba(253, 225, 0, 0.1);
}
.team-tooltip-close:focus {
    outline: 2px solid var(--primary-yellow);
    outline-offset: 2px;
}
/* Mobil: größerer Touch-Bereich wie Chart-Popover */
@media (max-width: 768px) {
    .team-tooltip-inner {
        padding: 0.7rem 1.5rem 0.7rem 0.9rem;
        padding-top: 2.25rem;
    }
    .team-tooltip-close {
        top: 0.25rem;
        right: 0.25rem;
        left: auto;
        width: 1.75rem;
        height: 1.75rem;
        min-width: 44px;
        min-height: 44px;
        font-size: 1.35rem;
    }
}
.team-tooltip-loading {
    color: var(--gray-400);
}
.team-tooltip-body h4 {
    color: var(--primary-yellow);
    margin-bottom: var(--space-sm);
    font-size: 1.1rem;
}
.team-tooltip-stats {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-xs) var(--space-md);
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
}
.team-tooltip-stats dt { color: var(--gray-400); }
.team-tooltip-stats dd { margin: 0; }
.team-tooltip-injury {
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--gray-700);
    font-size: 0.9rem;
    color: #fca5a5;
}
.team-tooltip-injury strong { color: #ef4444; }
.team-tooltip-no-stats {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin: 0 0 var(--space-sm);
}

/* Mobile: Tooltip als Bottom-Sheet-ähnlich (am unteren Rand) */
@media (max-width: 640px) {
    .team-tooltip {
        left: var(--space-md) !important;
        right: var(--space-md) !important;
        width: auto !important;
        max-width: none;
        bottom: var(--space-md);
        top: auto !important;
    }
}
