﻿/* ════════════════════════════════════════════════════════════════
   TournamentDrawsTab.css
   Linked from App.razor.

   Visual vocabulary mirrors TournamentDashboard.css / *EntriesTab.css:
     .tdt-card      — table card shell (= .te-section minus header bar)
     .tdt-status    — pill family (= .te-pill / .td-status-chip family)
     .tdt-btn       — table action button (= .td-icon-btn but with label)
     .tdt-entries   — count + fill bar (= .td-stat progress-bar idea
                                          condensed into a cell)
════════════════════════════════════════════════════════════════ */

.tdt-page {
    font-family: 'DM Sans', sans-serif;
    padding: 4px 0 40px;
}

/* ── Loading / empty ──────────────────────────────────────── */
.tdt-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 48px 24px;
    color: var(--mud-palette-text-secondary);
    font-size: 13px;
}

.tdt-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 72px 24px;
    text-align: center;
}

.tdt-empty-icon {
    font-size: 48px !important;
    width: 48px !important;
    height: 48px !important;
    color: var(--mud-palette-text-disabled);
    opacity: 0.5;
}

.tdt-empty-title {
    font-family: 'Sora', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
}

.tdt-empty-sub {
    font-size: 13px;
    color: var(--mud-palette-text-disabled);
}

/* ════════════════════════════════════════════════════════════
   CARD + TABLE
════════════════════════════════════════════════════════════ */
.tdt-card {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    overflow: hidden;
}

.tdt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.tdt-th {
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--mud-palette-text-secondary);
    padding: 8px 14px;
    background: var(--mud-palette-background-grey);
    border-bottom: 1px solid var(--mud-palette-lines-default);
    white-space: nowrap;
}

.tdt-th--draw {
    width: 130px;
}

.tdt-th--entries {
    width: 160px;
}

.tdt-th--status {
    width: 130px;
}

.tdt-th--action {
    width: 130px;
}

/* ── Rows ─────────────────────────────────────────────────── */
.tdt-row {
    cursor: pointer;
    transition: background 0.12s;
    border-top: 1px solid var(--mud-palette-lines-default);
}

    .tdt-row:hover .tdt-td {
        background: var(--mud-palette-action-hover);
    }

.tdt-row--expanded .tdt-td {
    background: rgba(99,102,241,0.05);
}

.tdt-td {
    padding: 10px 14px;
    vertical-align: middle;
}

.tdt-td--action {
    text-align: right;
    white-space: nowrap;
}

/* ── Event cell ───────────────────────────────────────────── */
.tdt-event-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.tdt-ev-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 7px;
    border-radius: 5px;
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    flex-shrink: 0;
    min-width: 30px;
}

.tdt-ev-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}

.tdt-ev-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.tdt-ev-type {
    font-size: 10px;
    color: var(--mud-palette-text-secondary);
}

.tdt-meta {
    font-size: 11px;
    color: var(--mud-palette-text-secondary);
}

/* ════════════════════════════════════════════════════════════
   ENTRIES — count, cap, fill bar
════════════════════════════════════════════════════════════ */
.tdt-entries {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.tdt-entries-num {
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--mud-palette-text-primary);
}

.tdt-entries-cap {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--mud-palette-text-disabled);
}

.tdt-entries-tag {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: var(--mud-palette-text-disabled);
    margin-left: auto;
    font-weight: 600;
}

.tdt-entries-tag--full {
    color: #0F6E56;
}

.tdt-entries-bar {
    height: 3px;
    background: var(--mud-palette-background-grey);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
    max-width: 140px;
}

.tdt-entries-bar-fill {
    height: 100%;
    background: var(--mud-palette-primary);
    border-radius: 2px;
    transition: width 0.6s cubic-bezier(.4,0,.2,1);
}

.tdt-entries-bar-fill--full {
    background: #1D9E75;
}

.tdt-entries-unpaired {
    font-size: 10px;
    font-weight: 600;
    margin-top: 2px;
    color: color-mix(in srgb, var(--mud-palette-warning) 45%, var(--mud-palette-text-primary));
}

/* ════════════════════════════════════════════════════════════
   STAGE PIPELINE — pills + status dot
════════════════════════════════════════════════════════════ */
.tdt-pipeline {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.tdt-arrow {
    font-size: 11px;
    color: var(--mud-palette-text-disabled);
}

.tdt-no-stages {
    font-size: 11px;
    color: var(--mud-palette-text-disabled);
    font-style: italic;
}

.tdt-stage-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    border: 1px solid;
    position: relative;
}

