/* Spångakampen visual identity — dark navy gradient, bold uppercase headings,
   bright blue accent. Based on the tournament schedule poster. */

:root {
    --navy-900: #071229;
    --navy-800: #0b1f3f;
    --navy-700: #123a6b;
    --navy-600: #1b4d8f;
    --accent: #2f7de1;
    --accent-light: #8fc4f7;
    --ink: #10213d;
    --ink-muted: #4a5b78;
    --surface: #ffffff;
    --surface-muted: #f2f5fa;
    --border: #dbe3ef;
    --success: #1c8a4b;
    --danger: #c62828;
    --radius: 10px;
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--surface-muted);
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: "Oswald", "Segoe UI", system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 700;
    color: var(--navy-800);
    margin: 0 0 0.6em;
}

a {
    color: var(--accent);
}

p {
    line-height: 1.5;
}

/* ---------- App shell ---------- */

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-bar {
    background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 100%);
    color: #fff;
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.top-bar .brand {
    font-family: "Oswald", "Segoe UI", sans-serif;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.06em;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.top-bar .brand .crest {
    width: 1.9rem;
    height: 1.9rem;
    object-fit: contain;
    flex-shrink: 0;
}

.admin-nav {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    overflow-x: auto;
    padding: 0.4rem 0;
}

.admin-nav a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.admin-nav a:hover {
    background: rgba(255,255,255,0.12);
}

.admin-nav a.active {
    background: var(--accent);
    color: #fff;
}

.logout-form button {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
}

.logout-form button:hover {
    background: rgba(255,255,255,0.12);
}

main.content {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}

/* ---------- Cards & tables ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.report-showall {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    margin-bottom: 1.25rem;
}

.report-showall input[type=checkbox] {
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
}

.report-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.report-card {
    margin-bottom: 0;
}

.report-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.report-card-meta {
    font-size: 0.85rem;
    margin-bottom: 0.9rem;
}

.report-team-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}

.report-team-row:last-of-type {
    border-bottom: none;
}

.report-team-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-team-row input.report-score-input {
    width: 3.5rem;
    flex-shrink: 0;
    text-align: center;
    font-family: "Oswald", sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--navy-800);
    padding: 0.4rem 0.2rem;
}

.report-winner-field {
    margin-top: 0.9rem;
    margin-bottom: 0.9rem;
}

.report-save-btn {
    width: 100%;
    padding: 0.85rem;
    font-size: 1rem;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 480px;
}

th, td {
    text-align: left;
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

th {
    color: var(--ink-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

tbody tr:hover {
    background: var(--surface-muted);
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-group { background: #e7effb; color: var(--navy-700); }
.badge-final { background: #fdeee0; color: #a3540f; }
.badge-played { background: #e5f5ea; color: var(--success); }
.badge-scheduled { background: #eef0f4; color: var(--ink-muted); }

/* ---------- Forms ---------- */

.form-field {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-field label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ink);
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-field {
    flex: 1 1 200px;
}

input[type=text], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], select, textarea {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55rem 0.7rem;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    color: var(--ink);
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.btn-primary, .btn-secondary, .btn-danger {
    display: inline-block;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.1rem;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--navy-600);
}

.btn-secondary {
    background: var(--surface-muted);
    color: var(--ink);
    border: 1px solid var(--border);
}

.btn-danger {
    background: #fdeaea;
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.alert-error {
    background: #fdeaea;
    color: var(--danger);
    border: 1px solid #f3c6c6;
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.alert-info {
    background: #e7effb;
    color: var(--navy-700);
    border: 1px solid #cfe0f7;
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
}

.text-muted {
    color: var(--ink-muted);
    font-size: 0.9rem;
}

/* ---------- Login page ---------- */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-700) 55%, var(--navy-600) 100%);
}

.login-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 50px rgba(7, 18, 41, 0.35);
}

.login-subtitle {
    color: var(--ink-muted);
    margin-top: -0.4em;
    margin-bottom: 1.4em;
}

/* ---------- Public home page ---------- */

