main.match-details {
    width: 100vw;
    background: var(--DefaultBackgroundColor);
    display: flex;
    justify-content: center;
}

/* Main content container */
main.match-details .main-content {
    display: flex;
    flex-direction: column;
    width: 70%;
    padding: 20px 0;
}

main.match-details .match-details-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Match Header Section */
main.match-details .match-header {
    width: 100%;
    background: var(--CardBackgroundColor);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
}

/* Header Top - Back Button & League Info */
main.match-details .header-top {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
}

main.match-details .back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--FooterBackgroundColor);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

main.match-details .back-btn:hover {
    background: var(--DarkCardBackgroundColor);
}

main.match-details .back-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--TextDefaultColor);
}

main.match-details .league-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

main.match-details .league-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

main.match-details .league-round {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    color: var(--TextDefaultColor);
}

/* Match Info - Date & Stadium */
main.match-details .match-info {
    text-align: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

main.match-details .match-date {
    font-size: 0.85rem;
    color: var(--TextDefaultColor);
    margin: 0 0 4px 0;
    font-weight: 500;
}

main.match-details .stadium-name {
    font-size: 0.8rem;
    color: var(--DarkTextColor);
    margin: 0;
}

/* Match Score Section */
main.match-details .match-score-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 32px 24px;
    gap: 20px;
    border-bottom: 1px solid var(--border-color);
}

main.match-details .team {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

main.match-details .team-logo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    /* padding: 8px; */
    background: var(--LightBackgroundColor);
}

main.match-details .team-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    color: var(--TextDefaultColor);
    text-align: center;
}

main.match-details .score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

main.match-details .score {
    display: flex;
    align-items: center;
    gap: 12px;
}

main.match-details .home-score,
main.match-details .away-score {
    font-size: 3rem;
    font-weight: 700;
    color: var(--TextDefaultColor);
}

main.match-details .separator {
    font-size: 2rem;
    font-weight: 400;
    color: var(--DarkTextColor);
}

main.match-details .match-status {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--DarkTextColor);
    background: var(--FooterBackgroundColor);
    padding: 4px 12px;
    border-radius: 6px;
    margin: 0;
}

/* Match Navigation */
main.match-details .match-navigation {
    display: flex;
    gap: 0;
}

main.match-details .match-navigation .nav-link {
    flex: 1;
    text-align: center;
    padding: 16px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--DarkTextColor);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

main.match-details .match-navigation .nav-link:hover {
    color: var(--TextDefaultColor);
    background: var(--FooterBackgroundColor);
}

main.match-details .match-navigation .nav-link.active {
    color: var(--TextDefaultColor);
    border-bottom-color: var(--TextDefaultColor);
    background: var(--FooterBackgroundColor);
}

/* Content Sections */
main.match-details .match-content {
    width: 100%;
    min-height: 400px;
}

main.match-details .content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

main.match-details .content-section.active {
    display: block;
}

main.match-details .content-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--TextDefaultColor);
}

main.match-details .content-section p {
    color: var(--DarkTextColor);
}

/* Overview Grid */
main.match-details .overview-grid {
    display: grid;
    grid-template-columns: 60% 40%;
    gap: 20px;
}

main.match-details .overview-left,
main.match-details .overview-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Events Container */
main.match-details .events-container {
    padding: 20px;
}

main.match-details .events-container h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--TextDefaultColor);
}

main.match-details .events-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

main.match-details .event-row {
    display: grid;
    grid-template-columns: 1fr 60px 1fr;
    gap: 12px;
    align-items: center;
}

main.match-details .event-time {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--TextDefaultColor);
    background: var(--FooterBackgroundColor);
    padding: 6px 8px;
    border-radius: 6px;
}

main.match-details .event-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

main.match-details .event-home .event-content {
    justify-content: flex-end;
}

main.match-details .event-away .event-content {
    justify-content: flex-start;
}

main.match-details .event-player {
    font-size: 0.9rem;
    color: var(--TextDefaultColor);
}

main.match-details .event-icon {
    font-size: 1.2rem;
}

/* Lineup Container */
main.match-details .lineup-container {
    padding: 20px;
}

main.match-details .lineup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

main.match-details .lineup-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--TextDefaultColor);
}

main.match-details .lineup-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--FooterBackgroundColor);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--TextDefaultColor);
    cursor: pointer;
    transition: all 0.2s;
}

main.match-details .lineup-toggle-btn:hover {
    background: var(--DarkCardBackgroundColor);
}

