* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #1a1a2e;
    color: #eaeaea;
    min-height: 100vh;
}

.page-header {
    background: #16213e;
    padding: 16px 24px;
    border-bottom: 1px solid #2d2d44;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: #4a9eff;
}

.date-range {
    font-size: 13px;
    color: #8b8b9e;
}

.container {
    display: grid;
    grid-template-columns: 220px 150px minmax(360px, 1.2fr) minmax(460px, 1.6fr);
    height: calc(100vh - 57px);
}

.column {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #2d2d44;
    overflow: hidden;
}

.column:last-child {
    border-right: none;
}

.column-header {
    padding: 16px;
    background: #16213e;
    border-bottom: 1px solid #2d2d44;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.column-header h2 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8b8b9e;
}

#matches-count {
    font-size: 12px;
    color: #6b6b80;
}

#league-search {
    width: 100%;
    padding: 8px 12px;
    margin-top: 10px;
    border: 1px solid #2d2d44;
    border-radius: 6px;
    background: #0f0f1a;
    color: #eaeaea;
    font-size: 13px;
}

#league-search:focus {
    outline: none;
    border-color: #4a9eff;
}

.column-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #6b6b80;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

/* League Items */
.league-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 4px;
}

.league-item:hover {
    background: #252540;
}

.league-item.selected {
    background: #2d4a7c;
}

.league-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.league-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.league-fav-btn {
    border: none;
    background: transparent;
    color: #7e87a8;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    padding: 0;
}

.league-fav-btn:hover {
    color: #ffd166;
}

.league-fav-btn.active {
    color: #ffd166;
}

.league-info {
    font-size: 12px;
    color: #8b8b9e;
}

.match-count {
    color: #4a9eff;
    margin-left: 8px;
}

.hint {
    font-size: 11px;
    color: #4a9eff;
    font-weight: 400;
}

/* Season Items */
.season-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 4px;
}

.season-item:hover {
    background: #252540;
}

.season-item.selected {
    background: #2d4a7c;
}

.season-name {
    font-size: 13px;
    font-weight: 500;
}

.season-info {
    font-size: 11px;
    color: #6b6b80;
    margin-top: 2px;
}

/* Match Items */
.match-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 4px;
    background: #1e1e32;
}

.match-item:hover {
    background: #252540;
}

.match-item.selected {
    background: #2d4a7c;
}

.match-item.upcoming {
    border-left: 3px solid #4a9eff;
}

.match-item.upcoming .score {
    background: #2d4a7c;
    color: #4a9eff;
}

.match-date {
    font-size: 11px;
    color: #6b6b80;
    margin-bottom: 6px;
}

.match-teams {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
}

.home-team, .away-team {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-team {
    text-align: left;
    padding-right: 8px;
}

.away-team {
    text-align: right;
    padding-left: 8px;
}

.score {
    padding: 2px 10px;
    background: #0f0f1a;
    border-radius: 4px;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

.match-round {
    font-size: 11px;
    color: #6b6b80;
    margin-top: 6px;
}

/* Stats Content */
#stats-content {
    padding: 16px;
}

.match-header {
    text-align: center;
    padding: 20px;
    background: #252540;
    border-radius: 12px;
    margin-bottom: 20px;
}

.match-title {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-size: 18px;
    font-weight: 600;
}

.final-score {
    font-size: 24px;
    background: #4a9eff;
    color: #fff;
    padding: 6px 16px;
    border-radius: 8px;
}

.match-meta {
    margin-top: 10px;
    font-size: 13px;
    color: #8b8b9e;
}

.stats-section {
    margin-bottom: 20px;
}

.stats-section h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #4a9eff;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #2d2d44;
}

.comparison-grid {
    background: #1e1e32;
    border-radius: 8px;
    overflow: hidden;
}

.comp-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    padding: 10px 16px;
    border-bottom: 1px solid #252540;
}

.comp-row:last-child {
    border-bottom: none;
}

.comp-row.header {
    background: #252540;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #8b8b9e;
}

.comp-row.header div:first-child {
    text-align: left;
}

.comp-row.header div:last-child {
    text-align: right;
}

.comp-row div:first-child {
    text-align: right;
    padding-right: 16px;
    font-weight: 500;
}

.comp-row div:last-child {
    text-align: left;
    padding-left: 16px;
    font-weight: 500;
}

.metric-label {
    color: #8b8b9e;
    font-size: 12px;
    min-width: 80px;
    text-align: center;
}

.better {
    color: #4aff8a;
    font-weight: 600;
}

/* Scrollbar Styling */
.column-content::-webkit-scrollbar {
    width: 6px;
}

.column-content::-webkit-scrollbar-track {
    background: transparent;
}

.column-content::-webkit-scrollbar-thumb {
    background: #3d3d5c;
    border-radius: 3px;
}

.column-content::-webkit-scrollbar-thumb:hover {
    background: #4d4d6c;
}

/* Metric Popup Chart */
.metric-label {
    cursor: pointer;
    transition: color 0.2s;
}

.metric-label:hover {
    color: #4a9eff;
}

.metric-popup {
    position: absolute;
    background: #1e1e32;
    border: 1px solid #2d2d44;
    border-radius: 8px;
    padding: 12px;
    width: 324px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: none;
}

