/* =====================================================
   Playoff Bracket Page Styles
   Extends boxscore.css matchup card styles for bracket layout
   ===================================================== */

/* Page Header */
.playoff-bracket-header {
    margin-bottom: 1.5rem;
}

.playoff-bracket-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--phl-orange, #ef7b00);
    margin-bottom: 0;
}

/* Season Selector */
.season-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.season-selector label {
    font-weight: 600;
    color: var(--phl-text);
    margin-bottom: 0;
}

.season-selector select {
    min-width: 180px;
}

/* =====================================================
   Bracket Section Container
   ===================================================== */

.bracket-section {
    margin-bottom: 2.5rem;
}

/* Bracket section headers: L2 grammar (ink condensed + hairline),
   with a short accent bar carrying the bracket's semantic color —
   gold is reserved for championship contexts, loss-red for the BL. */
.bracket-section-header {
    border-bottom: 1px solid var(--phl-line);
    margin-bottom: 14px;
}

.bracket-section-header h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 22px;
    letter-spacing: 0.02em;
    color: var(--phl-ink);
    margin: 0;
    padding-bottom: 7px;
    position: relative;
    display: inline-block;
}

.bracket-section-header h2::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 44px;
    height: 3px;
}

.championship-section .bracket-section-header h2::after { background: var(--phl-gold); }
.loser-section .bracket-section-header h2::after { background: var(--phl-loss); }

/* =====================================================
   Bracket Container - Fixed Width with Horizontal Scroll
   ===================================================== */

.bracket-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
}

.bracket-container {
    display: flex;
    justify-content: center;
    min-width: 1150px;
    gap: 0.5rem;
    padding: 0.5rem;
}

/* =====================================================
   Bracket Columns
   ===================================================== */

.bracket-column {
    flex: 0 0 220px;
    display: flex;
    flex-direction: column;
}

/* Column headers always stay at top */
.bracket-column-header {
    flex-shrink: 0;
    margin-bottom: 0.5rem;
}

/* Matchups wrapper for vertical alignment */
.bracket-matchups {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

/* Round 1 (center) - 4 matchups, standard stacking at top */
.center-column .bracket-matchups {
    justify-content: flex-start;
}

/* Semifinals - 2 matchups, spaced to align with Round 1 pairs */
.bracket-column.round-2 .bracket-matchups {
    justify-content: space-around;
    /* Each semifinal centered between 2 first-round matchups */
    /* First-round matchup height ~95px + gap ~8px = ~103px per matchup */
    /* Two matchups = ~206px, center point at ~103px */
    padding-top: 47px;   /* Half of one matchup height to center */
    padding-bottom: 47px;
}

/* Finals - 1 matchup, centered vertically */
.bracket-column.round-3 .bracket-matchups {
    justify-content: center;
}

/* Consolation columns mirror the bracket alignment */
.bracket-column.consol-2 .bracket-matchups {
    justify-content: space-around;
    padding-top: 47px;
    padding-bottom: 47px;
}

.bracket-column.consol-3 .bracket-matchups {
    justify-content: space-around;
}

/* Column headers: L4 kicker register — quiet uppercase labels, semantic
   text color carries the flow direction, arrows kept, no colored boxes */
.bracket-column-header {
    text-align: center;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0 0 6px;
    background: none;
    border-radius: 0;
    border-bottom: 1px solid var(--phl-line-soft);
    color: var(--phl-muted);
    margin-bottom: 0.25rem;
}

/* Losers flow indicator */
.losers-column .bracket-column-header {
    color: var(--phl-loss);
}

.losers-column .bracket-column-header::before {
    content: "\2190\00a0";  /* Left arrow */
}

/* Winners flow indicator */
.winners-column .bracket-column-header::after {
    content: "\00a0\2192";  /* Right arrow */
}

.winners-column .bracket-column-header {
    color: var(--phl-win);
}

/* Center column (Round 1) */
.center-column .bracket-column-header {
    color: var(--phl-steel-deep);
}

/* =====================================================
   Bracket Matchup Box Overrides
   ===================================================== */

.bracket-matchup-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.bracket-matchup-link:hover {
    text-decoration: none;
    color: inherit;
}

.bracket-matchup-link:hover .matchup-card {
    border-color: var(--phl-blue, #4682b4);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

/* Bracket-specific matchup card sizing */
.bracket-matchup.matchup-card {
    width: 100%;
    min-height: 85px;
}

/* Compact team info for bracket view */
.bracket-matchup .team-info {
    max-width: 140px;
}

.bracket-matchup .owner-details {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bracket-matchup .owner-name {
    font-size: 0.65rem !important;
}

.bracket-matchup .owner-record {
    font-size: 0.6rem !important;
}

/* Score styling for live games */
.bracket-matchup .score.live-score {
    color: #4682b4;
    font-weight: 700;
}

/* Winner row highlight */
.bracket-matchup .team-row.winner {
    background-color: rgba(40, 167, 69, 0.08);
}

/* =====================================================
   Direction Labels (Losers/Winners)
   ===================================================== */

.direction-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
}

.direction-label {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--phl-faint);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.direction-label.losers::before {
    content: "\2190\00a0";
}

.direction-label.winners::after {
    content: "\00a0\2192";
}

/* =====================================================
   Empty State
   ===================================================== */

.bracket-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--phl-faint);
    font-style: italic;
    font-size: 12.5px;
    border: 1px dashed var(--phl-line);
    border-radius: 10px;
}

/* =====================================================
   Responsive Adjustments
   ===================================================== */

/* Show scroll hint on smaller screens */
@media (max-width: 1200px) {
    .bracket-wrapper {
        position: relative;
    }

    .bracket-wrapper::after {
        content: "\2194 Scroll to view full bracket";
        display: block;
        text-align: center;
        font-size: 0.75rem;
        color: var(--phl-muted);
        padding: 0.5rem;
        background: linear-gradient(to right, transparent, var(--phl-surface) 10%, var(--phl-surface) 90%, transparent);
    }
}

/* Compact mode for smaller screens */
@media (max-width: 768px) {
    .bracket-column {
        flex: 0 0 200px;
    }

    .bracket-container {
        min-width: 1050px;
    }

    .bracket-matchup .team-abv {
        font-size: 0.8rem;
    }

    .bracket-matchup .playoff-seed {
        font-size: 0.7rem;
    }
}

/* =====================================================
   Print Styles
   ===================================================== */

@media print {
    .bracket-wrapper {
        overflow: visible;
    }

    .bracket-container {
        min-width: auto;
    }

    .bracket-section {
        page-break-inside: avoid;
    }
}