main.match-details .lineup-toggle-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--TextDefaultColor);
    transition: transform 0.3s;
}

main.match-details .lineup-toggle-btn.active svg {
    transform: rotate(90deg);
}

main.match-details .lineup-view {
    display: none;
}

main.match-details .lineup-view.active {
    display: block;
}

main.match-details .lineup-teams {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

main.match-details .lineup-team h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--TextDefaultColor);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

main.match-details .team-header-logo {
    width: 24px;
    height: 24px;
}

/* Mini Loading Spinner for Overview Lineup */
main.match-details .lineup-loading-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 10px;
    color: #888;
    font-size: 12px;
}

main.match-details .loading-spinner-mini {
    width: 16px;
    height: 16px;
    border: 2px solid #e5e5e5;
    border-top-color: var(--accent-color, #1a73e8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

main.match-details .no-data-mini {
    padding: 15px 10px;
    text-align: center;
    color: #888;
    font-size: 12px;
}

/* Injured Player in Overview */
main.match-details .player-item.injured {
    opacity: 0.6;
}

main.match-details .player-item .injury-icon {
    color: #ff6b6b;
    font-size: 10px;
    margin-left: auto;
}

main.match-details .players-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

main.match-details .player-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--FooterBackgroundColor);
    border-radius: 6px;
    font-size: 0.9rem;
}

main.match-details .player-number {
    font-weight: 700;
    color: var(--DarkTextColor);
    min-width: 24px;
}

main.match-details .player-image {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--DarkCardBackgroundColor);
}

main.match-details .player-name {
    color: var(--TextDefaultColor);
}

/* Team Form Container */
main.match-details .team-form-container {
    padding: 20px;
}

main.match-details .form-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

main.match-details .form-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--TextDefaultColor);
}

main.match-details .team-switch {
    display: flex;
    gap: 8px;
}

main.match-details .team-switch-btn {
    flex: 1;
    padding: 8px 16px;
    background: var(--FooterBackgroundColor);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--TextDefaultColor);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

main.match-details .team-switch-btn:hover {
    background: var(--DarkCardBackgroundColor);
}

main.match-details .team-switch-btn.active {
    background: var(--DarkCardBackgroundColor);
    border-color: var(--TextDefaultColor);
}

main.match-details .switch-team-logo {
    width: 20px;
    height: 20px;
}

main.match-details .team-form-view {
    display: none;
    flex-direction: column;
    gap: 8px;
}

main.match-details .team-form-view.active {
    display: flex;
}

main.match-details .form-match {
    padding: 12px;
    border-radius: 6px;
}

main.match-details .form-match.win {
    background: rgba(34, 197, 94, 0.15);
}

main.match-details .form-match.draw {
    background: rgba(234, 179, 8, 0.15);
}

main.match-details .form-match.loss {
    background: rgba(239, 68, 68, 0.15);
}

main.match-details .form-match-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

main.match-details .form-team {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
main.match-details .form-team.home {
    justify-content: end;
}

main.match-details .team-logo-small {
    width: 24px;
    height: 24px;
}

main.match-details .team-name-small {
    font-size: 0.85rem;
    color: var(--TextDefaultColor);
    font-weight: 500;
}

main.match-details .form-score {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--TextDefaultColor);
    min-width: 50px;
    text-align: center;
}

/* ========== H2H Overview Container ========== */
main.match-details .h2h-overview-container {
    padding: 16px;
}

main.match-details .h2h-overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

main.match-details .h2h-overview-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--TextDefaultColor);
    margin: 0;
}

main.match-details .h2h-overview-header .view-all-link {
    font-size: 0.8rem;
    color: var(--accent-color, #1a73e8);
    text-decoration: none;
    font-weight: 500;
}

main.match-details .h2h-overview-header .view-all-link:hover {
    text-decoration: underline;
}

/* H2H Overview Stats */
main.match-details .h2h-overview-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 12px;
}

main.match-details .h2h-overview-team {
    display: flex;
    align-items: center;
    gap: 10px;
}

main.match-details .h2h-overview-team.away {
    flex-direction: row-reverse;
}

main.match-details .h2h-overview-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

main.match-details .h2h-overview-wins {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--TextDefaultColor);
}