.metric-popup.visible {
    display: block;
}

.metric-popup-title {
    font-size: 11px;
    color: #4a9eff;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-popup-subtitle {
    font-size: 11px;
    color: #c6c6d8;
    margin-bottom: 8px;
}

.metric-legend {
    display: flex;
    gap: 12px;
    font-size: 10px;
    color: #8b8b9e;
    margin-bottom: 8px;
}

.metric-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot.home {
    background: #4a9eff;
}

.legend-dot.away {
    background: #4aff8a;
}

.metric-popup canvas {
    display: block;
}

.metric-popup-close {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 14px;
    color: #6b6b80;
    cursor: pointer;
    line-height: 1;
}

.metric-popup-close:hover {
    color: #fff;
}

/* Clickable metric values */
.clickable-metric {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}

.clickable-metric:hover {
    color: #4a9eff !important;
}

/* Goal time panel */
.goal-times-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.goal-team-column {
    background: #1e1e32;
    border-radius: 10px;
    padding: 10px;
}

.goal-team-title {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #d7d7e7;
    margin-bottom: 8px;
}

.goal-profile-card {
    background: #252540;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.goal-profile-card:last-child {
    margin-bottom: 0;
}

.goal-profile-title {
    background: #2f2f50;
    color: #d7d7e7;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-align: center;
    padding: 7px 8px;
}

.goal-matches {
    color: #8b8b9e;
    text-transform: none;
    letter-spacing: 0;
}

.goal-no-data {
    text-align: center;
    color: #8b8b9e;
    font-size: 12px;
    padding: 12px;
}

.goal-segment-row {
    display: grid;
    grid-template-columns: 46px 1fr 1fr;
    gap: 8px;
    padding: 7px 10px;
    border-bottom: 1px solid #33335a;
    align-items: center;
}

.goal-segment-label {
    color: #c6c6d8;
    font-size: 11px;
    font-weight: 600;
}

.goal-gfga-pair {
    display: grid;
    grid-template-columns: 20px 24px 1fr;
    gap: 6px;
    align-items: center;
}

.goal-token {
    font-size: 10px;
    color: #a2a2b8;
    font-weight: 600;
}

.goal-val {
    font-size: 11px;
    color: #f2f2f7;
    font-weight: 600;
    text-align: right;
}

.goal-bar-box {
    height: 8px;
    background: #1a1a2e;
    border-radius: 999px;
    overflow: hidden;
}

.goal-bar {
    height: 100%;
    min-width: 1px;
}

.goal-bar.gf {
    background: #2dbd59;
}

.goal-bar.ga {
    background: #e34f4f;
}

.goal-half-row {
    display: grid;
    grid-template-columns: 60px 1fr 1fr;
    gap: 8px;
    align-items: center;
    padding: 7px 10px;
    border-bottom: 1px solid #33335a;
    font-size: 11px;
}

.goal-half-row:last-child {
    border-bottom: none;
}

.goal-half-label {
    color: #c6c6d8;
    font-weight: 600;
}

.goal-half-stats {
    color: #f2f2f7;
}

.goal-pct {
    margin-left: 6px;
    font-weight: 600;
}

.goal-pct.gf {
    color: #4aff8a;
}

.goal-pct.ga {
    color: #ff8e8e;
}

@media (max-width: 900px) {
    .goal-times-wrap {
        grid-template-columns: 1fr;
    }
}

.window-tabs {
    display: flex;
    gap: 8px;
    padding: 8px 0;
}

.window-tab {
    padding: 6px 16px;
    border: 1px solid #2d2d44;
    background: #1a1a2e;
    color: #8b8b9e;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.window-tab:hover {
    border-color: #4a9eff;
    color: #4a9eff;
}

.window-tab.active {
    background: #4a9eff;
    border-color: #4a9eff;
    color: #fff;
}

/* Compact layout for category metric tables beside delta charts */
.compact-metrics .comp-row {
    grid-template-columns: max-content auto max-content;
    justify-content: center;
    column-gap: 12px;
    min-height: 34px;
    padding: 8px 8px;
    align-items: center;
}

.compact-metrics .comp-row div:first-child,
.compact-metrics .comp-row div:last-child {
    padding: 0;
}

.compact-metrics .metric-label {
    min-width: 0;
}

.delta-html-chart {
    background: #111625;
    border-radius: 8px;
    overflow: hidden;
}

.delta-row {
    display: grid;
    grid-template-columns: 56px 1fr 56px;
    align-items: center;
    min-height: 34px;
    padding: 8px 8px;
    border-bottom: 1px solid #252540;
}

.delta-row:last-child { border-bottom: none; }

.delta-code {
    font-size: 10px;
    color: #a8b4d8;
}

.delta-val {
    font-size: 10px;
    color: #a8b4d8;
    text-align: right;
}

.delta-track {
    position: relative;
    height: 16px;
}

.delta-mid {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    background: #2a3350;
}

.delta-bar {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 2px;
}

.delta-bar.home {
    right: 50%;
    background: #4aff8a;
}

.delta-bar.away {
    left: 50%;
    background: #ff7a7a;
}

.delta-empty {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8b8b9e;
    font-size: 12px;
}
