:root {
    --wc-blue: #2A398D;
    --wc-red: #E61D25;
    --wc-green: #3CAC3B;
    --wc-dark-gray: #474A4A;
    --wc-light-gray: #D1D4D1;
    --wc-bg-canvas: #111111;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f9;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

header {
    background-color: #004a99; /* A nice blue for football */
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

header h1 {
    margin: 0;
    font-size: 1.8em;
}

header nav a {
    color: white;
    text-decoration: none;
    margin-left: 15px;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

header nav a:hover {
    background-color: #003366;
}

main {
    padding: 20px;
    max-width: 1000px;
    margin: 20px auto;
    background-color: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    flex: 1;
}

section {
    margin-bottom: 40px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

h2 {
    color: #004a99;
    border-bottom: 2px solid #ddd;
    padding-bottom: 10px;
    margin-top: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

table thead tr {
    background-color: #e0e0e0;
}

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

table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

table tbody tr:hover {
    background-color: #fffacd; /* Light gold hover */
}

/* Specific styling for the top ranks */
table tbody tr:first-child {
    font-weight: bold;
    color: #d4af37; /* Gold */
}

.error {
    color: red;
    font-weight: bold;
}

.form-container {
    max-width: 400px;
    margin: 40px auto;
    padding: 30px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select,
.form-group .form-select {
    width: 95%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
}

.form-group.has-error input {
    border-color: red;
}

.error-msg {
    color: red;
    font-size: 0.9em;
    display: block;
    margin-top: 5px;
}

.success-msg {
    color: green;
    font-size: 1.0em;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #e6ffe6;
    border: 1px solid #b3ffb3;
    border-radius: 4px;
}

.btn {
    background-color: #004a99;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}

.btn:hover {
    background-color: #003366;
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group label {
    font-weight: normal;
    margin-left: 10px;
}

.draw-symbol {
    display: inline-block;
    width: 24px; /* Matches flag-icon width */
    height: 18px; 
    line-height: 18px;
    background-color: #eee;
    border-radius: 2px;
    font-weight: bold;
    color: #333;
}

/* Enable smooth scrolling for the whole page */
html {
    scroll-behavior: smooth;
}

.site-footer {
    padding: 2rem;
    background: #333;
    color: white;
    text-align: center;
    margin-top: 3rem;
}

.footer-links a {
    color: #ddd;
    margin: 0 10px;
    text-decoration: none;
}

.footer-links a:hover {
    color: white;
    text-decoration: underline;
}

/* Back to Top button — hidden until 50% scroll depth */
#top-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.main-nav { background: #003366; color: white; padding: 1rem; }
.main-nav ul { list-style: none; display: flex; gap: 20px; margin: 0; }
.main-nav a { color: white; text-decoration: none; font-weight: bold; }
.main-nav a:hover { border-bottom: 2px solid #fff; }

.main-footer { background: #222; color: #ccc; padding: 2rem; text-align: center; margin-top: 40px; }
.back-to-top-btn { 
    display: inline-block; 
    margin-top: 10px; 
    padding: 8px 15px; 
    background: #007bff; 
    color: white; 
    border-radius: 5px; 
    text-decoration: none; 
}

/* Bracket Picks CSS Layout */
.bracket-container {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    overflow-x: auto;
}

.bracket-visual {
    display: flex;
    justify-content: space-around;
    align-items: center;
    min-width: 800px;
}

.bracket-column {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 400px;
}

.match-box {
    width: 180px;
    background: #fff;
    border: 1px solid #ddd;
    border-left: 4px solid var(--wc-red); /* United 2026 Red */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 10px 0;
}

.v-team {
    padding: 8px 12px;
    font-size: 0.9em;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.v-team:last-child { border-bottom: none; }

.v-team.winner-highlight {
    background-color: #d4edda;
    font-weight: bold;
}

.final-box {
    border: 2px solid var(--wc-red);
    transform: scale(1.1);
}

.v-label {
    color: white;
    font-size: 0.7em;
    text-align: center;
    padding: 2px;
}

@media print {
    /* Hide everything by default */
    body * {
        visibility: hidden;
    }
    
    /* Hide specific site navigation and non-bracket elements */
    header, footer, .site-footer, .main-nav, .controls, .expand-btn, #bracket-container, .btn, #top-link {
        display: none !important;
    }

    /* Target the Visual Bracket Container */
    #bracketContainer, #bracketContainer * {
        visibility: visible;
    }

    #bracketContainer {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        background: white; /* Save ink */
        color: black;
        border: none;
        box-shadow: none;
    }
    
    /* Ensure bracket lines and boxes are visible against white */
    .v-match {
        background: #fff;
        border: 1px solid #000;
        color: black;
    }
    
    .v-team {
        border-bottom: 1px solid #ccc;
    }
    
    .bracket-view-area {
        background: white;
        border: none;
    }

    /* Force background graphics for colors if user browser allows */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* Upcoming Matches Widget */
.upcoming-section {
    background: #f4f4f9;
    padding: 0;
    border: none;
    box-shadow: none;
}
.upcoming-section h2 {
    padding: 0 0 10px 0;
    margin: 0 0 20px 0;
}
.matches-container {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Spacing between matches like the official layout */
}
/* Update 1.8.1: match-day navigation bar (prev/next arrows + heading + date). */
.match-day-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 5px;
}
.match-day-nav .md-heading-wrap {
    flex: 1;
    text-align: center;
    min-width: 0;
}
.match-day-nav .md-heading {
    margin: 0;
    padding: 0;
    font-size: 1.4em;
    color: #2A398D;
}
.match-day-nav .md-date {
    font-size: 0.85em;
    color: #666;
    margin-top: 2px;
}
.match-day-nav .md-arrow {
    flex: 0 0 auto;
    background: #fff;
    border: 1px solid #d0d4e4;
    border-radius: 8px;
    color: #2A398D;
    font-size: 1.1em;
    line-height: 1;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.match-day-nav button.md-arrow:hover {
    background: #2A398D;
    border-color: #2A398D;
    color: #fff;
}
.match-day-nav .md-arrow.md-disabled {
    opacity: 0.3;
    cursor: default;
    background: #f4f4f9;
}
.date-header {
    padding: 8px 0;
    font-size: 1em;
    color: #333;
    border-bottom: 0;
    margin-bottom: -15px;
}
.match-card {
    background: white;
    border: 1px solid #eee;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.match-teams-row {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 25px 20px 15px 20px;
}
.team {
    display: flex;
    align-items: center;
    flex: 1;
}
.team-home {
    justify-content: flex-end;
    text-align: right;
}
.team-away {
    justify-content: flex-start;
    text-align: left;
}
.team-name {
    font-size: 1.4em;
    font-weight: 400;
}
.team-flag {
    width: 35px;
    height: 25px;
    margin: 0 15px;
    border: 1px solid #ccc;
    object-fit: cover;
}
.match-time {
    font-size: 2.2em;
    font-weight: 500;
    padding: 0 30px;
    min-width: 100px;
    text-align: center;
}
.match-subtitle {
    text-align: center;
    color: #777;
    font-size: 0.85em;
    padding-bottom: 20px;
}
.match-broadcasters {
    text-align: center;
    font-size: 0.75em;
    font-weight: 900;
    font-style: italic;
    background: #fafafa;
    border-top: 1px solid #eee;
    padding: 12px 0;
}
.match-broadcasters span {
    margin: 0 8px;
    letter-spacing: 0.5px;
}
.bc-crave { color: #5bc2e7; } /* Crave specific cyan/blue */
.bc-tsn { color: #E61D25; }
.bc-rds { color: #E61D25; }
.bc-noovo { color: #2e3192; } /* Noovo specific purple/blue */
.bc-ctv { color: #004a99; }

/* ── Live / final score on the homepage match-day cards (Update 1.7) ───────── */
.match-scorebox {
    padding: 0 25px;
    min-width: 110px;
    text-align: center;
}
.match-score {
    font-size: 2.2em;
    font-weight: 600;
    line-height: 1.1;
    white-space: nowrap;
}
.match-score span { color: #999; font-weight: 400; }
.match-status {
    margin-top: 4px;
    font-size: 0.62em;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.match-status.ms-live { color: #2e7d32; }
.match-status.ms-live::before {
    content: "";
    display: inline-block;
    width: 7px; height: 7px;
    margin-right: 5px;
    border-radius: 50%;
    background: #2e7d32;
    vertical-align: middle;
    animation: ms-pulse 1.2s ease-in-out infinite;
}
.match-status.ms-ft { color: #777; }
@keyframes ms-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.match-referee {
    text-align: center;
    color: #999;
    font-size: 0.78em;
    margin-top: -8px;
    padding-bottom: 14px;
}

/* Responsive adjustments for mobile and tablet devices */
@media (max-width: 1024px) {
    header {
        flex-direction: column;
        align-items: center;
        padding: 15px 10px;
    }
    
    header h1 {
        margin-bottom: 15px;
        text-align: center;
    }
    
    header nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    header nav a {
        margin-left: 0;
        margin-bottom: 5px;
        font-size: 0.9em;
    }
    
    main {
        margin: 15px 10px;
        padding: 15px;
        width: calc(100% - 20px);
    }
    
    .match-teams-row {
        flex-direction: column;
        padding: 15px 10px;
    }
    
    .team-home {
        justify-content: center;
        text-align: center;
        flex-direction: row-reverse;
    }
    
    .team-home .team-name {
        margin-left: 15px;
        margin-right: 0;
    }
    
    .team-home .team-flag {
        margin: 0;
    }
    
    .team-away {
        justify-content: center;
        text-align: center;
    }
    
    .match-time {
        padding: 15px 0;
        font-size: 1.8em;
    }

    .match-scorebox {
        padding: 12px 0;
    }
}

/* ── Countdown banner (shared by index.php and bracket_picks.php) ──────────── */
.cd-unit {
    background: #474A4A;
    border-radius: 8px;
    padding: 12px 18px;
    min-width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.cd-num {
    font-size: 2.2em;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.cd-label {
    font-size: 0.65em;
    letter-spacing: 1.5px;
    color: #D1D4D1;
    margin-top: 4px;
}
.cd-sep {
    font-size: 2em;
    font-weight: 700;
    color: #E61D25;
    line-height: 1;
    margin-bottom: 18px;

}