/* ═══════════════════════════════════════════════════════════════
   match.css  —  SofaScore/Uniscore-style match detail page
   ═══════════════════════════════════════════════════════════════ */

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}
.bc-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}
.bc-inner a {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--accent-blue);
    font-weight: 600;
    text-decoration: none;
}
.bc-inner a:hover { text-decoration: underline; }
.bc-inner span::before { content: '›'; margin-right: 8px; }

/* ── Match Header ────────────────────────────────────────────── */
.match-header {
    background: linear-gradient(180deg, #181a1f 0%, var(--bg-page) 100%);
    border-bottom: 1px solid var(--border);
    padding: 28px 20px;
}
.mh-inner {
    max-width: 900px;
    margin: 0 auto;
}
.mh-loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}

/* League info */
.mh-league {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}
.mh-league img { width: 18px; height: 18px; object-fit: contain; }

/* Teams row */
.mh-teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}
.mh-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}
.mh-team-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}
.mh-team-name {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
}
.mh-team-form {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    justify-content: center;
}
.form-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.form-dot.W { background: var(--accent-green); }
.form-dot.D { background: #6b7280; }
.form-dot.L { background: var(--accent-red); }

/* Score block */
.mh-score-block {
    text-align: center;
    min-width: 120px;
}
.mh-score {
    font-size: 52px;
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}
.mh-score-dash { color: var(--text-secondary); font-weight: 400; }
.mh-status {
    margin-top: 6px;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 99px;
    display: inline-block;
}
.status-live {
    background: rgba(244,63,94,.15);
    color: var(--accent-red);
    animation: pulse-bg 2s infinite;
}
.status-ft   { background: rgba(107,114,128,.15); color: #9ca3af; }
.status-ns   { background: rgba(59,130,246,.15);  color: var(--accent-blue); }

@keyframes pulse-bg {
    0%, 100% { background: rgba(244,63,94,.15); }
    50%       { background: rgba(244,63,94,.28); }
}

/* Match meta row */
.mh-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}
.mh-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}
.mh-meta i { width: 14px; height: 14px; }

/* ── Tabs Bar ────────────────────────────────────────────────── */
.match-tabs-bar {
    background: var(--bg-card);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 58px; /* nav height */
    z-index: 100;
}
.tabs-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    overflow-x: auto;
}
.tab-btn {
    background: none;
    border: none;
    padding: 14px 20px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    transition: color .2s, border-color .2s;
    margin-bottom: -2px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

/* ── Match Body ──────────────────────────────────────────────── */
.match-body {
    max-width: 900px;
    margin: 24px auto;
    padding: 0 20px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Match Section card ──────────────────────────────────────── */
.match-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    overflow: hidden;
}
.ms-title {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    background: var(--bg-hover);
}

/* ── Events Timeline ─────────────────────────────────────────── */
.events-timeline {
    padding: 8px 0;
}
.events-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 13px;
}
.event-row {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}
.event-row:last-child { border-bottom: none; }
.event-row:hover { background: var(--bg-hover); }

/* Home events align left, away align right */
.event-row.home { flex-direction: row; }
.event-row.away { flex-direction: row-reverse; }

.event-min {
    min-width: 36px;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-secondary);
    background: var(--bg-hover);
    padding: 3px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}
.event-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.event-detail {
    flex: 1;
}
.event-player  { font-weight: 700; font-size: 13px; }
.event-assist  { font-size: 12px; color: var(--text-secondary); }
.event-row.away .event-detail { text-align: right; }

/* ── AI Prediction Bar ───────────────────────────────────────── */
.prediction-card { padding: 20px 16px; }
.pred-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
}
.pred-col { text-align: center; }
.pred-col.draw { text-align: center; }
.pred-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; margin-bottom: 8px; }
.pred-bar-wrap {
    background: var(--bg-hover);
    border-radius: 99px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 6px;
}
.pred-bar { height: 100%; border-radius: 99px; transition: width 1s ease; }
.home-bar { background: var(--accent-blue); }
.draw-bar { background: #6b7280; }
.away-bar { background: var(--accent-red); }
.pred-pct { font-size: 22px; font-weight: 900; }

/* ── Lineups ─────────────────────────────────────────────────── */
.lineups-container {
    padding: 16px;
}
.lineups-empty { text-align: center; padding: 40px; color: var(--text-secondary); }

/* Formation header */
.lineup-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 16px;
    text-align: center;
}
.lineup-team-name { font-weight: 800; font-size: 15px; }
.lineup-formation {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
}