/* Stage type palette — same hues as before, slightly tightened. */
.tdt-stage-qualifying {
    background: rgba(186,117,23,0.10);
    border-color: rgba(186,117,23,0.35);
    color: #BA7517;
}

.tdt-stage-groupstage {
    background: rgba(53,138,221,0.10);
    border-color: rgba(53,138,221,0.35);
    color: #185FA5;
}

.tdt-stage-knockout {
    background: rgba(99,102,241,0.10);
    border-color: rgba(99,102,241,0.35);
    color: var(--mud-palette-primary);
}

.tdt-stage-roundrobin {
    background: rgba(29,158,117,0.10);
    border-color: rgba(29,158,117,0.35);
    color: #0F6E56;
}

.tdt-stage-swiss {
    background: rgba(212,83,126,0.10);
    border-color: rgba(212,83,126,0.35);
    color: #993556;
}

.tdt-stage-boxleague {
    background: rgba(127,119,221,0.10);
    border-color: rgba(127,119,221,0.35);
    color: #534AB7;
}

/* Stage state — affects saturation so the operator's eye lands on
   the running stage. Completed stages fade slightly; planned ones
   keep base appearance. */
.tdt-stage-pill--running {
    /* Slight saturation bump so the running stage feels "live" */
    filter: saturate(1.15);
}

.tdt-stage-pill--completed {
    opacity: 0.65;
}

.tdt-stage-pill--planned {
    /* Base state — no modifier */
}

/* Status dot in pill corner */
.tdt-stage-dot {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1.5px solid var(--mud-palette-surface);
}

.tdt-stage-dot--running {
    background: #1D9E75;
}

.tdt-stage-dot--completed {
    background: var(--mud-palette-primary);
}

/* Pulse on the running dot — same animation as dashboard live pill */
.tdt-stage-dot--running {
    animation: tdt-dot-pulse 1.8s ease-in-out infinite;
}

@keyframes tdt-dot-pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.45;
    }
}

/* ════════════════════════════════════════════════════════════
   OVERALL STATUS pill — same family as dashboard .td-status-chip
════════════════════════════════════════════════════════════ */
.tdt-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 20px;
    border: 1px solid;
    white-space: nowrap;
}

.tdt-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.tdt-status--green {
    background: rgba(29,158,117,0.12);
    color: #0F6E56;
    border-color: rgba(29,158,117,0.25);
}

.tdt-status--amber {
    background: rgba(232,169,74,0.10);
    color: #B07820;
    border-color: rgba(232,169,74,0.30);
}

.tdt-status--purple {
    background: rgba(99,102,241,0.10);
    color: var(--mud-palette-primary);
    border-color: rgba(99,102,241,0.25);
}

.tdt-status--grey {
    background: var(--mud-palette-background-grey);
    color: var(--mud-palette-text-secondary);
    border-color: var(--mud-palette-lines-default);
}

/* ════════════════════════════════════════════════════════════
   ACTION BUTTON — contextual Generate vs View
════════════════════════════════════════════════════════════ */
.tdt-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--mud-palette-lines-default);
    background: transparent;
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
    outline: none;
    transition: background 0.13s, color 0.13s, border-color 0.13s;
}

    .tdt-btn:focus,
    .tdt-btn:focus-visible {
        outline: none;
    }

    .tdt-btn:hover {
        background: var(--mud-palette-action-default-hover);
        color: var(--mud-palette-text-primary);
    }

/* ════════════════════════════════════════════════════════════
   DETAIL PANEL (inline expanded EventDrawStagesTab)
════════════════════════════════════════════════════════════ */
.tdt-detail-row .tdt-detail-td {
    padding: 0;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    border-left: 3px solid var(--mud-palette-primary);
}

.tdt-detail-panel {
    padding: 20px;
    background: var(--mud-palette-surface);
}

.tdt-draw-host {
    /* Container for the embedded EventDrawStagesTab — keeps its own
       styling intact. */
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 880px) {
    .tdt-th--draw,
    .tdt-td:nth-child(2) {
        display: none;
    }

    .tdt-th--entries {
        width: 120px;
    }
}
