/* Base layout */
html {
    width: 100%;
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(rgba(245, 246, 250, 0.94), rgba(245, 246, 250, 0.9));
    background-image: none !important;
    background-color: #f5f6fa;
    color: #1f2937;
}

body > header {
    width: 100%;
    background: #0f172a;
    color: #e2e8f0;
    padding: 0.8rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

body > header nav {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.site-nav__links {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

body > header nav a,
body > header nav > span {
    background: transparent;
    color: #fff;
    border: 0;
    text-decoration: none;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-shadow: none;
}

body > header nav a:hover {
    background: transparent;
    color: #fff;
    text-decoration: underline;
}

main {
    flex: 1 0 auto;
    width: 100%;
    min-width: 0;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    padding-bottom: 4rem; /* space for floating save */
}

a {
    color: #0f52ba;
}

a:hover {
    text-decoration: none;
}

h1, h2, h3, h4 {
    color: #0f172a;
    margin: 0 0 0.5rem;
}

p {
    margin: 0.35rem 0;
}

/* Alerts */
.errors {
    color: #b00020;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin: 0.5rem 0 1rem;
    border: 1px solid #cde8d2;
    background: #eaf7ec;
    color: #1b5e20;
}

/* Pills / metadata */
.picks-meta {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.pill {
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    font-size: 0.95rem;
}

.pill-open {
    border-color: #b6e3c0;
    background: #ecf7ef;
    color: #1b5e20;
}

.pill-locked {
    border-color: #f6cdd0;
    background: #fff1f2;
    color: #9c1c28;
}

/* Cards / sections */
.group-block {
    max-width: 100%;
    min-width: 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.group-header {
    background: #0f172a;
    color: #e2e8f0;
    margin: -0.75rem -0.75rem 0.5rem -0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 8px 8px 0 0;
}

.group-header h2 {
    margin: 0;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

.picks-table,
.standings-table,
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.picks-table th,
.picks-table td,
.standings-table th,
.standings-table td,
table th,
table td {
    padding: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
}

.picks-table th,
.standings-table th,
table th {
    background: #0f172a;
    color: #e2e8f0;
    font-weight: 700;
}

.picks-table .team {
    white-space: nowrap;
}

/* Center align matches table on matches page */
.picks-table.matches-table th,
.picks-table.matches-table td {
    text-align: center !important;
}
.picks-table.matches-table td.team {
    text-align: center !important;
    white-space: nowrap;
}
.picks-table.matches-table td.kickoff {
    white-space: nowrap;
}

.text-center {
    text-align: center !important;
}

/* Form controls */
.prediction-inputs {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.prediction-inputs input[type="number"] {
    width: 3ch;
    padding: 0.25rem;
    text-align: center;
}

/* Force compact score inputs regardless of framework defaults */
.score-input {
    width: 2.75rem !important;
    min-width: 2.75rem !important;
    max-width: 2.75rem !important;
    padding: 0.2rem 0.25rem !important;
    text-align: center !important;
    flex: 0 0 auto !important;
    box-sizing: border-box;
    display: inline-block !important;
}

.match-error {
    color: #b00020;
    font-size: 0.9rem;
}

.has-error input[type="number"] {
    border-color: #b00020;
}

.countdown-value {
    font-weight: 600;
}

/* Form + inputs */
button,
.btn {
    background: linear-gradient(135deg, #0f52ba, #5b8def);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.05s ease, box-shadow 0.1s ease;
    text-decoration: none;
    display: inline-block;
}

button:hover,
.btn:hover {
    box-shadow: 0 8px 16px rgba(15, 82, 186, 0.2);
}

button:active,
.btn:active {
    transform: translateY(1px);
}

button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.floating-save {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    bottom: 1.5rem !important;
    z-index: 3000 !important;
    box-shadow: 0 12px 24px rgba(211, 47, 47, 0.25) !important;
    width: auto !important;
    min-width: unset !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    background: #d32f2f !important;
    background-image: none !important;
    border: 1px solid #b71c1c !important;
    color: #fff !important;
    padding: 0.6rem 1.2rem !important;
}

@media (max-width: 768px) {
    .floating-save {
        left: 50% !important;
        transform: translateX(-50%) !important;
        bottom: 1rem !important;
        width: auto !important;
    }
}

input[type="number"],
input[type="text"],
input[type="email"],
input[type="password"],
select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0.4rem 0.5rem;
    font-size: 1rem;
}

input:focus,
select:focus {
    outline: 2px solid #5b8def;
    border-color: #5b8def;
}

/* Misc helpers */
.standings-table th:first-child,
.standings-table td:first-child {
    width: 2rem;
}

.subtext {
    margin: 0.2rem 0;
    color: #555;
    font-size: 0.95rem;
}

/* Responsive tweaks */
@media (max-width: 768px) {
    body:not(.mobile-fit-page) {
        min-width: 1200px;
    }

    body:not(.mobile-fit-page) main {
        min-width: 1200px;
    }

    body.mobile-fit-page {
        min-width: 0;
    }

    body.mobile-fit-page main {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        padding: 1rem;
    }

    body.mobile-fit-page > header nav,
    body.mobile-fit-page .site-footer__inner {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    body.mobile-fit-page.mobile-nav-enhanced > header {
        padding: 0;
    }

    body.mobile-fit-page.mobile-nav-enhanced > header nav {
        gap: 0;
        padding-top: 0.65rem;
        padding-bottom: 0.65rem;
        justify-content: flex-end;
    }

    body.mobile-fit-page.mobile-nav-enhanced .site-nav__toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 2.4rem;
        width: 2.6rem;
        min-width: 2.6rem;
        margin: 0;
        padding: 0;
        background: transparent;
        background-image: none;
        border: 1px solid rgba(226, 232, 240, 0.7);
        border-radius: 6px;
        box-shadow: none;
        color: #fff;
        line-height: 1;
        text-shadow: none;
    }

    body.mobile-fit-page.mobile-nav-enhanced .site-nav__toggle:hover {
        background: rgba(226, 232, 240, 0.12);
        box-shadow: none;
    }

    body.mobile-fit-page.mobile-nav-enhanced .site-nav__toggle:focus-visible {
        outline: 2px solid #93c5fd;
        outline-offset: 2px;
    }

    body.mobile-fit-page.mobile-nav-enhanced .site-nav__toggle-icon {
        display: block;
        font-size: 1.6rem;
        line-height: 1;
        transform: translateY(-1px);
    }

    body.mobile-fit-page.mobile-nav-enhanced .site-nav__links {
        display: none;
        flex: 1 0 100%;
        width: 100%;
        margin-top: 0.35rem;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(226, 232, 240, 0.2);
    }

    body.mobile-fit-page.mobile-nav-enhanced .site-nav__links.is-open {
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
        align-items: stretch;
    }

    body.mobile-fit-page.mobile-nav-enhanced .site-nav__links a {
        padding: 0.65rem 0.25rem;
        line-height: 1.2;
    }

    .picks-table,
    .standings-table,
    table {
        display: table;
    }
}

/* Auth forms */
.auth-wrapper {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-field {
    margin-bottom: 0.5rem;
}

/* Footer */
.site-footer {
    width: 100%;
    background: #0f172a;
    color: #e2e8f0;
    padding: 0.9rem 0;
    margin-top: 2rem;
}

.site-footer__inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.site-footer a {
    color: #e2e8f0;
    text-decoration: none;
    font-weight: 600;
}

.site-footer a:hover {
    text-decoration: underline;
}

.site-footer__note {
    flex: 1 0 100%;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Legal page */
.legal {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 900px;
    margin: 0 auto 1.5rem;
    overflow-wrap: break-word;
}

.legal section {
    margin-top: 1rem;
}

.legal h2 {
    margin-top: 0.75rem;
}

.legal h3 {
    margin: 0.75rem 0 0.35rem;
}

.legal ul {
    padding-left: 1.2rem;
}

.legal__cta {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

@media (max-width: 640px) {
    .legal {
        padding: 0.9rem 1rem;
        border-radius: 8px;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    }

    .legal h1 {
        font-size: 1.65rem;
        line-height: 1.2;
    }

    .legal h2 {
        font-size: 1.25rem;
    }

    .legal h3 {
        font-size: 1.05rem;
    }

    .legal ul {
        padding-left: 1rem;
    }
}
