/* =========================================
   GENERAL RESET & BASE STYLES
   ========================================= */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 20px;
    color: #333;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

/* =========================================
   HAMBURGER NAVIGATION
   ========================================= */
.main-nav {
    position: relative;
    background-color: #333; 
    padding: 10px 20px;
    display: flex;
    align-items: center;
    border-radius: 8px; 
    margin-bottom: 20px;
}

.nav-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 1.4em;
    font-weight: bold;
    white-space: nowrap; 
    pointer-events: none; 
}

.hamburger {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 5px;
    display: block;
}

.nav-links {
    display: none; 
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #333;
    width: 250px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    margin: 0;
    padding: 0;
    list-style: none;
    z-index: 1000;
    border-radius: 0 0 8px 8px;
}

.nav-links.show {
    display: flex;
}

.nav-links li {
    border-bottom: 1px solid #444;
}

.nav-links li:last-child {
    border-bottom: none;
}

.nav-links a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 15px 20px;
    transition: background-color 0.2s ease;
}

.nav-links a:hover, 
.nav-links a.active {
    background-color: #555;
    font-weight: bold;
}

/* =========================================
   COUNTRY CARDS (GRID LAYOUT)
   ========================================= */
#countries-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    list-style: none;
    padding: 0;
}

.country-card {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.2s;
}

.country-card:hover {
    transform: translateY(-5px);
}

.country-card img {
    width: 60px;
    height: 40px;
    object-fit: cover;
    margin-bottom: 10px;
}

.country-card h3 {
    margin: 10px 0;
    font-size: 1.2em;
}

.country-card p {
    color: #666;
    font-size: 0.9em;
}

/* =========================================
   MATCH ROWS (SCHEDULE VIEW)
   ========================================= */
.match-row {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.team-left, .team-right {
    display: flex;
    flex-direction: column; 
    align-items: center;
    gap: 10px;
    width: 120px;
    padding: 10px; 
    border-radius: 8px; 
    box-sizing: border-box; 
}

.team-right { 
    justify-content: flex-end;
}

.team-flag {
    width: 30px;
    height: auto; 
}

.family-name {
    font-size: 0.85em;
    color: #555;
    margin-top: 5px;
}

.team-left.winner, 
.team-right.winner {
    background-color: #83D475;
}

.match-row.status-finished,
.bracket-match-box.status-finished {
    background-color: #94979A;
    border: 1px solid #7d8083;
}

.match-row.status-live,
.bracket-match-box.status-live {
    background-color: #cce5ff;
    border: 1px solid #b8daff;
}

.bracket-match-box.status-today {
    background-color: #fff1f0; /* Light pink */
    border: 1px solid #ffa39e;
}

.stage {
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    color: #555555; 
    font-weight: 600; 
}

/* =========================================
   STANDINGS TABLE
   ========================================= */
#standings-container {
    max-width: 1000px; 
    margin: 0 auto; 
    padding: 0 20px;
}

#standings-container h3 {
    background: #e9ecef;
    padding: 10px 15px;
    margin: 25px 0 10px 0;
    border-radius: 5px;
    color: #495057;
    font-size: 1.2em;
    border-left: 5px solid #007bff;
}

.standings-table {
    width: 100%;
    margin-bottom: 30px;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 20px;
}

.standings-table th, 
.standings-table td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

.standings-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #333;
    text-transform: uppercase;
    font-size: 0.9em;
}

.standings-table td.team-cell {
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

.standings-table tbody tr:hover {
    background-color: #f1f1f1;
    transition: background 0.2s;
}

/* =========================================
   COLLAPSIBLE DATE HEADERS
   ========================================= */
details.date-group {
    margin-bottom: 20px;
}

summary.date-header {
    background: #e9ecef;
    padding: 10px 15px;
    margin: 20px 0 10px 0;
    border-radius: 5px;
    color: #495057;
    font-size: 1.2em;
    font-weight: bold;
    border-left: 5px solid #007bff;
    cursor: pointer; 
    outline: none; 
}

summary.date-header:hover {
    background: #e2e6ea;
}

#schedule-container details:first-child summary {
    margin-top: 0;
}

/* =========================================
   KNOCKOUT VERTICAL VIEW
   ========================================= */
.round-group {
    background: #ffffff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.round-summary {
    cursor: pointer;
    outline: none;
    padding: 5px 0;
    border-bottom: 2px solid #007bff; 
    margin-bottom: 10px;
}

.round-header {
    display: inline-block;
    margin: 0;
    font-size: 1.5em;
    color: #004b87;
}

.team-flag-placeholder {
    width: 30px;
    height: 20px;
    background-color: #e9ecef;
    border-radius: 3px;
    border: 1px dashed #adb5bd;
}