/* Pitch */
.pitch-wrapper {
    position: relative;
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 20px;
}
.pitch-svg {
    width: 100%;
    display: block;
}

/* Player positions on pitch */
.pitch-players {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}
.pitch-player {
    position: absolute;
    transform: translate(-50%, -50%);
    text-align: center;
    cursor: pointer;
}
.pp-shirt {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    margin: 0 auto 3px;
    border: 2px solid rgba(255,255,255,0.3);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    transition: transform .2s;
}
.pp-shirt:hover { transform: scale(1.15); }
.pp-name {
    font-size: 9px;
    font-weight: 700;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 2px 4px;
    border-radius: 3px;
    white-space: nowrap;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Home team = blue, Away = red */
.pitch-player.home .pp-shirt { background: #1d4ed8; }
.pitch-player.away .pp-shirt { background: #be123c; }

/* Lineups list fallback */
.lineup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.lineup-col-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.lineup-col-title img { width: 18px; height: 18px; object-fit: contain; }
.lineup-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.lineup-player:last-child { border-bottom: none; }
.lp-number {
    width: 22px;
    height: 22px;
    background: var(--bg-hover);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-secondary);
}
.lp-pos {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    width: 20px;
    flex-shrink: 0;
}
.lp-name { flex: 1; font-weight: 600; }
.lp-rating {
    font-weight: 800;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
}
.rating-high { background: rgba(52,211,153,.15); color: var(--accent-green); }
.rating-med  { background: rgba(251,146,60,.15);  color: var(--accent-warning); }
.rating-low  { background: rgba(244,63,94,.15);   color: var(--accent-red); }

/* ── Statistics ──────────────────────────────────────────────── */
.stats-container { padding: 8px 0; }
.stats-empty { text-align: center; padding: 40px; color: var(--text-secondary); }

.stat-row {
    display: grid;
    grid-template-columns: 1fr 120px 1fr;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.stat-row:last-child { border-bottom: none; }
.stat-row:hover { background: var(--bg-hover); }

.stat-val {
    font-size: 14px;
    font-weight: 800;
}
.stat-home { text-align: right; color: var(--accent-blue); }
.stat-away { text-align: left;  color: var(--accent-red); }

.stat-label-wrap { text-align: center; }
.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 5px;
}
.stat-bars {
    display: flex;
    height: 4px;
    border-radius: 99px;
    overflow: hidden;
    background: var(--bg-hover);
}
.stat-bar-home {
    background: var(--accent-blue);
    border-radius: 99px 0 0 99px;
    transition: width 1s ease;
}
.stat-bar-away {
    background: var(--accent-red);
    border-radius: 0 99px 99px 0;
    transition: width 1s ease;
}

/* ── H2H ─────────────────────────────────────────────────────── */
.h2h-container { padding: 16px; }
.h2h-empty { text-align: center; padding: 40px; color: var(--text-secondary); }
.h2h-summary {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    text-align: center;
    padding: 16px;
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border: 1px solid var(--border);
}
.h2h-wins { font-size: 32px; font-weight: 900; }
.h2h-wins.home { color: var(--accent-blue); }
.h2h-wins.away { color: var(--accent-red); }
.h2h-label { font-size: 11px; color: var(--text-secondary); font-weight: 700; text-transform: uppercase; margin-top: 4px; }
.h2h-divider { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.h2h-draws { font-size: 22px; font-weight: 800; color: var(--text-secondary); }

.h2h-match {
    display: grid;
    grid-template-columns: 80px 1fr auto 1fr 80px;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.h2h-match:last-child { border-bottom: none; }
.h2h-date { font-size: 11px; color: var(--text-secondary); }
.h2h-team { font-weight: 600; }
.h2h-team.right { text-align: right; }
.h2h-score-box {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 10px;
    font-weight: 900;
    font-size: 15px;
    text-align: center;
    min-width: 56px;
}
.h2h-winner { color: var(--accent-green); }

/* ── Odds Table ──────────────────────────────────────────────── */
.odds-container { padding: 16px; }
.odds-note {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(59,130,246,.08);
    border: 1px solid rgba(59,130,246,.2);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.odds-market-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
    margin-top: 16px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.odds-source {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
}
.live-source {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.2);
}
.ai-source {
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.odds-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.odds-pill {
    flex: 1;
    min-width: 90px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    text-align: center;
    transition: border-color .2s, transform .15s;
    cursor: pointer;
}
.odds-pill:hover { border-color: var(--accent-blue); transform: translateY(-2px); }
.odds-pill-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 5px; font-weight: 600; }
.odds-pill-val { font-size: 18px; font-weight: 900; color: var(--accent-blue); }

/* ── Standings Table ────────────────────────────────────────── */
.standings-table-wrap { overflow-x: auto; padding: 12px; }
.standings-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.standings-table th { 
    text-align: center; 
    padding: 10px 8px; 
    color: var(--text-secondary); 
    font-size: 11px; 
    text-transform: uppercase; 
    border-bottom: 2px solid var(--border); 
}
.standings-table th:nth-child(2) { text-align: left; } /* Team column name */
.standings-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.st-rank { font-weight: 800; width: 40px; text-align: center; color: var(--text-secondary); }
.st-team { font-weight: 700; min-width: 140px; text-align: left; }
.st-logo { width: 22px; height: 22px; object-fit: contain; margin-right: 10px; vertical-align: middle; }
.st-name { vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; display: inline-block; }
.st-val { text-align: center; width: 45px; font-weight: 500; font-family: monospace; }
.st-pts { font-weight: 800; color: var(--accent-blue); text-align: center; width: 50px; }
.st-form { width: 100px; padding-left: 10px !important; }
.row-highlight { background: rgba(59, 130, 246, 0.08); border-left: 3px solid var(--accent-blue); }

/* Form dots in table */
.form-dots-mini { display: flex; gap: 3px; }
.form-dots-mini span { 
    width: 14px; height: 14px; border-radius: 3px; 
    font-size: 8px; display: flex; align-items: center; 
    justify-content: center; font-weight: 800; color: #fff;
}
.dot-w { background: var(--accent-green); }
.dot-d { background: #64748b; }
.dot-l { background: var(--accent-red); }

/* ── Improved H2H ───────────────────────────────────────────── */
.h2h-stat-box {
    background: rgba(255,255,255,0.03);
    padding: 12px;
    border-radius: 8px;
    flex: 1;
}
.h2h-stat-val { font-size: 24px; font-weight: 900; line-height: 1; }
.val-home { color: var(--accent-blue); }
.val-away { color: var(--accent-red); }
.h2h-match-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.h2h-match-date { font-size: 11px; color: var(--text-secondary); width: 60px; }
.h2h-match-teams { flex: 1; display: grid; grid-template-columns: 1fr 60px 1fr; align-items: center; text-align: center; gap: 10px; }
.h2h-match-team { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.h-team { justify-content: flex-end; }
.a-team { justify-content: flex-start; }
.h2h-match-team img { width: 20px; height: 20px; object-fit: contain; }
.h2h-match-score { font-weight: 800; font-family: monospace; font-size: 14px; background: var(--bg-hover); padding: 4px 8px; border-radius: 4px; }
.h2h-match-league { width: 100px; text-align: right; color: var(--text-secondary); font-size: 11px; }
.winning { color: var(--accent-green); font-weight: 800; }

/* Responsive Adjustments */
@media (max-width: 860px) {
    .mh-teams, .lineup-grid, .h2h-summary {
        grid-template-columns: 1fr !important;
        gap: 24px;
    }
    
    .h2h-match {
        grid-template-columns: 1fr auto 1fr !important;
        gap: 12px;
        padding: 12px 0;
    }
    .h2h-date, .h2h-match-league { display: none; }
    
    .mh-inner, .tabs-inner, .match-body { padding: 0 16px; }
    
    .mh-team-logo { width: 52px; height: 52px; }
    .mh-team-name  { font-size: 14px; }
    .mh-score      { font-size: 36px; }
    
    .stat-row {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 8px;
    }
    .stat-home, .stat-away { text-align: center; }
}