.hero {
    background-image:
        linear-gradient(100deg, rgba(7,18,41,0.9) 0%, rgba(7,18,41,0.6) 45%, rgba(7,18,41,0.15) 75%),
        url('/images/hero-background.png');
    background-size: cover;
    background-position: center right;
    color: #fff;
    padding: 5.5rem 1.25rem 3rem;
    /* break out of main.content's centered max-width to go full-bleed */
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    margin-top: -1.25rem;
}

.hero-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.hero h1 {
    color: #fff;
    margin-bottom: 0.2em;
    font-size: 2.2rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.hero-team-logo {
    width: 2.2rem;
    height: 2.2rem;
    object-fit: contain;
    flex-shrink: 0;
}

.hero-date {
    color: rgba(255,255,255,0.85);
    font-size: 1.05rem;
    margin: 0;
    text-transform: capitalize;
}

.back-link {
    display: inline-block;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 0.8rem;
}

.back-link:hover {
    color: #fff;
    text-decoration: underline;
}

.loading-text {
    padding: 2rem 1.25rem;
    color: var(--ink-muted);
}

.home-section {
    max-width: 1100px;
    padding: 0 1rem;
    margin: 0 auto 2rem;
}

.home-section h2 {
    margin-bottom: 0.8rem;
}

.section-after-hero {
    margin-top: 3rem;
}

.standings-team {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.group-match-list {
    max-width: 700px;
    margin: 0 auto;
}

.standings-list {
    display: flex;
    flex-direction: column;
}

.standing-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.standing-row:last-child {
    border-bottom: none;
}

.standing-dot {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--navy-700);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.standing-points {
    flex-shrink: 0;
    font-family: "Oswald", sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--navy-800);
}

.standing-body {
    flex: 1;
    min-width: 0;
}

.standing-team-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.standing-stats-line {
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

.group-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.group-link {
    display: inline-block;
    background: var(--navy-800);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.8rem 1.6rem;
    border-radius: var(--radius);
    transition: background 0.15s ease;
}

.group-link:hover {
    background: var(--accent);
}

.team-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.team-link .team-logo {
    width: 1.5rem;
    height: 1.5rem;
}

.team-name-link {
    color: inherit;
    text-decoration: none;
}

.team-name-link:hover {
    text-decoration: underline;
}

.dmr-badges {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Mobile-first: only one of these is ever visible, toggled at the desktop breakpoint. */
.only-desktop { display: none; }
.only-mobile { display: block; }

@media (min-width: 900px) {
    .only-desktop { display: block; }
    .only-mobile { display: none; }
}

/* --- Desktop home layout --- */

.desktop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1100px;
    margin: 2rem auto;
}

.desktop-match-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.desktop-match-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}

.dmr-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

.dmr-teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.team-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.team-cell span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-cell-home {
    justify-content: flex-end;
    text-align: right;
}

.team-cell-away {
    justify-content: flex-start;
}

.team-logo {
    width: 1.6rem;
    height: 1.6rem;
    object-fit: contain;
    flex-shrink: 0;
}

.dmr-score {
    font-family: "Oswald", sans-serif;
    font-size: 1.1rem;
    color: var(--navy-800);
    white-space: nowrap;
}

/* --- Mobile home layout --- */

.mobile-match-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mobile-match-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.mmc-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.mmc-team {
    font-weight: 600;
    padding: 0.15rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.mmc-team-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mmc-team-score {
    font-family: "Oswald", sans-serif;
    font-size: 1.2rem;
    color: var(--navy-800);
    flex-shrink: 0;
    min-width: 1.5rem;
    text-align: right;
}

.mmc-upcoming-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.mmc-teams-stack {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
    flex: 1;
    font-weight: 600;
}

.mmc-time-big {
    font-family: "Oswald", sans-serif;
    font-size: 2rem;
    color: var(--navy-800);
    flex-shrink: 0;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
    .top-bar {
        flex-direction: column;
        align-items: stretch;
    }

    main.content {
        padding: 1rem 0.75rem 2rem;
    }

    .card {
        padding: 1rem;
    }

    .form-row {
        flex-direction: column;
    }

    .hero {
        padding: 2rem 1rem;
        margin-top: -1rem;
    }

    .hero h1 {
        font-size: 1.6rem;
    }
}