/* =========================================
   SCROLLABLE WINDOW CONTAINER
   ========================================= */
#bracket-container {
    width: 100%;
    overflow-x: auto; 
    cursor: grab;
    scroll-behavior: smooth;
}

#bracket-container.active-drag {
    cursor: grabbing;
}

#bracket-container.active-drag * {
    user-select: none; 
}

#bracket-container::-webkit-scrollbar {
    height: 12px; 
}

#bracket-container::-webkit-scrollbar-track {
    background: #e9ecef; 
    border-radius: 10px;
    margin: 0 20px; 
}

#bracket-container::-webkit-scrollbar-thumb {
    background: #adb5bd; 
    border-radius: 10px;
    border: 2px solid #e9ecef; 
}

#bracket-container::-webkit-scrollbar-thumb:hover {
    background: #6c757d; 
}

/* =========================================
   SPLIT TOURNAMENT BRACKET VIEW (CANVAS)
   ========================================= */
.split-bracket-wrapper {
    display: flex;
    justify-content: center; 
    align-items: center;
    gap: 40px;
    padding: 20px;
    min-width: max-content; 
}

.bracket-side {
    display: flex;
    gap: 20px;
}

.bracket-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 40px;
    min-width: 250px;
}

/* Add this new class */
.bracket-match-box.final-match-box {
    background-color: #fff9c4; /* Light golden yellow */
    border: 2px solid #ffd700; /* Gold border */
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.3);
}


.championship-wrapper {
    border: 2px solid #ffd700;
    border-radius: 8px;
    padding: 10px;
    background: #fffdf0;
    box-shadow: 0 4px 10px rgba(255,215,0,0.2);
}

.championship-wrapper h2 {
    text-align: center;
    color: #b8860b;
    margin: 0 0 15px 0;
}

.third-place-wrapper {
    margin-top: 20px;
}

.third-place-wrapper h3 {
    text-align: center;
    color: #555;
    font-size: 1em;
    margin: 0 0 10px 0;
}

/* =========================================
   GENERAL BRACKET BOX ELEMENTS
   ========================================= */
.bracket-column {
    display: flex;
    flex-direction: column;
    min-width: 220px; 
}

.bracket-matches {
    display: flex;
    flex-direction: column;
    justify-content: space-around; 
    flex-grow: 1; 
    gap: 15px; 
}

.bracket-stage-header {
    text-align: center;
    margin-bottom: 10px;
    color: #004b87;
    font-size: 1.1em;
    padding-bottom: 5px;
    border-bottom: 2px solid #ddd;
}

.bracket-match-box {
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 5px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.bracket-match-time {
    font-size: 0.75em;
    color: #666;
    text-align: center;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bracket-team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.bracket-team:last-child {
    margin-bottom: 0;
}

/* Wrap the flag and stacked names together */
.bracket-team-info {
    display: flex;
    align-items: center;
    gap: 10px; 
}

/* Stacks the Team Name above the Family Name */
.bracket-names {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.bracket-team-name {
    font-weight: 500;
}

.bracket-family {
    font-size: 0.75em;
    color: #555;
    margin-top: 2px;
}

.bracket-flag {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    border: 1px solid #eee;
}

.bracket-flag-placeholder {
    width: 20px;
    height: 15px;
    background: #e9ecef;
    border-radius: 2px;
    border: 1px dashed #adb5bd;
}

.bracket-score {
    font-weight: bold;
    background: #f4f4f4;
    padding: 2px 8px;
    border-radius: 3px;
    color: #333;
}

/* Highlights the winning team inside the split bracket view */
.bracket-team.winner {
    background-color: #83D475;
    padding: 2px 5px;
    border-radius: 4px;
}

/* =========================================
   Draft Results
   ========================================= */

/* Highlights teams playing today */
.standings-table tr.match-today {
    background-color: #C1E1C1 !important;
    transition: background-color 0.3s ease;
}


/* =========================================
   ANALYSIS CARDS (DRAFT ANALYSIS)
   ========================================= */
#analysis-container {
            max-width: 1000px;
            margin: 0 auto;
            padding: 0 20px;
            display: flex;
            flex-direction: column;
            gap: 25px;
            padding-bottom: 40px;
        }

        .analysis-card {
            background: white;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.08);
            overflow: hidden;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }

        .analysis-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 6px 12px rgba(0,0,0,0.12);
        }

        /* The New "Header Box" Flair */
        .analysis-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: #e9ecef;
            padding: 15px 25px;
            border-left: 6px solid #004b87; /* Matches the active link color from your styles */
            border-bottom: 1px solid #dee2e6;
        }

        .analysis-header h3 {
            margin: 0;
            color: #212529;
            font-size: 1.5em;
            font-weight: 700;
        }

        /* Styling for the row of flags */
        .drafted-flags {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        .drafted-flags img {
            width: 38px;
            height: 26px;
            object-fit: cover;
            border-radius: 3px;
            box-shadow: 0 1px 4px rgba(0,0,0,0.25);
            border: 1px solid #fff;
        }

        .analysis-content {
            padding: 20px 25px;
        }

        .analysis-content p {
            line-height: 1.7;
            color: #495057;
            font-size: 1.05em;
            margin: 0;
        }

        /* Mobile Responsiveness for headers */
        @media (max-width: 600px) {
            .analysis-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 12px;
            }
        }

        /* =========================================
   DYNAMIC DRAFT & MATCH RESULTS
   ========================================= */

