/* Stats-spesifikk CSS */

.filter-bar { display: flex; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-bar select { padding: 0.4rem 0.6rem; border: 1px solid var(--gray-300); border-radius: 4px; font-size: 0.85rem; background: #fff; }

.stats-nav {
    position: sticky; top: 0; z-index: 10; background: #fff;
    display: flex; gap: 0.25rem; padding: 0.5rem 0; margin-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-200); overflow-x: auto;
}
.stats-nav a { padding: 0.35rem 0.75rem; border-radius: 4px; font-size: 0.8rem; font-weight: 500; color: var(--gray-700); text-decoration: none; white-space: nowrap; }
.stats-nav a:hover { background: var(--gray-100); }
.stats-nav a.active { background: var(--primary); color: #fff; }

.stats-section { margin-bottom: 2rem; }
.stats-section h2 { border-bottom: 2px solid var(--primary); padding-bottom: 0.4rem; margin-bottom: 0.75rem; font-size: 1.1rem; }

.widget { background: #fff; padding: 0.75rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.widget h3 { margin-bottom: 0.4rem; font-size: 0.9rem; }
.widget .data-table { font-size: 0.8rem; box-shadow: none; }
.widget .data-table th { padding: 0.35rem 0.5rem; }
.widget .data-table td { padding: 0.3rem 0.5rem; }
.widget-error { background: #fef2f2; color: var(--danger); padding: 0.5rem; border-radius: var(--radius); margin-bottom: 0.75rem; font-size: 0.8rem; }

/* Horizontal bars */
.hbar-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.2rem; padding: 0.15rem 0; }
.hbar-name { min-width: 160px; font-size: 0.8rem; line-height: 1.3; }
.hbar-name .sub { display: inline; color: var(--gray-500); font-size: 0.7rem; }
.hbar-name .sub::before { content: ' · '; }
.hbar-track { flex: 1; height: 16px; background: var(--gray-100); border-radius: 3px; overflow: hidden; display: flex; }
.hbar-track.stacked { background: transparent; }
.hbar-fill { height: 100%; background: var(--primary-light); border-radius: 3px; transition: width 0.3s; }
.fill-assist { background: var(--accent); }
.fill-defense { background: var(--danger); }
.fill-spectators { background: #8b5cf6; }
.fill-age { background: #06b6d4; }
.hbar-val { min-width: 60px; font-size: 0.75rem; font-weight: 600; text-align: right; }

/* Stacked segments */
.stack-seg { height: 100%; display: inline-block; }
.stack-yellow { background: #facc15; }
.stack-orange { background: #f97316; }
.stack-red { background: #ef4444; }
.stack-darkred { background: #991b1b; }
.stack-blue { background: #3b82f6; }
.stack-purple { background: #8b5cf6; }

/* Pct grid (7m specialists) */
.pct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 0.5rem; }
.pct-card { text-align: center; padding: 0.4rem; }
.pct-card .pct-circle { width: 56px; height: 56px; margin: 0 auto 0.3rem; }
.pct-card .pct-circle::before { width: 42px; height: 42px; }
.pct-card .pct-circle span { font-size: 0.7rem; }
.pct-name { font-size: 0.75rem; font-weight: 500; line-height: 1.2; }
.pct-detail { font-size: 0.65rem; color: var(--gray-500); }

/* Medal list */
.medal-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0; border-bottom: 1px solid var(--gray-100); }
.medal-row.gold { background: linear-gradient(90deg, #fef3c7, transparent); }
.medal-row.silver { background: linear-gradient(90deg, #f3f4f6, transparent); }
.medal-row.bronze { background: linear-gradient(90deg, #fde68a40, transparent); }
.medal-pos { width: 24px; text-align: center; font-weight: 700; font-size: 0.8rem; color: var(--gray-500); }
.medal-icon { width: 18px; height: 18px; border-radius: 50%; display: inline-block; }
.medal-gold { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.medal-silver { background: linear-gradient(135deg, #d1d5db, #9ca3af); }
.medal-bronze { background: linear-gradient(135deg, #d97706, #92400e); }
.medal-name { flex: 1; font-size: 0.8rem; }
.medal-name .sub { display: inline; color: var(--gray-500); font-size: 0.7rem; }
.medal-name .sub::before { content: ' · '; }
.medal-count { font-weight: 700; font-size: 0.95rem; color: var(--primary); }

/* Highlight cards (clutch) */
.highlight-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.5rem; }
.highlight-card { background: linear-gradient(135deg, #eff6ff, #dbeafe); padding: 0.6rem; border-radius: var(--radius); text-align: center; }
.hl-count { font-size: 1.4rem; font-weight: 800; color: var(--primary); line-height: 1; }
.hl-name { font-size: 0.75rem; font-weight: 500; margin-top: 0.2rem; }

/* Trophy list (first goal) */
.trophy-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.2rem 0; border-bottom: 1px solid var(--gray-100); }
.trophy-icon { font-size: 0.9rem; color: #f59e0b; }
.trophy-name { flex: 1; font-size: 0.8rem; }
.trophy-name .sub { display: inline; color: var(--gray-500); font-size: 0.7rem; }
.trophy-name .sub::before { content: ' · '; }
.trophy-count { font-weight: 700; color: var(--primary); font-size: 0.85rem; }

/* Match cards */
.match-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.5rem; }
.match-cards.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.match-card-sm { display: block; background: var(--gray-50); padding: 0.6rem; border-radius: var(--radius); text-decoration: none; color: inherit; border: 1px solid var(--gray-200); transition: border-color 0.15s; }
.match-card-sm:hover { border-color: var(--primary-light); text-decoration: none; }
.mc-teams { font-size: 0.7rem; font-weight: 500; margin-bottom: 0.15rem; }
.mc-score { font-size: 1.1rem; font-weight: 800; color: var(--primary); }
.mc-total { font-size: 0.7rem; color: var(--accent); font-weight: 600; }
.mc-date { font-size: 0.65rem; color: var(--gray-500); }

/* Split cards (home/away) */
.split-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.5rem; }
.split-card { background: var(--gray-50); padding: 0.6rem; border-radius: var(--radius); border: 1px solid var(--gray-200); }
.split-name { font-weight: 500; font-size: 0.8rem; margin-bottom: 0.3rem; }
.split-bars { display: flex; gap: 0.3rem; }
.split-home, .split-away { flex: 1; padding: 0.25rem; border-radius: 3px; text-align: center; font-size: 0.75rem; font-weight: 600; }
.split-home { background: rgba(37, 99, 235, 0.1); color: var(--home-color); }
.split-away { background: rgba(220, 38, 38, 0.1); color: var(--away-color); }

/* Shot type map (pct cells) */
.pct-cell { display: inline-block; padding: 0.15rem 0.4rem; border-radius: 3px; font-weight: 600; font-size: 0.75rem; }
.pct-high { background: #dcfce7; color: #166534; }
.pct-mid { background: #fef3c7; color: #92400e; }
.pct-low { background: #fee2e2; color: #991b1b; }

/* Sanction badges */
.sanc-badge { display: inline-block; padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.7rem; font-weight: 700; color: #fff; }
.sanc-yellow { background: #facc15; color: #78350f; }
.sanc-orange { background: #f97316; }
.sanc-red { background: #ef4444; }
.sanc-darkred { background: #991b1b; }

/* Colored column headers for sanctions */
th.sanc-col-yellow { border-bottom: 3px solid #facc15 !important; }
th.sanc-col-orange { border-bottom: 3px solid #f97316 !important; }
th.sanc-col-red { border-bottom: 3px solid #ef4444 !important; }
th.sanc-col-darkred { border-bottom: 3px solid #991b1b !important; }

/* Inline bar in table cell */
.bar-cell { width: 80px; padding-right: 0.5rem !important; }
.bar-inline { height: 12px; background: var(--primary-light); border-radius: 2px; min-width: 2px; }
.bar-inline.bar-assist { background: var(--accent); }

/* Medal row highlights in tables */
tr.medal-gold-row td:first-child { border-left: 3px solid #f59e0b; }
tr.medal-silver-row td:first-child { border-left: 3px solid #9ca3af; }
tr.medal-bronze-row td:first-child { border-left: 3px solid #92400e; }

/* Widget grid for side-by-side on desktop */
.widget-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.widget-grid .widget-full { grid-column: 1 / -1; }

/* Keeper — compact table instead of cards */
.keeper-cards { display: grid; gap: 0; }
.keeper-card {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.35rem 0; border-bottom: 1px solid var(--gray-100);
}
.keeper-card .pct-circle { width: 36px; height: 36px; flex-shrink: 0; }
.keeper-card .pct-circle::before { width: 26px; height: 26px; }
.keeper-card .pct-circle span { font-size: 0.55rem; }
.keeper-info { flex: 1; display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.keeper-name { font-weight: 600; font-size: 0.8rem; }
.keeper-detail { font-size: 0.7rem; color: var(--gray-500); }

/* Position badge */
.pos-badge { display: inline-block; padding: 0.1rem 0.4rem; background: var(--gray-100); border-radius: 3px; font-size: 0.7rem; font-weight: 600; }

/* Age distribution */
.age-distribution { display: flex; gap: 0.25rem; align-items: flex-end; height: 120px; }
.age-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.age-bar-fill { width: 100%; background: #06b6d4; border-radius: 2px 2px 0 0; min-height: 2px; }
.age-bar-val { font-size: 0.6rem; font-weight: 600; margin-bottom: 0.15rem; }
.age-bar-label { font-size: 0.6rem; margin-top: 0.15rem; }

@media (max-width: 768px) {
    .widget-grid { grid-template-columns: 1fr; }
    .hbar-name { min-width: 100px; }
    .stats-nav { gap: 0; }
    .pct-grid { grid-template-columns: repeat(3, 1fr); }
    .highlight-cards { grid-template-columns: repeat(3, 1fr); }
}