main.match-details .h2h-overview-draws {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

main.match-details .h2h-overview-draws span:first-child {
    font-size: 1.2rem;
    font-weight: 600;
    color: #666;
}

main.match-details .h2h-overview-draws .draws-label {
    font-size: 0.7rem;
    color: #888;
    font-weight: 500;
}

/* H2H Overview Matches */
main.match-details .h2h-overview-matches {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

main.match-details .h2h-overview-match {
    display: flex;
    flex-direction: column;
    padding: 10px;
    border-radius: 6px;
    background: #fafafa;
    border-left: 3px solid #ccc;
}

main.match-details .h2h-overview-match.win {
    border-left-color: #2AD572;
}

main.match-details .h2h-overview-match.loss {
    border-left-color: #FF4646;
}

main.match-details .h2h-overview-match.draw {
    border-left-color: #888;
}

main.match-details .h2h-overview-match-date {
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 4px;
}

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

main.match-details .h2h-overview-team-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--TextDefaultColor);
}

main.match-details .h2h-overview-team-name:last-child {
    text-align: right;
}

main.match-details .h2h-overview-match-score {
    font-weight: 600;
    padding: 0 10px;
    color: var(--TextDefaultColor);
}

main.match-details .h2h-overview-no-data {
    text-align: center;
    color: #999;
    font-size: 0.85rem;
    padding: 16px;
}

/* Next Match Container */
main.match-details .next-match-container {
    padding: 20px;
}

main.match-details .next-match-container h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--TextDefaultColor);
    text-align: center;
}

main.match-details .league-badge {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
}

main.match-details .league-logo-small {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

main.match-details .next-match-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

main.match-details .next-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

main.match-details .next-team-logo {
    width: 48px;
    height: 48px;
}

main.match-details .next-team-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--TextDefaultColor);
    text-align: center;
}

main.match-details .next-match-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

main.match-details .match-time {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--TextDefaultColor);
}

main.match-details .match-date {
    font-size: 0.8rem;
    color: var(--DarkTextColor);
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Table Section */
main.match-details .table-container {
    padding: 20px;
    background: var(--CardBackgroundColor);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

main.match-details .table-container h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--TextDefaultColor);
}

/* ── Standings header: league logo + name + full-table link ── */
main.match-details .standings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

main.match-details .standings-league-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

main.match-details .standings-league-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

main.match-details .standings-league-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

main.match-details .standings-country {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--TextSecondColor);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.2;
}

main.match-details .standings-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--TextDefaultColor);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

main.match-details .standings-full-link {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary-color, #3b82f6);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 4px 10px;
    border: 1px solid var(--primary-color, #3b82f6);
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

main.match-details .standings-full-link:hover {
    background: var(--primary-color, #3b82f6);
    color: #fff;
}
/* ── end standings header ── */

main.match-details .full-standings-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

main.match-details .full-standings-table .small-column {
    width: 40px;
    text-align: center;
}

main.match-details .full-standings-table .column {
    width: auto;
    flex-direction: row;
}

main.match-details .full-standings-table .form-column {
    width: 120px;
    text-align: center;
}

main.match-details .full-standings-table thead tr.title th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--DarkTextColor);
    padding: 6px 8px;
    text-align: center;
}

main.match-details .full-standings-table thead tr.title th.team {
    text-align: left;
}

/* Base row style - layout only, no background here */
main.match-details .full-standings-table tbody tr {
    transition: background 0.2s;
    cursor: pointer;
}

/* Base row style */
main.match-details .full-standings-table tbody tr.row {
    background: var(--FooterBackgroundColor);
    cursor: pointer;
    transition: background 0.2s;
}

/* Rank Highlights - using !important to guarantee visibility */
main.match-details .full-standings-table tbody tr.rank-1 {
    background: rgba(34, 197, 94, 0.15) !important; /* Green */
}

main.match-details .full-standings-table tbody tr.rank-2,
main.match-details .full-standings-table tbody tr.rank-3 {
    background: rgba(59, 130, 246, 0.15) !important; /* Blue */
}

main.match-details .full-standings-table tbody tr.rank-relegation {
    background: rgba(239, 68, 68, 0.15) !important; /* Red */
}

/* Hover effects for ALL rows - Overrides !important ranks */
main.match-details .full-standings-table tbody tr:hover {
    background: var(--DarkCardBackgroundColor) !important;
}

main.match-details .full-standings-table tbody tr td {
    padding: 10px 8px;
    font-size: 0.85rem;
}

main.match-details .full-standings-table tbody tr td:first-child {
    border-radius: 8px 0 0 8px;
}

main.match-details .full-standings-table tbody tr td:last-child {
    border-radius: 0 8px 8px 0;
}

main.match-details .full-standings-table .team {
    display: flex;
    align-items: center;
    gap: 8px;
}

main.match-details .full-standings-table .team img {
    width: 18px;
    height: 18px;
}

/* Form Boxes */
main.match-details .form-boxes {
    display: flex;
    gap: 4px;
    justify-content: center;
}

main.match-details .form-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--LightTextColor);
}

