/* ================================================
   TSV SCHEDULE
   ================================================ */

/* AJAX filters bar */
.tsv-schedule-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--tsv-border);
}
.tsv-schedule-filters select,
.tsv-filter {
    padding: 8px 12px;
    border: 1px solid var(--tsv-border);
    border-radius: var(--tsv-radius);
    font-size: 13px;
    background: var(--tsv-white);
    color: var(--tsv-dark);
    cursor: pointer;
    transition: border-color 0.15s;
    -webkit-appearance: none;
}
.tsv-schedule-filters select:focus,
.tsv-filter:focus {
    outline: none;
    border-color: var(--tsv-primary);
}

/* CSV export button */
.tsv-csv-export {
    margin-left: auto;
    font-size: 12px;
    padding: 7px 14px;
    border: 1px solid var(--tsv-border);
    border-radius: var(--tsv-radius);
    background: var(--tsv-white);
    cursor: pointer;
    color: var(--tsv-dark);
    transition: border-color 0.15s, color 0.15s;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.tsv-csv-export:hover { border-color: var(--tsv-primary); color: var(--tsv-primary); }

/* Loading state */
.tsv-schedule-loading {
    text-align: center;
    padding: 24px;
    color: var(--tsv-muted);
    font-size: 13px;
}

/* Day group */
.tsv-day-group,
.tsv-match-day { margin-bottom: 20px; }

.tsv-day-header,
.tsv-match-day__header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: var(--tsv-dark);
    padding: 10px 16px;
    background: #f8f8f8;
    border-radius: 4px;
    margin: 0 0 4px;
    border-left: 3px solid var(--tsv-primary);
}
.tsv-day-header::before,
.tsv-match-day__header::before {
    content: '📅';
    font-size: 13px;
}

/* ── Match row ── */
.tsv-match {
    display: grid;
    grid-template-columns: 72px 1fr 80px 1fr 24px;
    /* TIME | HOME | SCORE | AWAY | ADMIN */
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 4px;
    transition: background 0.12s;
    font-size: 13px;
}
.tsv-match:last-child { border-bottom: none; }
.tsv-match[data-href] { cursor: pointer; }
.tsv-match[data-href]:hover { background: #fff4f4; }
.tsv-match:not([data-href]):hover { background: #fafafa; }
.tsv-match.is-upcoming { opacity: 0.85; }

/* Time column */
.tsv-match__time {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 8px;
    border-right: 2px solid #f0f0f0;
}
.tsv-match__hour {
    font-size: 12px;
    font-weight: 700;
    color: var(--tsv-dark);
    white-space: nowrap;
}
.tsv-match__field {
    font-size: 10px;
    color: var(--tsv-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* Home team */
.tsv-match__home {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    text-align: right;
}

/* Away team */
.tsv-match__away {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
}

.tsv-match__team-name {
    font-weight: 600;
    color: var(--tsv-dark);
    font-size: 13px;
    line-height: 1.3;
}

/* Team logos (match-row size overrides global) */
.tsv-match .tsv-team-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--tsv-border);
    vertical-align: middle;
    margin-right: 0;
}
.tsv-team-logo--placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f5f5f5;
    border: 1px solid var(--tsv-border);
    font-size: 14px;
    flex-shrink: 0;
}

/* Score wrap */
.tsv-match__score-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.tsv-match__score--played {
    font-size: 17px;
    font-weight: 800;
    color: var(--tsv-dark);
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.tsv-match__score--upcoming {
    font-size: 13px;
    font-weight: 400;
    color: #bbb;
}
.tsv-match__kickoff {
    font-size: 10px;
    color: var(--tsv-muted);
    font-weight: 600;
}

/* Match label badge — Championship, 3rd Place etc. */
.tsv-match__label {
    grid-column: 1 / -1;
    background: var(--tsv-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 3px 12px;
    border-radius: 3px;
    display: inline-block;
    margin-bottom: 4px;
    justify-self: start;
}

/* Championship/3rd-place match — gold highlight */
.tsv-match:has(.tsv-match__label) {
    background: linear-gradient(135deg,
        rgba(255,215,0,0.06) 0%,
        rgba(204,0,0,0.04) 100%);
    border-left: 3px solid gold;
    border-radius: 4px;
}

/* Admin edit link */
.tsv-match__admin {
    display: none;
}
.logged-in .tsv-match__admin {
    display: flex;
    align-items: center;
}
.tsv-match__edit-link {
    font-size: 13px;
    text-decoration: none;
    opacity: 0.4;
    transition: opacity 0.15s;
    padding: 4px;
}
.tsv-match:hover .tsv-match__edit-link { opacity: 1; }

/* No matches */
.tsv-no-matches,
.tsv-no-data {
    text-align: center;
    padding: 32px 0;
    color: var(--tsv-muted);
    font-size: 13px;
    font-style: italic;
}

/* Schedule section heading */
.tsv-section-title,
.tsv-schedule-section h2,
.tsv-standings-section h2 {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--tsv-dark);
    border-bottom: 3px solid var(--tsv-primary);
    padding-bottom: 8px;
    margin: 0 0 16px;
}

/* Week navigation */
.tsv-week-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--tsv-dark);
    flex: 1;
}
.tsv-week-nav button {
    width: 28px;
    height: 28px;
    border: 1px solid var(--tsv-border);
    border-radius: 4px;
    background: var(--tsv-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: border-color 0.15s, color 0.15s;
}
.tsv-week-nav button:hover { border-color: var(--tsv-primary); color: var(--tsv-primary); }

/* Red export button */
.tsv-export-btn {
    background: var(--tsv-primary);
    color: #fff;
    border: none;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 4px;
    cursor: pointer;
    margin-left: auto;
    transition: background 0.15s;
}
.tsv-export-btn:hover { background: #aa0000; }

/* View full schedule button */
.tsv-view-schedule {
    display: block;
    width: 100%;
    text-align: center;
    padding: 11px;
    margin-top: 20px;
    border: 1.5px solid var(--tsv-border);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tsv-dark);
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}
.tsv-view-schedule:hover {
    border-color: var(--tsv-primary);
    color: var(--tsv-primary);
    text-decoration: none;
}

/* Mobile */
@media (max-width: 600px) {
    .tsv-match {
        grid-template-columns: 60px 1fr;
        grid-template-rows: auto auto auto;
        gap: 6px;
        padding: 12px;
    }
    .tsv-match__time {
        grid-row: span 3;
        border-right: 2px solid #f0f0f0;
        justify-content: center;
    }
    .tsv-match__home { justify-content: flex-start; }
    .tsv-match__score-wrap {
        grid-column: 2;
        flex-direction: row;
        justify-content: flex-start;
        gap: 8px;
    }
    .tsv-match__away { grid-column: 2; }
    .tsv-match__admin { display: none !important; }
    .tsv-match__team-name { font-size: 12px; }
    .tsv-schedule-filters { flex-direction: column; }
    .tsv-schedule-filters select,
    .tsv-filter,
    .tsv-csv-export { width: 100%; margin-left: 0; }
}
