﻿/* ════════════════════════════════════════════════════════════════
   TournamentMatchesTab.css
   Linked from App.razor.

   Visual vocabulary mirrors TournamentDashboard.css and the other
   redesigned tabs:
     • .tmatch-pill  → status pill family (= .te-pill / .tdt-status)
     • .tmatch-chip  → soft-purple count/filter chip (= .td-tab-count)
     • .tmatch-action-btn → outline action button (= .td-icon-btn but with label)
     • .tmatch-court-cell → venue short-name + court pill pair
       (venue tooltip on hover shows full name)
   The split-panel layout, tree, day grouping, table columns and
   action menus are all preserved — this is a paint job only.
════════════════════════════════════════════════════════════════ */

.tmatch-root {
    font-family: 'DM Sans', sans-serif;
    padding: 0;
}

/* ════════════════════════════════════════════════════════════
   TOP ACTION BAR
════════════════════════════════════════════════════════════ */
.tmatch-top-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.tmatch-view-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tmatch-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    padding: 5px 11px;
    border-radius: 6px;
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
    outline: none;
    transition: background 0.13s, color 0.13s, border-color 0.13s;
}

    .tmatch-action-btn:focus,
    .tmatch-action-btn:focus-visible {
        outline: none;
    }

    .tmatch-action-btn:hover {
        background: var(--mud-palette-action-default-hover);
        color: var(--mud-palette-text-primary);
    }

.tmatch-action-btn--active {
    background: rgba(99,102,241,0.13);
    border-color: rgba(99,102,241,0.32);
    color: var(--mud-palette-primary);
    font-weight: 600;
}

/* ════════════════════════════════════════════════════════════
   AUTO-SCHEDULER PANEL (host)
════════════════════════════════════════════════════════════ */
.tmatch-scheduler-panel {
    margin-bottom: 12px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    overflow: hidden;
    background: var(--mud-palette-surface);
}

/* ════════════════════════════════════════════════════════════
   SPLIT PANEL — tree on left, content on right
════════════════════════════════════════════════════════════ */
.sp-root {
    display: flex;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    overflow: hidden;
    min-height: 480px;
}

/* ── LEFT TREE PANEL ─────────────────────────────────────── */
.sp-left {
    width: 240px;
    border-right: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sp-left-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--mud-palette-background-grey);
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.sp-left-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--mud-palette-text-secondary);
}

.sp-left-count {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: var(--mud-palette-text-disabled);
}

.sp-tree {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

/* "All Matches" node */
.sp-tree-all {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    margin: 1px 6px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--mud-palette-text-primary);
    cursor: pointer;
    transition: background 0.12s;
}

    .sp-tree-all:hover {
        background: var(--mud-palette-action-default-hover);
    }

.sp-tree-all--active {
    background: rgba(99,102,241,0.13);
    color: var(--mud-palette-primary);
    font-weight: 600;
}

/* Event row */
.sp-tree-event {
    margin: 1px 0;
}

.sp-tree-event-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 6px 6px;
    margin: 0 6px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--mud-palette-text-primary);
    cursor: pointer;
    transition: background 0.12s;
}

    .sp-tree-event-row:hover {
        background: var(--mud-palette-action-default-hover);
    }

.sp-tree-row--active {
    background: rgba(99,102,241,0.13);
    color: var(--mud-palette-primary);
    font-weight: 600;
}

.sp-tree-chevron {
    background: transparent;
    border: none;
    padding: 2px 4px;
    cursor: pointer;
    color: var(--mud-palette-text-secondary);
    display: inline-flex;
    align-items: center;
    width: 18px;
    height: 18px;
    outline: none;
}

    .sp-tree-chevron svg {
        width: 12px;
        height: 12px;
    }

.sp-tree-chevron-svg {
    transition: transform 0.2s;
}

.sp-tree-chevron-svg--open {
    transform: rotate(90deg);
}

.sp-ev-badge {
    color: #ffffff;
    background: var(--sp-ev-color, var(--mud-palette-text-disabled));
    font-family: 'DM Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.sp-ev-badge--sm {
    font-size: 8.5px;
    padding: 1px 4px;
}

.sp-tree-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sp-tree-label--stage {
    font-size: 11px;
    color: var(--mud-palette-text-secondary);
}

.sp-tree-label--group {
    font-size: 11px;
}