main.match-details .form-box.W {
    background: var(--WinColor);
}

main.match-details .form-box.D {
    background: var(--DrawColor);
}

main.match-details .form-box.L {
    background: var(--LossColor);
}

/* Lineup Section Styling */
main.match-details .lineup-page-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

main.match-details .team-lineup-container {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e5e5e5;
}

main.match-details .team-lineup-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

main.match-details .lineup-team-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

main.match-details .lineup-team-name {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

main.match-details .starting-players h4,
main.match-details .bench-players h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #555;
}

main.match-details .starting-players {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e5e5;
}

main.match-details .bench-players {
    margin-top: 20px;
}

main.match-details .players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

main.match-details .lineup-player-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    background: #fafafa;
    transition: background 0.2s;
}

main.match-details .lineup-player-card:hover {
    background: #f0f0f0;
}

main.match-details .lineup-player-image {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

main.match-details .player-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

main.match-details .player-number {
    font-size: 12px;
    font-weight: bold;
    color: #666;
}

main.match-details .player-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

main.match-details .player-position {
    font-size: 11px;
    color: #888;
    font-weight: 500;
    background: #e5e5e5;
    padding: 2px 6px;
    border-radius: 4px;
    align-self: flex-start;
}

/* Head-to-Head Section Styling */
main.match-details .h2h-container {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e5e5e5;
}

main.match-details .h2h-stats-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e5e5;
}

main.match-details .h2h-stats-row {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 16px;
}

main.match-details .h2h-team-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

main.match-details .h2h-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    /* flex: 1; */
    border: 1px solid var(--border-color);
    border-radius: 34px;
    padding: .4rem 1.8rem;
}

/* Home team wins (Arsenal) - Green */
main.match-details .h2h-stat-item.home {
    background: var(--WinColor);
    border-color: var(--WinColor);
}

main.match-details .h2h-stat-item.home .h2h-stat-number,
main.match-details .h2h-stat-item.home .h2h-stat-label {
    color: #ffffff;
}

/* Draws - Yellow */
main.match-details .h2h-stat-item.draw {
    background: var(--DrawColor);
    border-color: var(--DrawColor);
}

main.match-details .h2h-stat-item.draw .h2h-stat-number,
main.match-details .h2h-stat-item.draw .h2h-stat-label {
    color: #ffffff;
}

/* Away team wins (Chelsea) - Red */
main.match-details .h2h-stat-item.away {
    background: var(--LossColor);
    border-color: var(--LossColor);
}

main.match-details .h2h-stat-item.away .h2h-stat-number,
main.match-details .h2h-stat-item.away .h2h-stat-label {
    color: #ffffff;
}

main.match-details .h2h-stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

main.match-details .h2h-stat-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
}

main.match-details .h2h-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

main.match-details .h2h-filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background: #ffffff;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

main.match-details .h2h-filter-btn:hover {
    background: #f8f9fa;
    border-color: #d0d0d0;
}

main.match-details .h2h-filter-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: #ffffff;
}

main.match-details .filter-btn-logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

main.match-details .h2h-matches-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* H2H Loading State */
main.match-details .h2h-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

