/* =====================================================
   Team Page Styles - SoccerSeer V3 (Mackolik-style)
   ===================================================== */

/* Layout: Two columns */
.team-page-layout {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 14px;
    align-items: start;
}

/* ---- Hero Section ---- */
.team-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 10px;
}
.team-hero-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
}
.team-hero-info {
    flex: 1;
    min-width: 0;
}
.team-hero-info h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 2px;
}
.team-hero-meta {
    color: var(--text-muted);
    font-size: 11px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}
.team-hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.team-hero-meta i {
    color: var(--primary);
    font-size: 10px;
}
.team-hero-right {
    margin-left: auto;
    flex-shrink: 0;
}
.team-leagues {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}
.team-league-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(83,111,118,0.10);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    transition: all 0.2s;
}
.team-league-badge:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.team-league-badge i {
    font-size: 9px;
}
.season-select {
    padding: 5px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 12px;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
}
.season-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ---- Main Tabs ---- */
.team-tabs {
    display: flex;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}
.team-tab {
    flex: 1;
    padding: 9px 14px;
    background: transparent;
    border: none;
    border-right: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: all 0.15s;
    text-align: center;
}
.team-tab:last-child { border-right: none; }
.team-tab:hover { color: var(--primary); background: rgba(83,111,118,0.05); }
.team-tab.active { background: var(--gradient); color: #fff; }

/* Tab content */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Sub-tabs ---- */
.filter-tabs {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.filter-tab {
    padding: 4px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: all 0.15s;
}
.filter-tab:hover { border-color: var(--primary); color: var(--primary); }
.filter-tab.active { background: var(--gradient); border-color: transparent; color: #fff; }

/* ---- Match List ---- */
.matches-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

/* League header */
.match-league-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(0,0,0,0.3);
    font-size: 10px;
    font-weight: 600;
    color: #aaa;
}
[data-theme="light"] .match-league-header {
    background: #d5d8dd;
    color: #444;
}
.match-league-header a { color: inherit; text-decoration: none; }
.match-league-header a:hover { color: var(--primary); text-decoration: underline; }

/* Column headers */
.match-list-header {
    display: grid;
    grid-template-columns: 70px 1fr 54px 1fr 40px;
    padding: 4px 8px;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(83,111,118,0.04);
}
.match-list-header span { text-align: center; }
.match-list-header .mh-home { text-align: right; padding-right: 6px; }
.match-list-header .mh-away { text-align: left; padding-left: 6px; }

/* Match row - single line Mackolik style */
.match-row {
    display: grid;
    grid-template-columns: 70px 1fr 54px 1fr 40px;
    align-items: center;
    padding: 5px 8px;
    border-bottom: 1px solid var(--border-light);
    font-size: 11px;
    transition: background 0.12s;
    gap: 0;
}
.match-row:last-child { border-bottom: none; }
.match-row:hover { background: rgba(83,111,118,0.06); }

/* Result left-border */
.match-row.result-W { border-left: 3px solid #28a745; }
.match-row.result-D { border-left: 3px solid #ffc107; }
.match-row.result-L { border-left: 3px solid #dc3545; }
.match-row.result-S { border-left: 3px solid transparent; }

.match-row .m-date {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}
.match-row .m-home {
    text-align: right;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 6px;
}
.match-row .m-away {
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 6px;
}
.match-row .m-score {
    text-align: center;
    font-weight: 700;
    font-size: 12px;
    background: rgba(83,111,118,0.10);
    border-radius: 4px;
    padding: 3px 4px;
    white-space: nowrap;
}
.match-row .m-score.scheduled {
    font-weight: 500;
    font-size: 10px;
    background: rgba(83,111,118,0.06);
    color: var(--text-muted);
}
.match-row .m-ht {
    text-align: center;
    font-size: 9px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Upcoming separator */
.match-separator {
    padding: 3px 10px;
    font-size: 9px;
    color: var(--text-muted);
    background: rgba(83,111,118,0.05);
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ---- Stats Summary Bar ---- */
.team-stats-summary {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
}
.stat-box { text-align: center; padding: 4px 2px; }
.stat-box .stat-val { font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.stat-box .stat-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; }

/* ---- Statistics Tab ---- */
.stats-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}
.stats-section-title {
    font-size: 10px;
    font-weight: 700;
    padding: 6px 10px;
    background: rgba(83,111,118,0.08);
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border-color);
}
.stats-row {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    border-bottom: 1px solid var(--border-light);
    font-size: 11px;
}
.stats-row:last-child { border-bottom: none; }
.stats-row .sr-label {
    width: 110px;
    color: var(--text-muted);
    font-size: 10px;
    flex-shrink: 0;
}
.stats-row .sr-bar-wrap {
    flex: 1;
    display: flex;
    gap: 3px;
    align-items: center;
}
.stats-row .sr-bar {
    height: 16px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 600;
    color: #fff;
    min-width: 20px;
    transition: width 0.3s ease;
}
.sr-bar.win { background: #28a745; }
.sr-bar.draw { background: #ffc107; color: #333; }
.sr-bar.loss { background: #dc3545; }
.sr-bar.over { background: var(--primary); }
.sr-bar.under { background: #6c757d; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 6px;
    padding: 8px 10px;
}
.stats-grid-item {
    text-align: center;
    padding: 6px 4px;
    background: rgba(83,111,118,0.05);
    border-radius: 5px;
}
.stats-grid-item .sgi-val { font-size: 1rem; font-weight: 700; color: var(--primary); }
.stats-grid-item .sgi-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; }

/* Score distribution */
.score-dist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
    gap: 3px;
    padding: 8px 10px;
}
.score-dist-item {
    text-align: center;
    padding: 4px 2px;
    background: rgba(83,111,118,0.06);
    border-radius: 3px;
}
.score-dist-item .sd-score { font-weight: 700; font-size: 11px; }
.score-dist-item .sd-count { font-size: 9px; color: var(--text-muted); }

/* ---- Player Stats Table ---- */
.player-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.player-stats-table th {
    padding: 5px 6px;
    text-align: left;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-color);
    background: rgba(83,111,118,0.05);
    white-space: nowrap;
}
.player-stats-table td {
    padding: 4px 6px;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}
.player-stats-table tr:hover { background: rgba(83,111,118,0.04); }
.player-stats-table .player-name {
    font-weight: 500;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-stats-table td.num, .player-stats-table th.num { text-align: center; }

/* ---- Squad Tab ---- */
.squad-group-title {
    font-size: 10px;
    font-weight: 700;
    padding: 6px 10px;
    background: rgba(83,111,118,0.08);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border-color);
}
.squad-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.squad-table th {
    padding: 4px 6px;
    text-align: left;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-color);
    background: rgba(83,111,118,0.05);
}
.squad-table td {
    padding: 4px 6px;
    border-bottom: 1px solid var(--border-light);
}
.squad-table tr:hover { background: rgba(83,111,118,0.04); }
.squad-table td.num, .squad-table th.num { text-align: center; }
.squad-table td.pos-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.pos-badge.pos-gk  { color: #f39c12; }
.pos-badge.pos-df  { color: #3498db; }
.pos-badge.pos-mf  { color: #2ecc71; }
.pos-badge.pos-fw  { color: #e74c3c; }
[data-theme="light"] .pos-badge.pos-gk  { color: #d68910; }
[data-theme="light"] .pos-badge.pos-df  { color: #1a6fa8; }
[data-theme="light"] .pos-badge.pos-mf  { color: #1e8449; }
[data-theme="light"] .pos-badge.pos-fw  { color: #c0392b; }

/* ---- Sidebar Standings ---- */
.sidebar-standings {
    position: sticky;
    top: 10px;
}
.sidebar-standings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}
.sidebar-standings-title {
    font-size: 10px;
    font-weight: 700;
    padding: 6px 8px;
    background: rgba(83,111,118,0.08);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 5px;
}
.sidebar-standings-title a { color: var(--text-primary); text-decoration: none; }
.sidebar-standings-title a:hover { color: var(--primary); }
.sidebar-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
}
.sidebar-table th {
    padding: 3px 4px;
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 9px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-table th:nth-child(2) { text-align: left; }
.sidebar-table td {
    padding: 3px 4px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
}
.sidebar-table td:nth-child(2) {
    text-align: left;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-table .team-logo-sm {
    width: 14px;
    height: 14px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 2px;
}
.sidebar-table a { color: var(--text-primary); text-decoration: none; }
.sidebar-table a:hover { color: var(--primary); }
.sidebar-table tr.current-team { background: rgba(83,111,118,0.12); font-weight: 600; }
.sidebar-table tr.highlight { background: rgba(255,215,0,0.15); }

/* ---- Empty / Loading ---- */
.empty-msg {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}
.empty-msg i { display: block; font-size: 20px; margin-bottom: 6px; opacity: 0.5; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .team-page-layout { grid-template-columns: 1fr; }
    .sidebar-standings { position: static; }
}
@media (max-width: 768px) {
    .team-hero { padding: 10px; gap: 10px; }
    .team-hero-logo { width: 38px; height: 38px; }
    .team-hero-info h2 { font-size: 1rem; }
    .match-row {
        grid-template-columns: 56px 1fr 46px 1fr 34px;
        padding: 4px 5px;
        font-size: 10px;
    }
    .match-list-header {
        grid-template-columns: 56px 1fr 46px 1fr 34px;
        font-size: 8px;
    }
    .match-row .m-score { font-size: 10px; padding: 2px 3px; }
    .match-row .m-ht { font-size: 8px; }
    .filter-tabs { gap: 3px; padding: 5px 6px; }
    .filter-tab { padding: 3px 8px; font-size: 9px; }
    .team-stats-summary { grid-template-columns: repeat(3, 1fr); }
    .stats-row .sr-label { width: 70px; font-size: 9px; }
}
@media (max-width: 480px) {
    .team-hero { flex-wrap: wrap; }
    .team-hero-right { width: 100%; margin-left: 0; margin-top: 4px; }
    .team-tab { padding: 7px 4px; font-size: 10px; }
    .match-row {
        grid-template-columns: 48px 1fr 42px 1fr 30px;
        font-size: 9px;
    }
    .match-list-header {
        grid-template-columns: 48px 1fr 42px 1fr 30px;
    }
}