.sp-tree-count {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: var(--mud-palette-text-disabled);
    font-weight: 600;
}

.sp-tree-row--active .sp-tree-count {
    color: var(--mud-palette-primary);
}

.sp-tree-stage-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 12px 4px 30px;
    margin: 0 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
}

    .sp-tree-stage-row:hover:not(.sp-tree-row--active) {
        background: var(--mud-palette-action-default-hover);
    }

.sp-tree-stage-header {
    cursor: default;
}

.sp-tree-stage-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--sp-dot-color, var(--mud-palette-text-disabled));
    flex-shrink: 0;
}

.sp-tree-group-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 3px 12px 3px 48px;
    margin: 0 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
}

    .sp-tree-group-row:hover:not(.sp-tree-row--active) {
        background: var(--mud-palette-action-default-hover);
    }

.sp-tree-group-bullet {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--mud-palette-text-disabled);
    flex-shrink: 0;
}

/* ── RIGHT PANEL ─────────────────────────────────────────── */
.sp-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sp-right-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-background-grey);
}

.sp-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 12px;
}

.sp-breadcrumb-item {
    color: var(--mud-palette-text-secondary);
}

.sp-breadcrumb-current {
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.sp-breadcrumb-sep {
    color: var(--mud-palette-text-disabled);
}

/* ── FILTER BAR INSIDE RIGHT HEADER ──────────────────────── */
.sp-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.tmatch-date-pill {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--mud-palette-lines-default);
    background: transparent;
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
    outline: none;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

    .tmatch-date-pill:focus,
    .tmatch-date-pill:focus-visible {
        outline: none;
    }

    .tmatch-date-pill:hover:not(.tmatch-date-pill--active) {
        background: var(--mud-palette-action-default-hover);
        color: var(--mud-palette-text-primary);
    }

.tmatch-date-pill--active {
    background: rgba(99,102,241,0.13);
    border-color: rgba(99,102,241,0.32);
    color: var(--mud-palette-primary);
    font-weight: 600;
}

.tmatch-date-pill-day {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tmatch-date-pill-num {
    font-weight: 600;
}

.tmatch-filter-divider {
    width: 1px;
    height: 18px;
    background: var(--mud-palette-lines-default);
    margin: 0 4px;
}

.tmatch-status-filter {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--mud-palette-lines-default);
    background: transparent;
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
    outline: none;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

    .tmatch-status-filter:focus,
    .tmatch-status-filter:focus-visible {
        outline: none;
    }

    .tmatch-status-filter:hover:not(.tmatch-status-filter--active) {
        background: var(--mud-palette-action-default-hover);
        color: var(--mud-palette-text-primary);
    }

.tmatch-status-filter--active {
    background: rgba(99,102,241,0.13);
    border-color: rgba(99,102,241,0.32);
    color: var(--mud-palette-primary);
    font-weight: 600;
}

.tmatch-filter-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--sp-dot-color, var(--mud-palette-text-disabled));
    flex-shrink: 0;
}

.tmatch-filter-search {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: auto;
}

.tmatch-search-input {
    width: 180px;
    height: 28px;
    padding: 4px 24px 4px 28px;
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    color: var(--mud-palette-text-primary);
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.15s;
}

    .tmatch-search-input:focus {
        border-color: var(--mud-palette-primary);
    }

.tmatch-filter-search .mud-icon-root {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.tmatch-search-clear {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mud-palette-text-secondary);
    outline: none;
}

.tmatch-clear-filters {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 4px 9px;
    border-radius: 6px;
    border: 1px solid var(--mud-palette-lines-default);
    background: transparent;
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
    outline: none;
}

    .tmatch-clear-filters:hover {
        background: var(--mud-palette-action-default-hover);
    }

/* ════════════════════════════════════════════════════════════
   MATCH TABLE — day-grouped + scheduled/unscheduled split
════════════════════════════════════════════════════════════ */
.sp-match-body {
    flex: 1;
    overflow: auto;
}

.sp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 72px 24px;
    color: var(--mud-palette-text-disabled);
    font-size: 13px;
}

/* Day header */
.tmatch-day-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--mud-palette-background-grey);
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.tmatch-day-icon {
    display: inline-flex;
}