main.match-details .h2h-loading .loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e5e5e5;
    border-top-color: var(--accent-color, #1a73e8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* H2H Error State */
main.match-details .h2h-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

main.match-details .h2h-error i {
    color: #ff6b6b;
    font-size: 18px;
}

/* H2H No Data State */
main.match-details .h2h-no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 50px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

main.match-details .h2h-no-data i {
    font-size: 32px;
    color: #ccc;
}

main.match-details .h2h-match-item {
    display: grid;
    grid-template-columns: 80px 1fr 120px;
    align-items: center;
    padding: 12px;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    background: #fafafa;
    gap: 16px;
    transition: background 0.2s;
}

main.match-details .h2h-match-item:hover {
    background: #f0f0f0;
}

main.match-details .h2h-match-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

main.match-details .match-date {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

main.match-details .match-year {
    font-size: 11px;
    color: #888;
}

main.match-details .h2h-match-details {
    flex: 1;
}

main.match-details .h2h-match-teams {
    display: flex;
    align-items: center;
    gap: 8px;
}

main.match-details .h2h-home-team,
main.match-details .h2h-away-team {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

/* Home side: logo left, name right-aligned toward center */
main.match-details .h2h-home-team {
    justify-content: flex-end;
    flex-direction: row;
}

/* Away side: name left-aligned from center, logo right */
main.match-details .h2h-away-team {
    justify-content: flex-start;
    /* flex-direction: row-reverse; */
}

main.match-details .h2h-match-teams .team-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

main.match-details .h2h-match-teams .team-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

main.match-details .h2h-score-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    width: 70px;
}

main.match-details .h2h-status-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--TextSecondColor, #888);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1;
}

main.match-details .h2h-match-score {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 18px;
    min-width: 60px;
}

/* Score colors based on result */
main.match-details .h2h-match-score.win {
    background: var(--WinColor);
    border-color: var(--WinColor);
}

main.match-details .h2h-match-score.win .score {
    color: #ffffff;
}

main.match-details .h2h-match-score.loss {
    background: var(--LossColor);
    border-color: var(--LossColor);
}

main.match-details .h2h-match-score.loss .score {
    color: #ffffff;
}

main.match-details .h2h-match-score.draw {
    background: var(--DrawColor);
    border-color: var(--DrawColor);
}

main.match-details .h2h-match-score.draw .score {
    color: #ffffff;
}

main.match-details .h2h-match-score .score {
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

main.match-details .h2h-match-league {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

main.match-details .league-name {
    font-size: 11px;
    color: #666;
    text-align: center;
    font-weight: 500;
}

main.match-details .h2h-match-league .league-logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

/* Responsive Design */
@media (max-width: 1600px) {
    main.match-details .lineup-teams {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 1200px) {
    main.match-details .main-content {
        width: 85%;
    }
}

@media (max-width: 768px) {
    main.match-details .main-content {
        width: 96%;
    }

    main.match-details .header-top {
        padding: 16px;
    }

    main.match-details .league-round {
        font-size: 1.1rem;
    }

    main.match-details .match-score-section {
        padding: 24px 16px;
        flex-direction: column;
        gap: 24px;
    }

    main.match-details .team {
        flex-direction: row;
        width: 100%;
        justify-content: center;
    }

    main.match-details .home-team {
        flex-direction: row-reverse;
    }

    main.match-details .team-logo {
        width: 48px;
        height: 48px;
    }

    main.match-details .team-name {
        font-size: 1rem;
    }

    main.match-details .home-score,
    main.match-details .away-score {
        font-size: 2rem;
    }

    main.match-details .separator {
        font-size: 1.5rem;
    }

    main.match-details .match-navigation {
        padding: 0 12px;
    }

    main.match-details .match-navigation .nav-link {
        padding: 12px 8px;
        font-size: 0.9rem;
    }

    main.match-details .table-container {
        padding: 1rem;
    }

    main.match-details .full-standings-table {
        font-size: 0.75rem;
    }

    main.match-details .full-standings-table .team img {
        width: 14px;
        height: 14px;
    }

    /* Hide W, D, L, Last 5 columns on mobile */
    main.match-details .full-standings-table thead tr.title th:nth-child(4),
    main.match-details .full-standings-table thead tr.title th:nth-child(5),
    main.match-details .full-standings-table thead tr.title th:nth-child(6),
    main.match-details .full-standings-table thead tr.title th:nth-child(9) {
        display: none;
    }

    main.match-details .full-standings-table tbody tr td:nth-child(4),
    main.match-details .full-standings-table tbody tr td:nth-child(5),
    main.match-details .full-standings-table tbody tr td:nth-child(6),
    main.match-details .full-standings-table tbody tr td:nth-child(9) {
        display: none;
    }

    /* Overview Grid - Stack on mobile */
    main.match-details .overview-grid {
        grid-template-columns: 1fr;
    }

    main.match-details .event-row {
        grid-template-columns: 1fr 50px 1fr;
        gap: 8px;
    }

    main.match-details .event-player {
        font-size: 0.8rem;
    }

    /* Lineup Section Responsive */
    main.match-details .lineup-page-container {
        gap: 16px;
    }
    
    main.match-details .team-lineup-container {
        padding: 16px;
    }
    
    main.match-details .players-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    main.match-details .lineup-player-card {
        padding: 10px;
    }
    
    main.match-details .lineup-team-name {
        font-size: 16px;
    }
    
    main.match-details .starting-players h4,
    main.match-details .bench-players h4 {
        font-size: 15px;
    }

    /* Head-to-Head Responsive */
    main.match-details .h2h-container {
        padding: 16px;
    }
    
    main.match-details .h2h-stats-row {
        gap: 8px;
    }
    
    main.match-details .h2h-team-logo {
        width: 28px;
        height: 28px;
    }
    
    main.match-details .h2h-stat-number {
        font-size: 20px;
    }
    
    main.match-details .h2h-stat-label {
        font-size: 11px;
    }
    
    main.match-details .h2h-filters {
        gap: 8px;
    }
    
    main.match-details .h2h-filter-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    main.match-details .h2h-match-item {
        grid-template-columns: 70px 1fr 100px;
        gap: 12px;
        padding: 10px;
    }
    
    main.match-details .h2h-match-teams .team-name {
        font-size: 12px;
    }
    
    main.match-details .league-name {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    main.match-details .team-lineup-container {
        padding: 12px;
    }
    
    main.match-details .lineup-player-card {
        padding: 8px;
    }
    
    main.match-details .player-name {
        font-size: 12px;
    }
    
    main.match-details .lineup-team-logo {
        width: 24px;
        height: 24px;
    }

    /* Head-to-Head Mobile */
    main.match-details .h2h-container {
        padding: 12px;
    }
    
    main.match-details .h2h-stats-row {
        gap: 4px;
    }
    
    main.match-details .h2h-team-logo {
        width: 24px;
        height: 24px;
    }
    
    main.match-details .h2h-stat-number {
        font-size: 18px;
    }
    
    main.match-details .h2h-stat-label {
        font-size: 10px;
    }
    
    main.match-details .h2h-filter-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    main.match-details .filter-btn-logo {
        width: 16px;
        height: 16px;
    }
    
    main.match-details .h2h-match-item {
        grid-template-columns: 60px 1fr 80px;
        gap: 8px;
        padding: 8px;
    }
    
    main.match-details .h2h-match-teams {
        gap: 8px;
    }
    
    main.match-details .h2h-match-teams .team-name {
        font-size: 11px;
    }
    
    main.match-details .h2h-match-teams .team-logo {
        width: 18px;
        height: 18px;
    }
    
    main.match-details .h2h-match-score {
        padding: 2px 8px;
        min-width: 50px;
    }
    
    main.match-details .h2h-match-score .score {
        font-size: 12px;
    }
    
    main.match-details .league-name {
        font-size: 9px;
    }
    
    main.match-details .h2h-match-league .league-logo {
        width: 16px;
        height: 16px;
    }
}

/* ========== Squad Loading & Display Styles ========== */

/* Squad Content Container */
main.match-details .squad-content {
    padding: 15px 0;
}

/* Loading State */
main.match-details .squad-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 15px;
}

main.match-details .squad-loading p {
    color: #666;
    font-size: 14px;
}

main.match-details .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e5e5;
    border-top-color: var(--accent-color, #1a73e8);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error State */
main.match-details .squad-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 10px;
    color: #888;
}

main.match-details .squad-error i {
    font-size: 32px;
    color: #ccc;
}

main.match-details .squad-error p {
    font-size: 14px;
}

/* Squad Group */
main.match-details .squad-group {
    margin-bottom: 20px;
}

main.match-details .squad-group:last-child {
    margin-bottom: 0;
}

main.match-details .squad-group-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e5e5;
    text-transform: capitalize;
}

/* Coach Group Styling */
main.match-details .squad-group.coach-group .players-grid.coach-grid {
    grid-template-columns: 1fr;
    max-width: 300px;
}

main.match-details .squad-group.coach-group .lineup-player-card {
    background: linear-gradient(135deg, #f5f5f5 0%, #ebebeb 100%);
    border-color: #ddd;
}

/* Injured Player Styling */
main.match-details .lineup-player-card.injured {
    opacity: 0.7;
    background: #fff5f5;
    border-color: #ffdddd;
}

main.match-details .injury-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ff6b6b;
    color: white;
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: 4px;
}

main.match-details .injury-badge i {
    font-size: 9px;
}

/* Player Stats in Card */
main.match-details .player-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    margin-left: auto;
    font-size: 10px;
}

main.match-details .player-rating {
    background: #4caf50;
    color: white;
    padding: 2px 5px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 11px;
}

main.match-details .player-goals,
main.match-details .player-assists {
    color: #666;
    display: flex;
    align-items: center;
    gap: 3px;
}

main.match-details .player-goals i,
main.match-details .player-assists i {
    font-size: 9px;
    color: #888;
}

/* Mobile Responsive for Squad */
@media (max-width: 768px) {
    main.match-details .lineup-page-container {
        flex-direction: column;
    }
    
    main.match-details .squad-group.coach-group .players-grid.coach-grid {
        max-width: 100%;
    }
    
    main.match-details .player-stats {
        display: none;
    }
}

/* ========== Standings Table Styles ========== */

/* Standings Loading State */
main.match-details .standings-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

main.match-details .standings-loading .loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e5e5e5;
    border-top-color: var(--accent-color, #1a73e8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Standings Error State */
main.match-details .standings-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

main.match-details .standings-error i {
    color: #ccc;
    font-size: 18px;
}

/* Qualification Color Indicators */
main.match-details .full-standings-table tr.qual-champions td:first-child {
    border-left: 3px solid #2AD572;
}

main.match-details .full-standings-table tr.qual-europa td:first-child {
    border-left: 3px solid #0046A7;
}

main.match-details .full-standings-table tr.qual-relegation td:first-child {
    border-left: 3px solid #FF4646;
}

/* Deduction Indicator */
main.match-details .deduction {
    font-size: 10px;
    color: #ff6b6b;
    margin-left: 4px;
}

main.match-details .full-standings-table tr.qual-champions td {
    background: #42ff913b;
}

/* ========== EMPTY / NO-DATA STATES ========== */

/* Generic empty state block used across all sections */
main.match-details .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    text-align: center;
    color: var(--SecondaryTextColor, #888);
    min-height: 120px;
}

main.match-details .empty-state svg {
    width: 48px;
    height: 48px;
    opacity: 0.3;
    flex-shrink: 0;
}

main.match-details .empty-state .empty-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--DarkTextColor, #555);
    margin: 0;
}

main.match-details .empty-state .empty-sub {
    font-size: 0.8rem;
    color: var(--SecondaryTextColor, #aaa);
    margin: 0;
    max-width: 260px;
    line-height: 1.5;
}

/* Generic .no-data pill used inline */
main.match-details .no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    color: var(--SecondaryTextColor, #999);
    font-size: 0.85rem;
    text-align: center;
}

/* Mini no-data for squad lists */
main.match-details .no-data-mini {
    padding: 20px 10px;
    text-align: center;
    color: var(--SecondaryTextColor, #aaa);
    font-size: 0.75rem;
    font-style: italic;
}

/* ========== RESPONSIVE — base improvements ========== */

/* Wider usage on mid-size screens */
@media (max-width: 1024px) {
    main.match-details .main-content {
        width: 92%;
    }

    main.match-details .overview-grid {
        grid-template-columns: 55% 45%;
    }
}

/* ========== RESPONSIVE — tablet & below (768px) improvements ========== */

/* Nav: make tabs scrollable instead of tiny */
@media (max-width: 768px) {
    main.match-details .match-navigation {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
    }

    main.match-details .match-navigation::-webkit-scrollbar {
        display: none;
    }

    main.match-details .match-navigation .nav-link {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 12px 16px;
        font-size: 0.85rem;
    }

    /* Header league name truncates gracefully */
    main.match-details .league-round {
        font-size: 0.95rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: calc(100vw - 100px);
    }

    /* Score row stacks: home — score — away in a row on mobile */
    main.match-details .match-score-section {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        padding: 20px 16px;
        gap: 8px;
    }

    main.match-details .team {
        flex: 0 0 auto;
        flex-direction: column;
        width: auto;
        max-width: 36%;
    }

    main.match-details .home-team,
    main.match-details .away-team {
        flex-direction: column;
    }

    main.match-details .team-logo {
        width: 44px;
        height: 44px;
    }

    main.match-details .team-name {
        font-size: 0.78rem;
        text-align: center;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    main.match-details .home-score,
    main.match-details .away-score {
        font-size: 2.2rem;
    }

    main.match-details .score-display {
        flex: 0 0 auto;
    }

    /* Overview grid stacks */
    main.match-details .overview-grid {
        grid-template-columns: 1fr;
    }

    /* Form match content wraps */
    main.match-details .form-match-content {
        gap: 6px;
    }

    main.match-details .form-team .team-name-small {
        font-size: 0.72rem;
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* H2H overview stats: shrink team names */
    main.match-details .h2h-overview-team-name {
        font-size: 0.72rem;
        max-width: 56px;
    }

    /* H2H tab team stat blocks */
    main.match-details .h2h-team-stat .h2h-team-name {
        max-width: 64px;
        font-size: 0.75rem;
    }

    main.match-details .h2h-team-stat .h2h-stat-number {
        font-size: 22px;
    }

    /* H2H filter buttons scroll horizontally */
    main.match-details .h2h-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    main.match-details .h2h-filter-btn {
        flex: 0 0 auto;
    }

    /* Standings table: hide W D L on mobile, keep PL GD PTS */
    main.match-details .full-standings-table thead tr.title th:nth-child(4),
    main.match-details .full-standings-table thead tr.title th:nth-child(5),
    main.match-details .full-standings-table thead tr.title th:nth-child(6) {
        display: none;
    }

    main.match-details .full-standings-table tbody tr td:nth-child(4),
    main.match-details .full-standings-table tbody tr td:nth-child(5),
    main.match-details .full-standings-table tbody tr td:nth-child(6) {
        display: none;
    }

    /* Full-width cards */
    main.match-details .card {
        border-radius: 8px;
    }

    /* Empty state smaller padding */
    main.match-details .empty-state {
        padding: 32px 16px;
    }
}

/* ========== RESPONSIVE — small phones (480px) ========== */
@media (max-width: 480px) {
    main.match-details .main-content {
        width: 100%;
        padding: 8px 0;
    }

    main.match-details .match-details-container {
        gap: 8px;
    }

    main.match-details .header-top {
        padding: 12px;
        gap: 10px;
    }

    main.match-details .back-btn {
        width: 34px;
        height: 34px;
        flex-shrink: 0;
    }

    main.match-details .league-icon {
        width: 24px;
        height: 24px;
    }

    main.match-details .league-round {
        font-size: 0.82rem;
    }

    main.match-details .match-score-section {
        padding: 16px 12px;
    }

    main.match-details .team-logo {
        width: 36px;
        height: 36px;
    }

    main.match-details .team-name {
        font-size: 0.7rem;
        max-width: 80px;
    }

    main.match-details .home-score,
    main.match-details .away-score {
        font-size: 1.8rem;
    }

    main.match-details .separator {
        font-size: 1.2rem;
    }

    main.match-details .match-navigation .nav-link {
        padding: 10px 12px;
        font-size: 0.78rem;
    }

    /* Lineup player cards: single column */
    main.match-details .players-grid {
        grid-template-columns: 1fr;
    }

    main.match-details .lineup-player-card {
        padding: 8px 10px;
    }

    main.match-details .lineup-player-image {
        width: 32px;
        height: 32px;
    }

    main.match-details .player-number {
        font-size: 0.7rem;
        min-width: 18px;
    }

    /* H2H match item: tighter layout */
    main.match-details .h2h-match-item {
        grid-template-columns: 52px 1fr;
        gap: 8px;
        padding: 8px;
    }

    main.match-details .h2h-match-league {
        display: none;
    }

    main.match-details .h2h-match-teams .team-name {
        font-size: 0.7rem;
    }

    main.match-details .h2h-match-teams .team-logo {
        width: 16px;
        height: 16px;
    }

    main.match-details .h2h-match-score .score {
        font-size: 0.78rem;
    }

    main.match-details .h2h-stats-row {
        gap: 4px;
    }

    main.match-details .h2h-team-stat .h2h-team-name {
        display: none; /* very small screen: hide name, keep logo + number */
    }

    main.match-details .h2h-team-stat.home .h2h-stat-number,
    main.match-details .h2h-team-stat.away .h2h-stat-number {
        font-size: 20px;
    }

    /* Standings table: only #, Team, PTS visible */
    main.match-details .full-standings-table thead tr.title th:nth-child(3),
    main.match-details .full-standings-table thead tr.title th:nth-child(7) {
        display: none;
    }

    main.match-details .full-standings-table tbody tr td:nth-child(3),
    main.match-details .full-standings-table tbody tr td:nth-child(7) {
        display: none;
    }

    main.match-details .full-standings-table {
        font-size: 0.72rem;
    }

    main.match-details .table-team-logo {
        width: 16px;
        height: 16px;
    }

    main.match-details .table-team-name {
        font-size: 0.72rem;
    }

    /* Forms */
    main.match-details .team-switch-btn {
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    /* Empty state */
    main.match-details .empty-state {
        padding: 24px 12px;
        gap: 8px;
    }

    main.match-details .empty-state svg {
        width: 36px;
        height: 36px;
    }
}