/* ==========================================================================
   ESTILOS PREMIUM DA PÁGINA DE TIMES (taxonomy-times.css)
   ========================================================================== */

/* 1. Sleek Minimal Banner */
.team-banner-header {
    position: relative;
    border-radius: 16px;
    padding: 40px 30px;
    margin: 30px auto;
    max-width: var(--content-w-lg);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    align-items: center;
}

/* Color glow background matching the team colors */
.team-banner-blur-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.12) 0%, rgba(var(--primary-rgb), 0.02) 100%);
    z-index: 1;
}

.team-banner-content {
    display: flex;
    align-items: center;
    gap: 24px;
    position: relative;
    z-index: 2;
    width: 100%;
}

.team-banner-logo {
    flex-shrink: 0;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    padding: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.team-banner-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.team-banner-info {
    flex-grow: 1;
}

.team-banner-type {
    display: inline-block;
    background-color: var(--primary);
    color: var(--text-on-primary);
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 4px 10px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.team-banner-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
    letter-spacing: -0.5px;
    line-height: 1.1;
    text-transform: uppercase;
}

/* 2. Grid Layout */
.team-archive-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 30px;
    max-width: var(--content-w-lg);
    margin: 0 auto 50px auto;
}

.team-main-content {
    min-width: 0; /* Prevents overflow in grid items */
}

.posts-list-default.no-margin {
    margin: 0;
    max-width: 100%;
}

/* 3. Section Titles */
.section-title-premium {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title-premium::after {
    content: '';
    flex-grow: 1;
    height: 2px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--border-color) 100%);
}

.widget-title-premium {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 4. Widgets General */
.team-widget {
    background-color: var(--bg-surface);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

/* 5. Next Match Widget */
.widget-next-match {
    border-top: 4px solid var(--primary);
}

.match-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 10px 0;
}

.match-teams {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 15px;
}

.team-item {
    flex: 1;
    text-align: center;
}

.team-name-small {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    display: block;
    word-break: break-word;
}

.match-vs {
    font-size: 0.8rem;
    font-weight: 900;
    background: var(--bg-body);
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.match-details {
    width: 100%;
    border-top: 1px dashed var(--border-color);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.match-time-info,
.match-venue-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.match-time-info svg,
.match-venue-info svg {
    color: var(--primary);
    flex-shrink: 0;
}

/* 6. Past Matches Widget */
.past-matches-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.past-match-row {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.past-match-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.past-match-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.past-match-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
}

.p-team {
    font-weight: 600;
    color: var(--text-muted);
    flex: 1;
}

.p-team.home {
    text-align: left;
}

.p-team.away {
    text-align: right;
}

.p-team.current-team {
    color: var(--text-main);
    font-weight: 700;
}

.p-score {
    font-size: 0.9rem;
    font-weight: 800;
    background: var(--bg-body);
    color: var(--text-main);
    padding: 2px 8px;
    border-radius: 4px;
    margin: 0 10px;
    white-space: nowrap;
}

/* 7. Stadium and History Widget */
.sidebar-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-info-row:last-of-type {
    border-bottom: none;
    margin-bottom: 10px;
}

.sidebar-info-row strong {
    color: var(--text-main);
}

.sidebar-info-row span {
    color: var(--text-muted);
    text-align: right;
}

.capacity-tag {
    background-color: var(--bg-body);
    font-size: 0.75rem;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
}

/* 8. Collapsible History Section */
.team-history-wrapper {
    margin-top: 15px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    position: relative;
}

.team-history-text {
    max-height: 100px;
    overflow: hidden;
    position: relative;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
    transition: max-height 0.4s ease-out;
}

/* Fade mask at bottom when collapsed */
.team-history-text::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, var(--bg-surface) 100%);
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.team-history-text.expanded {
    max-height: 1500px; /* Big enough to show the full history */
}

.team-history-text.expanded::after {
    opacity: 0;
}

.toggle-history-btn {
    display: block;
    width: 100%;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.toggle-history-btn:hover {
    background-color: var(--bg-body);
    border-color: var(--text-muted);
}

/* ==========================================================================
   RESPONSIVIDADE (STACKING & REORDERING)
   ========================================================================== */

@media (max-width: 991px) {
    .team-archive-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .team-sidebar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    
    .team-sidebar .team-widget {
        margin-bottom: 0;
    }
    
    .team-sidebar .widget-team-history {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .team-banner-header {
        padding: 25px 20px;
        margin: 20px auto;
        border-radius: 12px;
    }

    .team-banner-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
    }

    .team-banner-logo {
        width: 80px;
        height: 80px;
    }

    .team-banner-title {
        font-size: 1.6rem;
    }
    
    .team-sidebar {
        grid-template-columns: 1fr;
    }
    
    .team-sidebar .widget-team-history {
        grid-column: span 1;
    }
}

/* ==========================================================================
   ESTILOS DAS ABAS E ELENCO (TABS & ROSTER)
   ========================================================================== */

.team-tabs-container {
    margin-top: 20px;
    width: 100%;
}

.team-tabs-nav {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 25px;
    padding-bottom: 0;
}

.team-tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    color: var(--text-muted);
    position: relative;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    outline: none;
}

.team-tab-btn:hover {
    color: var(--text-main);
}

.team-tab-btn.active {
    color: var(--primary);
}

.team-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary);
    border-radius: 3px 3px 0 0;
}

.team-tab-btn .tab-icon {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.team-tab-btn:hover .tab-icon {
    transform: translateY(-1px);
}

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

.team-tab-pane.active {
    display: block;
    animation: teamTabFadeIn 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes teamTabFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Elenco / Players Grid */
.team-players-section {
    width: 100%;
}

.players-position-group {
    margin-bottom: 40px;
}

.players-position-group:last-child {
    margin-bottom: 10px;
}

.position-group-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-left: 4px solid var(--primary);
    padding-left: 12px;
    line-height: 1.2;
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 20px;
}

/* Player Card Styling */
.player-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.015);
}

.player-card:hover {
    transform: translateY(-6px);
    border-color: rgba(var(--primary-rgb), 0.35);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.05), 0 4px 10px rgba(var(--primary-rgb), 0.04);
}

.player-card-img-wrapper {
    position: relative;
    height: 195px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.player-card-img-wrapper img {
    transition: transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: block;
}

.player-card-img-wrapper img.is-cutout {
    max-height: 94%;
    max-width: 94%;
    object-fit: contain;
    filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.12));
    margin-bottom: -1px;
}

.player-card-img-wrapper img.is-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-height: 100%;
    max-width: 100%;
}

.player-card:hover .player-card-img-wrapper img {
    transform: scale(1.06);
}

.player-placeholder {
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    opacity: 0.3;
    padding: 30px;
}

.player-placeholder svg {
    width: 55px;
    height: 55px;
}

.player-number {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: var(--primary);
    color: var(--text-on-primary);
    font-size: 0.78rem;
    font-weight: 800;
    padding: 3px 7px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    z-index: 2;
    line-height: 1;
}

.player-card-info {
    padding: 14px;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.player-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 5px 0;
    line-height: 1.35;
    text-transform: capitalize;
}

.player-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.74rem;
    color: var(--text-muted);
}

.player-nationality {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.player-nationality svg {
    flex-shrink: 0;
    color: var(--text-muted);
    opacity: 0.7;
}

@media (max-width: 575px) {
    .players-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .player-card-img-wrapper {
        height: 160px;
    }
    
    .player-name {
        font-size: 0.85rem;
    }
    
    .team-tab-btn {
        padding: 10px 14px;
        font-size: 0.88rem;
    }
}