.tmatch-day-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.tmatch-day-count {
    margin-left: auto;
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: var(--mud-palette-text-disabled);
}

/* Table */
.tmatch-sched-wrap {
    overflow-x: auto;
}

.tmatch-sched-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

    .tmatch-sched-table thead th {
        text-align: left;
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.07em;
        color: var(--mud-palette-text-secondary);
        padding: 7px 10px;
        border-bottom: 1px solid var(--mud-palette-lines-default);
        background: var(--mud-palette-surface);
        white-space: nowrap;
    }

.tmatch-sched-row {
    border-top: 1px solid var(--mud-palette-lines-default);
    transition: background 0.12s;
}

    .tmatch-sched-row:hover {
        background: var(--mud-palette-action-hover);
    }

.tmatch-sched-row--completed {
    opacity: 0.7;
}

.tmatch-sched-row--live {
    background: rgba(211,47,47,0.04);
}

.tmatch-sched-row--manual {
    background: rgba(232,169,74,0.04);
}

.tmatch-sched-row td,
.tmatch-sched-table tbody td {
    padding: 8px 10px;
    vertical-align: middle;
}

.tmatch-sched-row--unscheduled .tmatch-sched-none {
    color: var(--mud-palette-text-disabled);
}

.tmatch-sched-time-big {
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--mud-palette-text-primary);
}

.tmatch-sched-none {
    color: var(--mud-palette-text-disabled);
    font-size: 12px;
}

/* Event divider row (when "All" view groups by event) */
.tmatch-sched-ev-div td {
    padding: 8px 14px;
    background: var(--mud-palette-background-grey);
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.tmatch-sched-ev-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.tmatch-sched-ev-group {
    font-size: 11px;
    color: var(--mud-palette-text-secondary);
    margin-left: 6px;
}

/* ════════════════════════════════════════════════════════════
   COURT CELL — venue chip + court chip pair
   Venue is a soft-purple tinted chip with the short-name (or
   truncated full name). Hovering the chip shows the full venue
   name via the native title attribute.
════════════════════════════════════════════════════════════ */
.tmatch-court-cell {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.tmatch-venue-chip {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(99,102,241,0.10);
    color: var(--mud-palette-primary);
    border: 1px solid rgba(99,102,241,0.25);
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}

.tmatch-court-pill {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 4px;
    background: var(--mud-palette-background-grey);
    color: var(--mud-palette-text-primary);
    border: 1px solid var(--mud-palette-lines-default);
}

/* ════════════════════════════════════════════════════════════
   MATCH-CODE PILL, ROUND BADGE, EVENT TAG
════════════════════════════════════════════════════════════ */
.tmatch-match-nr-pill {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--mud-palette-background-grey);
    border: 1px solid var(--mud-palette-lines-default);
    color: var(--mud-palette-text-secondary);
}

.tmatch-rr-badge {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(99,102,241,0.10);
    color: var(--mud-palette-primary);
    border: 1px solid rgba(99,102,241,0.25);
}

.tmatch-ev-tag {
    color: #ffffff;
    background: var(--sp-ev-color, var(--mud-palette-text-disabled));
    font-family: 'DM Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    letter-spacing: 0.04em;
    display: inline-block;
}

/* ── Stage cell ──────────────────────────────────────────── */
.tmatch-stage-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.tmatch-stage-text {
    font-size: 11px;
    color: var(--mud-palette-text-primary);
    font-weight: 500;
}

.tmatch-stage-grp {
    font-size: 10px;
    color: var(--mud-palette-text-secondary);
}

/* ── Players cell ────────────────────────────────────────── */
.tmatch-tbl-players {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.tmatch-tbl-winner {
    font-weight: 700;
    color: var(--mud-palette-text-primary);
}

/* ── Score cell ──────────────────────────────────────────── */
.tmatch-tbl-score {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--mud-palette-text-secondary);
}

.tmatch-tbl-sw {
    font-weight: 700;
    color: var(--mud-palette-text-primary);
}

.tmatch-tbl-sep {
    margin: 0 1px;
    color: var(--mud-palette-text-disabled);
}

.tmatch-tbl-comma {
    margin: 0 3px;
    color: var(--mud-palette-text-disabled);
}

/* ── Umpire badge ────────────────────────────────────────── */
.tmatch-umpire-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 20px;
    background: rgba(99,102,241,0.10);
    color: var(--mud-palette-primary);
    border: 1px solid rgba(99,102,241,0.22);
    font-weight: 500;
}