.family-header {
    background-color: #eef1f5;
    border-left: 4px solid #0d6efd;
    padding: 12px 15px;
    margin-top: 30px;
    margin-bottom: 15px;
    font-weight: bold;
    border-radius: 4px;
    color: #333;
}

/* Table overrides and column alignments */
.standings-table thead tr {
    border-bottom: 2px solid #eee;
}

.standings-table tbody tr {
    border-bottom: 1px solid #f5f5f5;
}

.col-flag, .col-group {
    text-align: center !important;
    padding: 10px !important;
}

.col-flag {
    width: 60px;
}

.col-country, .col-match {
    text-align: left !important;
    padding: 10px !important;
}

/* Match scheduling display */
.match-tbd {
    color: #999;
}

.match-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.9em;
}

.match-info .score {
    font-size: 1.2em;
    font-weight: bold;
}

.match-date {
    white-space: nowrap;
}

.match-vs {
    color: #666;
    font-size: 0.8em;
}

.match-opp-flag {
    width: 24px;
    vertical-align: middle;
    border-radius: 2px;
    box-shadow: 0 0 2px rgba(0,0,0,0.2);
}

.match-opp-name {
    font-weight: 500;
    font-size: 0.95em;
}

.team-flag-cell {
    width: 28px;
    vertical-align: middle;
    border-radius: 2px;
}

/* =========================================
   DAILY UPDATE BOX
   ========================================= */
.daily-update-box {
    display: block;
    text-align: left;
    margin-bottom: 25px;
    padding: 20px;
}

.daily-update-header {
    margin-bottom: 10px;
    color: #004b87;
    font-size: 0.95em;
}

.daily-update-content {
    font-size: 1.05em;
    color: #333;
    line-height: 1.5;
}

.daily-update-empty {
    margin: 0;
    color: #666;
}

/* ==========================
   MATCH PREVIEW FLYOUT
   ========================== */

.match-row.has-preview {
    cursor: pointer;
    transition: transform .2s ease;
}

.match-row.has-preview:hover {
    transform: translateY(-2px);
}

.preview-pill {
    color: #004b87;
    font-size: .8rem;
    font-weight: bold;
    margin-top: 5px;
}

#preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    opacity: 0;
    visibility: hidden;
    transition: .3s;
    z-index: 9998;
}

#preview-overlay.open {
    opacity: 1;
    visibility: visible;
}

#preview-panel {
    position: fixed;
    top: 0;
    right: -500px;
    width: 450px;
    max-width: 90vw;
    height: 100%;
    background: white;
    z-index: 9999;
    overflow-y: auto;
    transition: right .3s ease;
    box-shadow: -4px 0 15px rgba(0,0,0,.25);
}

#preview-panel.open {
    right: 0;
}

.preview-header {
    background: #004b87;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#preview-close {
    border: none;
    background: transparent;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
}

#preview-body {
    padding: 20px;
    line-height: 1.7;
}

#preview-link {
    padding: 0 20px 20px 20px;
}

#preview-link a {
    color: #004b87;
    font-weight: bold;
}

@media (max-width:768px) {

    #preview-panel {
        top: auto;
        right: 0;
        bottom: -100%;
        width: 100%;
        height: 80vh;
        transition: bottom .3s ease;
    }

    #preview-panel.open {
        bottom: 0;
    }
}

/* Standard flags used in Standings, Schedule, and Today's Games */
.team-flag {
    width: 24px;
    height: auto;
    vertical-align: middle;
    margin-right: 4px;
}

.team-flag-placeholder {
    width: 24px;
    height: 16px; /* Adjust height to match flag aspect ratio */
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
}

/* Knockout Bracket Flags (50% bigger) */
.bracket-flag {
    width: 36px;
    height: auto;
    vertical-align: middle;
    margin-right: 8px;
}

.bracket-flag-placeholder {
    width: 36px;
    height: 24px; /* Scaled placeholder to match larger flags */
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}
