/**
 * Football-specific styles
 */

/* Team Profile Styles */
.team-profile {
    max-width: 100%;
}

.team-header {
    margin-bottom: 2rem;
}

.team-info {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.team-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
}

.team-details h1 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.team-country,
.team-founded,
.team-venue {
    color: var(--text-light);
    margin: 0.25rem 0;
}

/* League Intro */
.league-intro {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    border-radius: 8px;
    font-size: 1.125rem;
    line-height: 1.8;
}

.league-intro p {
    margin: 0;
}

.league-intro strong {
    font-weight: 600;
}

.league-intro em {
    font-style: italic;
}

/* Team Intro */
.team-intro {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    border-radius: 8px;
    font-size: 1.125rem;
    line-height: 1.8;
}

.team-intro p {
    margin: 0;
}

.team-intro strong {
    font-weight: 600;
}

.team-intro em {
    font-style: italic;
}

/* Team Content */
.team-content {
    margin-bottom: 2rem;
}

.team-content h2,
.team-content h3 {
    color: var(--primary-color);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.team-content h2:first-child,
.team-content h3:first-child {
    margin-top: 0;
}

.team-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.team-content strong {
    font-weight: 600;
    color: var(--primary-color);
}

.team-content em {
    font-style: italic;
}

.team-data-section {
    margin-top: 2rem;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 4px;
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-card {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 8px;
}

.stat-card .stat-value {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Matches List */
.matches-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.match-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

.match-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.match-team {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.team-logo-small {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.match-score {
    font-weight: bold;
    font-size: 1.125rem;
    color: var(--primary-color);
}

.vs {
    color: var(--text-light);
}

.match-date {
    font-size: 0.875rem;
    color: var(--text-light);
}

.match-status {
    margin-top: 0.5rem;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-finished {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-scheduled {
    background: #e3f2fd;
    color: #1976d2;
}

.status-live {
    background: #ffebee;
    color: #c62828;
}

/* League Table Styles */
.league-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

/* Ensure table actually overflows on small screens (so horizontal scroll appears) */
.league-table {
    min-width: 780px;
}

/* Align contents consistently across columns */
.league-table th,
.league-table td {
    vertical-align: middle;
}

.league-table td {
    line-height: 1.2;
}

.league-table .team-cell {
    /* Keep <td> as a table-cell (don't use flex on td) */
    display: table-cell;
}

.league-table .team-cell-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.league-table .team-logo-small {
    display: block; /* remove baseline gap that can make the cell look "taller" */
}

.league-table .team-link {
    color: inherit;
    text-decoration: none;
}

.league-table .team-link:hover,
.league-table .team-link:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 768px) {
    .league-table-wrapper {
        overflow-x: scroll;
    }

    /* Sticky first columns (Pos + Team logo) while horizontally scrolling */
    .league-table th.pos-col,
    .league-table td.pos-col {
        position: sticky;
        left: 0;
        z-index: 4;
        background: #ffffff;
        min-width: 56px;
        width: 56px;
        border-right: 1px solid var(--border-color);
        background-clip: padding-box;
    }

    .league-table thead th.pos-col {
        background: var(--bg-light);
        z-index: 6;
    }

    .league-table th.team-col,
    .league-table td.team-cell {
        position: sticky;
        left: 56px;
        z-index: 3;
        background: #ffffff;
        min-width: 64px;
        width: 64px;
        border-right: 1px solid var(--border-color);
        background-clip: padding-box;
    }

    .league-table thead th.team-col {
        background: var(--bg-light);
        z-index: 5;
    }

    /* Keep hover background consistent for sticky cells */
    .data-table tr:hover td.pos-col,
    .data-table tr:hover td.team-cell {
        background: var(--bg-light);
    }

    /* Keep highlight background consistent for sticky cells */
    .league-table tbody tr.highlight-row td.pos-col,
    .league-table tbody tr.highlight-row td.team-cell {
        background: #f0f7ff;
    }

    /* Only show logo in the sticky "Time" column on mobile */
    .league-table .team-cell img + .team-name-text {
        display: none;
    }

    .league-table .team-cell-inner {
        justify-content: center;
        gap: 0;
    }

    .league-table .team-logo-small {
        width: 28px;
        height: 28px;
    }

}

.team-cell {
    /* Default (non league-table) usage */
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.points-cell {
    font-weight: bold;
    color: var(--primary-color);
}

.league-table tbody tr.highlight-row {
    background: #f0f7ff;
    border-left: 3px solid #0b63ce;
}

.league-table tbody tr.highlight-row td.pos-col {
    color: #0b63ce;
    font-weight: 700;
    background: #f0f7ff;
    box-shadow: inset 3px 0 0 0 #0b63ce;
}

.league-table tbody tr.highlight-row td.team-cell {
    font-weight: 700;
}

.league-table td.form-cell {
    /* Keep <td> as a real table-cell; use inner wrapper for flex */
    display: table-cell;
}

.form-cell-inner {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.form-badge {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

.form-badge.win {
    background: #4caf50;
    color: white;
}

.form-badge.draw {
    background: #ff9800;
    color: white;
}

.form-badge.loss {
    background: #f44336;
    color: white;
}

.api-updated-notice {
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: #6b7280;
    text-align: left;
}

/* Betting Review Styles */
.betting-review {
    max-width: 100%;
}

.review-facts {
    margin-bottom: 2rem;
}

.review-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.review-logo {
    width: 120px;
    height: auto;
    object-fit: contain;
}

.review-title-section h1 {
    margin-bottom: 0.5rem;
}

.review-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.star {
    font-size: 1.5rem;
    color: #ffd700;
}

.star.empty {
    color: #ddd;
}

.star.half {
    opacity: 0.5;
}

.rating-value {
    font-weight: bold;
    margin-left: 0.5rem;
}

.review-facts-table {
    width: 100%;
    border-collapse: collapse;
}

.review-facts-table th {
    text-align: left;
    padding: 0.75rem;
    width: 200px;
    font-weight: 600;
    color: var(--primary-color);
}

.review-facts-table td {
    padding: 0.75rem;
}

.review-facts-table tr {
    border-bottom: 1px solid var(--border-color);
}

.review-content {
    margin: 2rem 0;
}

.review-pros-cons {
    margin: 2rem 0;
}

.pros-cons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.pros-section h2,
.cons-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.pros-list,
.cons-list {
    list-style: none;
    padding: 0;
}

.pros-list li,
.cons-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.pros-list li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #4caf50;
    font-weight: bold;
}

.cons-list li:before {
    content: "✗";
    position: absolute;
    left: 0;
    color: #f44336;
    font-weight: bold;
}

.review-faq {
    margin: 2rem 0;
}

.review-faq h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.faq-list {
    margin: 0;
}

.faq-list dt {
    font-weight: 600;
    margin-top: 1rem;
    color: var(--primary-color);
}

.faq-list dd {
    margin-left: 0;
    margin-bottom: 1rem;
    padding-left: 1rem;
    border-left: 3px solid var(--border-color);
}

/* Archive Styles */
.reviews-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.review-card {
    transition: transform 0.3s, box-shadow 0.3s;
}

.review-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.review-thumbnail {
    margin-bottom: 1rem;
}

.review-thumbnail img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.review-rating-preview {
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.review-rating-preview .star {
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .team-info {
        flex-direction: column;
        text-align: center;
    }
    
    .review-header {
        flex-direction: column;
        text-align: center;
    }
    
    .pros-cons-grid {
        grid-template-columns: 1fr;
    }
    
    .match-teams {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .reviews-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Pagination ===== */
.aof-pagination {
    margin: 2rem 0 1rem;
    display: flex;
    justify-content: center;
}

.aof-pagination-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.aof-pagination-item {
    margin: 0;
}

.aof-pagination-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.75rem;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    background: var(--white, #fff);
    color: var(--text-dark, #333);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.aof-pagination-link:hover {
    background: var(--primary-color, #1a5f7a);
    border-color: var(--primary-color, #1a5f7a);
    color: var(--white, #fff);
}

.aof-pagination-link.current {
    background: var(--primary-color, #1a5f7a);
    border-color: var(--primary-color, #1a5f7a);
    color: var(--white, #fff);
    cursor: default;
}

.aof-pagination-ellipsis span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    color: var(--text-light, #666);
    font-size: 0.875rem;
}

.aof-pagination-prev .aof-pagination-link,
.aof-pagination-next .aof-pagination-link {
    gap: 0.375rem;
}

/* Mobile: hide prev/next text, just show arrows */
@media (max-width: 480px) {
    .aof-pagination-prev-text,
    .aof-pagination-next-text {
        display: none;
    }

    .aof-pagination-link {
        min-width: 2rem;
        height: 2rem;
        padding: 0 0.5rem;
        font-size: 0.8125rem;
    }
}

/* ===== Player Statistics Lists ===== */
.player-stats-list {
    margin-bottom: 0;
}

/* Reduce gap between player stats widget and next sidebar widget */
.sidebar-widget:has(.player-stats-list) {
    margin-bottom: -0.75rem;
}

.player-stats-title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark, #333);
}

.player-stats-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.player-stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem;
    background: var(--white, #fff);
    border-radius: 8px;
    border: 1px solid var(--border-color, #e0e0e0);
    transition: box-shadow 0.2s ease;
}

.player-stat-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.player-stat-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--primary-color, #1a5f7a);
    color: var(--white, #fff);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Top 3 special styling */
.player-stat-item:nth-child(1) .player-stat-rank {
    background: linear-gradient(135deg, #ffd700, #f0c800);
    color: #333;
}

.player-stat-item:nth-child(2) .player-stat-rank {
    background: linear-gradient(135deg, #c0c0c0, #a8a8a8);
    color: #333;
}

.player-stat-item:nth-child(3) .player-stat-rank {
    background: linear-gradient(135deg, #cd7f32, #b87333);
    color: #fff;
}

.player-stat-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-light, #f5f5f5);
}

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

.player-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color, #1a5f7a);
    color: var(--white, #fff);
    font-size: 1rem;
    font-weight: 600;
}

.player-stat-info {
    flex: 1;
    min-width: 0;
}

.player-stat-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dark, #333);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-stat-team {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.125rem;
    font-size: 0.75rem;
    color: var(--text-light, #666);
}

.player-stat-team .team-logo-mini {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.player-stat-value {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    padding: 0.25rem 0.5rem;
    min-width: 2.5rem;
}

.player-stat-value .stat-number {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-color, #1a5f7a);
    line-height: 1;
}

.player-stat-value .stat-label {
    font-size: 0.625rem;
    color: var(--text-light, #666);
    text-transform: uppercase;
    margin-top: 0.125rem;
}

/* Full size variant (for main content) */
.player-stats-full .player-stat-item {
    padding: 0.875rem 1rem;
}

.player-stats-full .player-stat-photo {
    width: 48px;
    height: 48px;
}

.player-stats-full .player-stat-name {
    font-size: 0.9375rem;
}

.player-stats-full .player-stat-value .stat-number {
    font-size: 1.375rem;
}

/* Compact size variant (for sidebar) */
.player-stats-compact .player-stat-item {
    padding: 0.5rem;
    gap: 0.5rem;
}

.player-stats-compact .player-stat-photo {
    width: 32px;
    height: 32px;
}

.player-stats-compact .player-stat-rank {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.6875rem;
}

.player-stats-compact .player-stat-name {
    font-size: 0.8125rem;
}

.player-stats-compact .player-stat-value .stat-number {
    font-size: 1rem;
}

/* Mobile: full width for sidebar player stats */
@media (max-width: 768px) {
    /* Reduce sidebar widget padding on mobile for more space */
    .sidebar-widget:has(.player-stats-list) {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .player-stats-compact .player-stat-item {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .player-stats-compact .player-stat-photo {
        width: 36px;
        height: 36px;
    }

    .player-stats-compact .player-stat-name {
        font-size: 0.875rem;
    }

    .player-stats-compact .player-stat-value .stat-number {
        font-size: 1.125rem;
    }
}

/* Stats grid for multiple categories on same page */
.player-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .player-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Team Player Stats Section (on team statistics page) */
.team-player-stats-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.team-player-stats-section .section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary, #1f2937);
}

.team-player-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .team-player-stats-grid {
        grid-template-columns: 1fr;
    }
}

.team-player-stats-card {
    background: var(--bg-secondary, #f9fafb);
    border-radius: 0.5rem;
    padding: 1rem;
    border: 1px solid var(--border-color, #e5e7eb);
}

.team-player-stats-list {
    display: flex;
    flex-direction: column;
}

.team-player-stats-title {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    color: var(--text-primary, #1f2937);
}

.team-player-stats-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.team-player-stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: var(--bg-primary, #fff);
    border-radius: 0.375rem;
    border: 1px solid var(--border-color, #e5e7eb);
}

.team-player-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-secondary, #f3f4f6);
}

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

.team-player-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
    background: var(--bg-secondary, #e5e7eb);
}

.team-player-info {
    flex: 1;
    min-width: 0;
}

.team-player-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-player-games {
    font-size: 0.6875rem;
    color: var(--text-muted, #6b7280);
}

.team-player-value {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.team-player-value .stat-number {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-color, #10b981);
    line-height: 1;
}

.team-player-value .stat-label {
    font-size: 0.625rem;
    color: var(--text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* ============================
   Form Badges (Match Form V/E/D)
   ============================ */

.match-form-value {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-team-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.form-team-name {
    font-weight: 500;
    min-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.form-badges {
    display: inline-flex;
    gap: 0.25rem;
    align-items: center;
}

.form-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
}

.form-badge.form-win {
    background-color: #22c55e;
}

.form-badge.form-draw {
    background-color: #f59e0b;
}

.form-badge.form-loss {
    background-color: #ef4444;
}

@media (max-width: 480px) {
    .form-team-name {
        min-width: 60px;
        max-width: 100px;
        font-size: 0.875rem;
    }

    .form-badge {
        width: 1.25rem;
        height: 1.25rem;
        font-size: 0.625rem;
    }
}