.tmatch-umpire-none {
    color: var(--mud-palette-text-disabled);
    font-size: 11px;
}

/* ════════════════════════════════════════════════════════════
   STATUS PILLS — same family as .te-pill / .tdt-status
════════════════════════════════════════════════════════════ */
.tmatch-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 20px;
    border: 1px solid;
    white-space: nowrap;
}

.tmatch-pill--notstarted {
    background: var(--mud-palette-background-grey);
    color: var(--mud-palette-text-secondary);
    border-color: var(--mud-palette-lines-default);
}

.tmatch-pill--scheduled {
    background: rgba(99,102,241,0.10);
    color: var(--mud-palette-primary);
    border-color: rgba(99,102,241,0.25);
}

.tmatch-pill--completed {
    background: rgba(29,158,117,0.12);
    color: #0F6E56;
    border-color: rgba(29,158,117,0.25);
}

.tmatch-pill--locked {
    background: rgba(136,135,128,0.13);
    color: #5F5E5A;
    border-color: rgba(136,135,128,0.25);
}

/* Live — solid red with pulsing dot, same recipe as dashboard. */
.tmatch-pill--live {
    background: #d32f2f;
    color: #ffffff;
    border-color: #d32f2f;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.tmatch-pill-live-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #ffffff;
    animation: tmatch-pulse 1.6s ease-in-out infinite;
}

@keyframes tmatch-pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* Manual schedule lock — amber-tinted */
.tmatch-status-manual {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 20px;
    background: rgba(232,169,74,0.12);
    color: #B07820;
    border: 1px solid rgba(232,169,74,0.30);
    white-space: nowrap;
}

/* "All matches scheduled" success banner */
.tmatch-all-scheduled {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    font-size: 12px;
    color: #0F6E56;
    background: rgba(29,158,117,0.06);
    border-top: 1px solid var(--mud-palette-lines-default);
}

/* ════════════════════════════════════════════════════════════
   ICON UTILITY CLASSES — replace inline Style="font-size:..." on
   MudIcon. The CSS validator can't parse "font-size:13px" inside a
   Mud component param, so we move sizing here as plain classes.
════════════════════════════════════════════════════════════ */
.tmatch-icon-11 {
    font-size: 11px !important;
    width: 11px !important;
    height: 11px !important;
}

.tmatch-icon-12 {
    font-size: 12px !important;
    width: 12px !important;
    height: 12px !important;
}

.tmatch-icon-13 {
    font-size: 13px !important;
    width: 13px !important;
    height: 13px !important;
}

.tmatch-icon-14 {
    font-size: 14px !important;
    width: 14px !important;
    height: 14px !important;
}

.tmatch-icon-13-muted {
    font-size: 13px !important;
    width: 13px !important;
    height: 13px !important;
    color: var(--mud-palette-text-disabled);
}

.tmatch-icon-day {
    font-size: 13px !important;
    width: 13px !important;
    height: 13px !important;
    color: var(--mud-palette-primary);
}

.tmatch-icon-success {
    font-size: 15px !important;
    width: 15px !important;
    height: 15px !important;
    color: #1D9E75;
}

.tmatch-icon-empty {
    font-size: 32px !important;
    width: 32px !important;
    height: 32px !important;
    opacity: 0.3;
}

.tmatch-icon-search {
    font-size: 14px !important;
    width: 14px !important;
    height: 14px !important;
    color: var(--mud-palette-text-disabled);
}

/* Modifier for ev-tag that needs right margin without breaking the
   single-property style attribute pattern. */
.tmatch-ev-tag--mr {
    margin-right: 6px;
}

/* Unscheduled day-header treatment — muted icon background + title. */
.tmatch-day-header--unscheduled .tmatch-day-icon {
    background: rgba(128, 128, 128, 0.10);
}

.tmatch-day-header--unscheduled .tmatch-day-title {
    color: var(--mud-palette-text-secondary);
}

/* Row action button cluster (unscheduled matches inline actions). */
.tmatch-row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ════════════════════════════════════════════════════════════
   END ICON UTILITIES
════════════════════════════════════════════════════════════ */

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 880px) {
    .sp-left {
        display: none;
    }
}
