﻿.bracket-container {
    display: flex;
    flex-direction: row;
    gap: 16px;
    padding: 12px;
    align-items: stretch;
    position: relative;
    z-index: 1;
}

.losers-bracket-container {
    display: flex;
    gap: 28px;
    padding-top: 0px;
}

.bracket-column.loser {
    padding-top: 8px;
    padding-bottom: 8px;
}

    .bracket-column.loser .bracket-game {
        margin-top: 4px;
        margin-bottom: 4px;
    }

.bracket-scroll-container {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-color: #66aaff transparent;
    scrollbar-width: thin;
}

    .bracket-scroll-container::-webkit-scrollbar {
        height: 10px;
    }

    .bracket-scroll-container::-webkit-scrollbar-track {
        background: transparent;
    }

    .bracket-scroll-container::-webkit-scrollbar-thumb {
        background-color: #66aaff;
        border-radius: 6px;
        border: 2px solid transparent;
        background-clip: content-box;
    }

        .bracket-scroll-container::-webkit-scrollbar-thumb:hover {
            background-color: #3399ff;
        }

.bracket-wrapper {
    width: max-content;
    min-width: max-content;
    overflow: visible;
    margin: 0;
    position: relative;
}

.bracket-svg {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

    .bracket-svg path.animate-connector {
        animation: connectorBounce 0.4s ease-out;
    }

@keyframes connectorBounce {
    0% {
        stroke-dasharray: 4, 4;
        stroke-dashoffset: 8;
    }

    100% {
        stroke-dasharray: 0, 0;
        stroke-dashoffset: 0;
    }
}

.bracket-round {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    flex: 0 0 auto;
}

    .bracket-round.right-side {
        margin-left: -30px;
    }

    /* Round titles */
    .bracket-round .round-label {
        font-size: 14px;
        text-align: center;
        margin-bottom: 8px;
    }

    /* Key rounds centered */
    .bracket-round.final-column,
    .bracket-round.semifinal-column,
    .bracket-round.quarterfinal-column,
    .bracket-round.round16-column {
        justify-content: center;
        margin-top: auto;
        margin-bottom: auto;
    }

    /* Even vertical spacing for Round of 16 */
    .bracket-round.round16-column {
        justify-content: space-evenly;
        height: 100%;
    }

.bracket-game {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0px;
    margin: 0;
    width: 152px;
    transition: all 0.3s ease;
    cursor: pointer;
}

    .bracket-game:hover {
        background-color: #e6f0ff;
        border-color: #99c2ff;
    }

    .bracket-game,
    .bracket-game .team,
    .bracket-game .team-line {
        overflow: visible !important;
    }

        .bracket-game .team.advanced {
            background-color: #cce5ff;
            border-color: #3399ff;
            font-weight: 600;
            color: #003366;
        }

        .bracket-game .team {
            padding: 0.25rem 0.5rem;
            font-size: 0.9rem;
            border: 1px solid #ccc;
            border-radius: 4px;
            background-color: #fff;
            margin-bottom: 4px;
            display: flex;
            align-items: center;
        }

        .bracket-game .team-name {
            text-align: left;
            font-size: 0.95rem;
        }

        .bracket-game .seed {
            width: 16px;
            text-align: left;
            font-size: 0.6rem;
            font-weight: bold;
            /*color: #667 !important;*/
            padding-right: 4px;
        }

        .bracket-game .editable-team-input {
            background-color: #fff8e1;
            font-weight: bold;
            color: #423434 !important;
        }

        .bracket-game .char-count {
            font-size: 0.75rem;
            color: #666;
        }

            .bracket-game .char-count.limit-reached {
                color: #c00;
            }

        .bracket-game .text-muted {
            font-style: italic;
            font-size: 10px;
        }

        .bracket-game .team-line {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
        }

        .bracket-game .score-badge {
            border-radius: 4px;
            padding: 1px 5px;
            font-size: 0.64rem;
            font-weight: 600;
            color: white;
            margin-left: 6px;
            min-width: 18px;
            text-align: center;
            line-height: 1.1;
            box-shadow: inset 0 1px 1px rgba(0,0,0,0.06);
        }

        .bracket-game .score-winner {
            background-color: #198754;
        }

        .bracket-game .score-loser {
            background-color: #dc3545;
        }

        .bracket-game .team-box.won {
            position: relative;
            border: 2px solid #28a745 !important;
            box-shadow: 0 0 8px rgba(40, 167, 69, 0.4);
        }

            .bracket-game .team-box.won::after {
                content: "";
                position: absolute;
                inset: 0;
                background: rgba(40, 167, 69, 0.10);
                border-radius: inherit;
                pointer-events: none;
            }

        .bracket-game .team-box.picked {
            background-color: #b6d3fb !important;
            border: 2px solid #0d6efd !important;
            box-shadow: 0 0 8px rgba(13, 110, 253, 0.35);
        }

        .bracket-game .team-box.lost {
            background-color: #fbeaea;
            border: 1px solid #dc3545;
            opacity: 0.7;
            filter: grayscale(20%);
        }

        .bracket-game .team-box.faded {
            background-color: #f3f3f3;
            opacity: 0.6;
            border: 1px solid #ccc;
        }

        .bracket-game .points-earned {
            font-size: 0.6rem;
            padding: 1px 5px;
            background-color: indigo;
            color: white;
            border-radius: 3px;
            margin-left: 4px;
            opacity: 0.9;
        }

            .bracket-game .points-earned.bonus-style {
                border: 1px solid #ffc107;
                background-color: #4b0082;
                position: relative;
            }

                .bracket-game .points-earned.bonus-style::after {
                    content: "★";
                    font-size: 0.75rem;
                    position: absolute;
                    top: -6px;
                    right: -6px;
                    color: #ff4081;
                    font-weight: bold;
                    text-shadow: 0 0 2px black;
                }

        .bracket-game .bonus-points-summary {
            font-size: 0.65rem;
            text-align: center;
            color: #6c757d;
            margin-bottom: 2px;
        }

        .bracket-game .bonus-tooltip-wrapper {
            position: relative;
            display: inline-block;
            cursor: help;
            white-space: nowrap;
            overflow: visible;
            z-index: 5;
        }

            .bracket-game .bonus-tooltip-wrapper .bonus-tooltip {
                visibility: hidden;
                background-color: #333;
                color: #ffd700;
                text-align: center;
                padding: 6px 8px;
                border-radius: 6px;
                position: absolute;
                z-index: 9999;
                bottom: 125%;
                right: 0;
                left: auto;
                transform: none;
                opacity: 0;
                font-size: 0.65rem;
                white-space: nowrap;
                box-shadow: 0 0 6px rgba(0,0,0,0.3);
                transition: opacity 0.2s ease-in-out;
            }

            .bracket-game .bonus-tooltip-wrapper:hover .bonus-tooltip {
                visibility: visible;
                opacity: 1;
            }

        .bracket-game .team-logo {
            width: 18px;
            height: 18px;
            border-radius: 999px;
            object-fit: contain;
            margin-right: 4px;
            flex-shrink: 0;
        }

[data-theme-mode="dark"] .bracket-game .team {
    background-color: #222;
    border-color: #444;
    color: #eee;
}

[data-theme-mode="dark"] .bracket-game .seed {
    color: #bbb !important;
}

[data-theme-mode="dark"] .bracket-game .team-name {
    color: #f0f0f0;
}

[data-theme-mode="dark"] .bracket-game:hover {
    background-color: grey;
}

/* Team bubble styles */
.team {
    padding: 3px 5px;
    background-color: #e3f2fd;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 28px;
    margin-bottom: 4px;
}

    .team:hover {
        background-color: #e6f0ff;
        border-color: #99c2ff;
    }

    .team.advanced {
        background-color: #cce5ff;
        border-color: #3399ff;
        font-weight: 600;
        color: #003366;
    }

.team-label {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.team-record {
    font-size: 0.72rem;
    opacity: 0.8;
    text-align: left;
    align-self: flex-start;
    margin-left: 15px;
}

.game-score-summary {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    line-height: 1;
    color: #007bff;
    background: rgba(255,255,255,0.95);
    padding: 1px 6px;
    border-radius: 999px;
    white-space: nowrap;
    z-index: 5;
    pointer-events: none;
}

@media (max-width: 576px) {
    .team-record {
        display: none;
    }
}

.seed {
    width: 20px;
    text-align: left;
    font-size: 0.6rem;
}

.seed-toggle-wrapper .form-check-input {
    vertical-align: middle;
}

.seed-toggle-wrapper .form-check-label {
    font-size: 0.7rem;
    line-height: 1.2;
    margin-top: 5px;
}

/* Champion display */
.champion-box {
    animation: championGlow 1.5s ease-in-out infinite;
    border: 2px solid gold;
    background-color: #fffbe6;
    font-weight: bold;
    padding: 8px;
    width: 152px;
    border-radius: 12px;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
    font-size: 16px;
    min-height: 52px;
    text-align: center;
    margin: 12px auto 0 auto;
}

@keyframes championGlow {
    0% {
        box-shadow: 0 0 10px gold;
    }

    50% {
        box-shadow: 0 0 25px gold;
    }

    100% {
        box-shadow: 0 0 10px gold;
    }
}

.bracket-wrapper {
    position: relative;
}

[data-theme-mode="dark"] .champion-box {
    background-color: #1a1414;
}

.placeholder-text {
    color: #888;
    font-style: italic;
    font-size: 0.85rem;
}

.bracket-center {
    justify-content: center;
}

.final-four-box {
    position: absolute;
    top: 655px;
    left: 36%;
    width: 26%;
    height: 125px;
    border: 2px solid #dfdfdf;
    border-radius: 10px;
    z-index: 2;
    pointer-events: none;
}

.final-four-label {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background-color: white;
    padding: 2px 8px;
    font-weight: bold;
    font-size: 14px;
    color: #81b0d7;
    border: 1px solid #dddddd;
    border-radius: 5px;
    pointer-events: none;
    z-index: 3;
}

.champ-game-label {
    margin-bottom: -10px;
    font-size: 19px;
    color: rgb(38, 191, 148) !important;
    font-weight: bold;
}

@media (max-width: 390px) {
    /* styles here */
    .main-bracket.public-mobile-shift {
        margin-left: -12px;
    }
}

/* Phones only (Galaxy S20 etc) */
@media (max-width: 767px) {

    .main-bracket {
        min-width: 0;
        transform: none !important;
        margin-top: -50px;
    }

        .main-bracket.public-mobile-shift {
            margin-left: -24px;
        }

        .main-bracket .bracket-scroll-container {
            width: 100% !important;
            max-width: 100% !important;
            margin-left: 0 !important;
            margin-right: 0 !important;
            overflow-x: auto !important;
            overflow-y: hidden !important;
            -webkit-overflow-scrolling: touch;
        }

        .main-bracket .bracket-wrapper {
            margin: 0 !important;
            padding-left: 8px !important;
            padding-right: 20px !important;
            box-sizing: border-box;
        }

            .main-bracket .bracket-wrapper::after {
                content: "";
                display: inline-block;
                width: 20px;
                height: 1px;
            }
}

/* Phones around ~360x740 (Pixel / Galaxy size range) */
@media (max-width: 420px) and (max-height: 820px) {
    .main-bracket {
        transform: none !important;
        margin-top: -50px !important;
    }
}

/* iPad / tablet portrait */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .main-bracket {
        min-width: 0;
    }
        .main-bracket.public-mobile-shift {
            margin-left: -20px !important;
        }

        .main-bracket .bracket-scroll-container {
            width: 100% !important;
            max-width: 100% !important;
            margin-left: 0 !important;
            margin-right: 0 !important;
            overflow-x: auto !important;
            overflow-y: hidden !important;
            -webkit-overflow-scrolling: touch;
        }

        .main-bracket .bracket-wrapper {
            margin: 0 !important;
            padding-left: 16px !important;
            padding-right: 24px !important;
            box-sizing: border-box;
        }

            .main-bracket .bracket-wrapper::after {
                content: "";
                display: inline-block;
                width: 24px;
                height: 1px;
            }
}

/* iPad Pro landscape */
@media (min-width: 1025px) and (max-width: 1366px) and (orientation: landscape) {
    .main-bracket {
        min-width: 0;
    }

        .main-bracket .bracket-scroll-container {
            width: 100% !important;
            max-width: 100% !important;
            margin-left: 0 !important;
            margin-right: 0 !important;
            overflow-x: auto !important;
            overflow-y: hidden !important;
            -webkit-overflow-scrolling: touch;
        }

        .main-bracket .bracket-wrapper {
            margin: 0 !important;
            padding-left: 16px !important;
            padding-right: 24px !important;
            box-sizing: border-box;
        }

            .main-bracket .bracket-wrapper::after {
                content: "";
                display: inline-block;
                width: 24px;
                height: 1px;
            }
}

/* 13" MacBook Air / similar laptop widths */
@media (min-width: 1367px) and (max-width: 1510px) and (min-height: 900px) {
    .main-bracket {
        min-width: 0;
    }

        .main-bracket .bracket-scroll-container {
            overflow-x: auto !important;
            overflow-y: hidden !important;
            width: 100% !important;
            max-width: 100% !important;
            min-width: 0 !important;
            -webkit-overflow-scrolling: touch;
        }
}

@media (min-width: 1321px) and (max-width: 1335px) {
    .player-bracket-picks-page .bracket-scroll-container {
        overflow-x: auto !important;
        overflow-y: visible !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .player-bracket-picks-page #bracket-container {
        display: inline-block;
        min-width: max-content;
    }
}

.bracket-game {
    position: relative;
}

    .bracket-game .matchup-info-btn {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 60;
        width: 18px;
        height: 18px;
        border-radius: 999px;
        border: 1px solid #c8d3df;
        background: #ffffff;
        color: #4a6480;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        cursor: pointer;
        box-shadow: 0 1px 6px rgba(22, 34, 51, 0.10);
        transition: all 0.18s ease;
    }

        .bracket-game .matchup-info-btn:hover {
            background: #f6faff;
            border-color: #8fb3d9;
            color: #234d7c;
            box-shadow: 0 3px 10px rgba(35, 77, 124, 0.16);
        }

    .bracket-game .matchup-info-btn-left {
        right: -16px;
    }

    .bracket-game .matchup-info-btn-right {
        left: -16px;
    }

    .bracket-game .matchup-info-icon {
        width: 11px;
        height: 11px;
        fill: currentColor;
        display: block;
    }

    .bracket-game .matchup-info-popover {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 70;
        width: 220px;
        background: #ffffff;
        border: 1px solid #dbe5ef;
        border-radius: 12px;
        box-shadow: 0 12px 28px rgba(19, 37, 62, 0.18);
        overflow: hidden;
    }

    .bracket-game .matchup-info-popover-left {
        left: 168px;
    }

    .bracket-game .matchup-info-popover-right {
        right: 168px;
    }

    .bracket-game .matchup-info-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 7px 10px;
        background: linear-gradient(180deg, #f8fbff 0%, #f1f6fb 100%);
        border-bottom: 1px solid #e6edf5;
    }

    .bracket-game .matchup-info-title {
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.02em;
        color: #35506b;
        text-transform: uppercase;
    }

    .bracket-game .matchup-info-close {
        border: none;
        background: transparent;
        color: #72839a;
        font-size: 16px;
        line-height: 1;
        padding: 0;
        cursor: pointer;
    }

        .bracket-game .matchup-info-close:hover {
            color: #28496d;
        }

    .bracket-game .matchup-info-body {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 9px;
        background: #fcfdff;
    }

    .bracket-game .matchup-team-card {
        border: 1px solid #e8eef5;
        border-radius: 10px;
        background: #ffffff;
        padding: 8px;
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
    }

    .bracket-game .matchup-team-toprow {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
    }

    .bracket-game .matchup-team-logo {
        width: 24px;
        height: 24px;
        object-fit: contain;
        flex-shrink: 0;
    }

    .bracket-game .matchup-team-logo-placeholder {
        width: 24px;
        height: 24px;
        border-radius: 999px;
        background: #edf2f7;
        flex-shrink: 0;
    }

    .bracket-game .matchup-team-main {
        min-width: 0;
        flex: 1;
    }

    .bracket-game .matchup-team-name-row {
        display: flex;
        align-items: center;
        gap: 6px;
        min-width: 0;
    }

    .bracket-game .matchup-team-seed-pill {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 28px;
        height: 18px;
        padding: 0 6px;
        border-radius: 999px;
        background: #eef5fc;
        color: #35506b;
        font-size: 0.68rem;
        font-weight: 700;
        line-height: 1;
        flex-shrink: 0;
    }

    .bracket-game .matchup-team-name {
        font-size: 0.82rem;
        font-weight: 700;
        color: #1f2d3d;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .bracket-game .matchup-team-meta-stack {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        margin-top: 7px;
        padding-left: 32px;
    }

    .bracket-game .matchup-team-meta-line {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
    }

    .bracket-game .matchup-team-meta-line-ranks .matchup-meta-pill {
        margin-right: 0;
    }

    .bracket-game .matchup-meta-pill {
        display: inline-flex;
        align-items: center;
        height: 18px;
        padding: 0 7px;
        border-radius: 999px;
        background: #f4f7fa;
        color: #5a6b7f;
        font-size: 0.67rem;
        font-weight: 600;
        line-height: 1;
    }

    .bracket-game .matchup-meta-pill-rank {
        background: #fff4e5;
        color: #b35a00;
    }

    .bracket-game .matchup-meta-pill-net {
        background: #eefaf2;
        color: #1f7a46;
    }

[data-theme-mode="dark"] .bracket-game .matchup-info-btn {
    background: #2a2f36;
    border-color: #495463;
    color: #d7e2ef;
    box-shadow: 0 1px 6px rgba(0,0,0,0.35);
}

    [data-theme-mode="dark"] .bracket-game .matchup-info-btn:hover {
        background: #313844;
        border-color: #6f8197;
        color: #ffffff;
    }

[data-theme-mode="dark"] .bracket-game .matchup-info-popover {
    background: #20252c;
    border-color: #39424d;
    box-shadow: 0 12px 28px rgba(0,0,0,0.38);
}

[data-theme-mode="dark"] .bracket-game .matchup-info-header {
    background: linear-gradient(180deg, #27303a 0%, #232b34 100%);
    border-bottom-color: #39424d;
}

[data-theme-mode="dark"] .bracket-game .matchup-info-title {
    color: #dce7f3;
}

[data-theme-mode="dark"] .bracket-game .matchup-info-close {
    color: #b7c2cf;
}

    [data-theme-mode="dark"] .bracket-game .matchup-info-close:hover {
        color: #ffffff;
    }

[data-theme-mode="dark"] .bracket-game .matchup-info-body {
    background: #20252c;
}

[data-theme-mode="dark"] .bracket-game .matchup-team-card {
    background: #2a3038;
    border-color: #3a434f;
}

[data-theme-mode="dark"] .bracket-game .matchup-team-logo-placeholder {
    background: #414b58;
}

[data-theme-mode="dark"] .bracket-game .matchup-team-seed-pill {
    background: #334152;
    color: #d9e6f4;
}

[data-theme-mode="dark"] .bracket-game .matchup-team-name {
    color: #f1f6fb;
}

[data-theme-mode="dark"] .bracket-game .matchup-meta-pill {
    background: #313a45;
    color: #c3cfdb;
}

[data-theme-mode="dark"] .bracket-game .matchup-meta-pill-rank {
    background: #4a3318;
    color: #ffcc80;
}

[data-theme-mode="dark"] .bracket-game .matchup-meta-pill-net {
    background: #1f3a2a;
    color: #98e0b3;
}

@media (max-width: 768px) {
    .bracket-game .matchup-info-btn-left {
        right: -12px;
    }

    .bracket-game .matchup-info-btn-right {
        left: -12px;
    }

    .bracket-game .matchup-info-popover {
        width: 208px;
    }

    .bracket-game .matchup-info-popover-left {
        left: 160px;
    }

    .bracket-game .matchup-info-popover-right {
        right: 160px;
    }
}
