/* athletes.css - roster and athlete record pages */

:root {
    --surface-color: #ffffff;
    --row-hover-bg: #f3f4f6;
    --error-bg: #fee2e2;
    --error-text: #991b1b;
    --stop-border: #dc3545;
    --status-skeleton-bg: #fef3c7;
    --status-skeleton-text: #92400e;
    --status-draft-bg: #dbeafe;
    --status-draft-text: #1e40af;
    --status-approved-bg: #d1fae5;
    --status-approved-text: #065f46;
    --status-missing-bg: #fee2e2;
    --status-missing-text: #991b1b;
    --status-closed-bg: #e0e7ff;
    --status-closed-text: #3730a3;
    --class-h-bg: #fee2e2;
    --class-h-text: #991b1b;
    --class-m-bg: #fef3c7;
    --class-m-text: #92400e;
    --class-l-bg: #d1fae5;
    --class-l-text: #065f46;
    --control-height: 44px;
    --gap-related: 0.75rem;
    --radius: 6px;
    --backdrop: rgba(0, 0, 0, 0.5);
}

/* elements toggled by the hidden attribute stay hidden even when a rule sets display */
.athletes-page [hidden] {
    display: none;
}

.athletes-container {
    max-width: 1100px;
}

.athletes-page .card {
    background: var(--surface-color);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.section-title {
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
}

.subsection-title {
    font-size: 0.95rem;
    margin: 1.25rem 0 0.5rem;
}

.muted {
    color: var(--text-muted);
}

.hint {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* controls: 44 px touch targets */
.athletes-page input,
.athletes-page select {
    min-height: var(--control-height);
}

.athletes-page select {
    background-color: var(--surface-color);
}

.create-form + .hint {
    margin-top: var(--gap-related);
}

.athletes-page input[type="checkbox"] {
    width: 1.25rem;
    min-height: 0;
    height: 1.25rem;
    margin: 0;
    accent-color: var(--primary-color);
}

.athletes-page button {
    min-height: var(--control-height);
    border-radius: var(--radius);
    font-size: 0.875rem;
    white-space: nowrap;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.athletes-page button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.athletes-page .btn-primary {
    padding: 0.75rem 1rem;
    font-weight: 500;
}

.athletes-page .btn-secondary {
    padding: 0.5rem 1rem;
    font-weight: 400;
}

.btn-remove {
    background: var(--surface-color);
    color: var(--error-color);
    border: 1px solid var(--error-color);
    padding: 0.5rem 1rem;
    font-weight: 400;
    align-self: end;
}

.btn-remove:hover {
    background: var(--error-bg);
}

.check-cell,
.check-option {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: var(--control-height);
    min-width: var(--control-height);
    margin: 0;
    cursor: pointer;
    font-weight: 400;
}

.check-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    align-self: end;
    min-height: var(--control-height);
}

.check-group label {
    display: inline-flex;
    align-items: center;
    min-height: var(--control-height);
    margin: 0;
    cursor: pointer;
}

/* the back link is a touch target like any other control */
.athletes-page .app-header .back-link {
    min-height: var(--control-height);
}

.athletes-page .app-header .header-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--control-height);
    color: var(--text-muted);
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.athletes-page .app-header .header-link:hover {
    color: var(--primary-color);
}

/* on a phone the title takes its own row under the links */
@media (max-width: 640px) {
    .athletes-page .app-header {
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
        padding: 0.75rem 1rem;
    }

    .athletes-page .app-header h1 {
        order: 3;
        flex-basis: 100%;
        font-size: 1.15rem;
    }

    /* the avatar alone keeps the links on one row */
    .athletes-page .app-header .user-name {
        display: none;
    }
}

.check-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.25rem;
    margin-bottom: 1rem;
}

/* page error */
.athletes-page .error ul {
    margin: 0.5rem 0 0 1.25rem;
}

/* tables */
.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table thead th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.data-table tbody th {
    font-weight: 500;
}

.data-table tbody th label {
    margin: 0;
    font-weight: 500;
}

.roster-table td,
.status-pill {
    white-space: nowrap;
}

.roster-table tbody tr:hover {
    background: var(--row-hover-bg);
}

.row-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--control-height);
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
}

.row-link:hover {
    text-decoration: underline;
}

.status-pill {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--border-color);
}

.status-skeleton {
    background: var(--status-skeleton-bg);
    color: var(--status-skeleton-text);
}

.status-draft {
    background: var(--status-draft-bg);
    color: var(--status-draft-text);
}

.status-approved,
.athlete-status-approved {
    background: var(--status-approved-bg);
    color: var(--status-approved-text);
}

/* roster status of an athlete: the step the coach takes next */
.athlete-status-filling {
    background: var(--status-skeleton-bg);
    color: var(--status-skeleton-text);
}

.athlete-status-draft_ready {
    background: var(--status-draft-bg);
    color: var(--status-draft-text);
}

.athlete-status-feedback_missing {
    background: var(--status-missing-bg);
    color: var(--status-missing-text);
}

.athlete-status-closed {
    background: var(--status-closed-bg);
    color: var(--status-closed-text);
}

.athlete-status-no_plan {
    color: var(--text-muted);
}

/* day class of a session on the week and feedback pages */
.class-pill {
    display: inline-block;
    min-width: 1.75rem;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

.class-H {
    background: var(--class-h-bg);
    color: var(--class-h-text);
}

.class-M {
    background: var(--class-m-bg);
    color: var(--class-m-text);
}

.class-L {
    background: var(--class-l-bg);
    color: var(--class-l-text);
}

/* a row of panel buttons on the week and feedback pages */
.panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-related);
}

/* create athlete */
.create-form {
    display: flex;
    flex-direction: column;
    gap: var(--gap-related);
}

.create-form .form-group {
    margin-bottom: 0;
}

/* a link that looks like a secondary button */
.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--control-height);
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary-color);
    border-radius: var(--radius);
    color: var(--primary-color);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-link:hover {
    background: var(--row-hover-bg);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* record */
.record-head {
    margin-bottom: 0.75rem;
}

.record-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-related);
    margin-top: 0.5rem;
}

.record-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.athletes-page .record-tab {
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 0.5rem 1.25rem;
    border-bottom: 2px solid transparent;
}

.athletes-page .record-tab:hover:not(:disabled) {
    background: var(--row-hover-bg);
    transform: none;
    box-shadow: none;
}

.athletes-page .record-tab[aria-selected="true"] {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 500;
}

.record-section {
    border: none;
    min-width: 0;
}

.record-section legend {
    font-weight: 600;
    font-size: 1.05rem;
    padding: 0;
    margin-bottom: 0.75rem;
    float: left;
    width: 100%;
}

.record-section legend + * {
    clear: both;
}

.repeat-rows {
    display: flex;
    flex-direction: column;
    gap: var(--gap-related);
    margin-bottom: var(--gap-related);
}

.repeat-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem var(--gap-related);
    padding: var(--gap-related);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-light);
}

.repeat-row .form-group {
    margin-bottom: 0;
}

.repeat-row label {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.capacity-groups {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0 1.5rem;
}

.capacity-table td:last-child,
.capacity-table th:last-child {
    width: 5.5rem;
    text-align: center;
}

.capacity-table td:nth-child(2) {
    width: 9rem;
}

.schedule-table td input,
.schedule-table td select {
    min-width: 6rem;
}

.raw-json {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
    min-height: 24rem;
}

.record-actions {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: var(--gap-related);
    padding: var(--gap-related) 0;
    background: var(--bg-light);
    border-top: 1px solid var(--border-color);
    margin-bottom: 1.25rem;
}

.save-status {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* athlete link panel: the primary actions in a row, revoke on its own row below */
.link-state {
    margin-bottom: var(--gap-related);
}

.link-copy input {
    width: 100%;
    font-family: monospace;
}

.link-copy .hint {
    margin: 0.5rem 0 0;
}

.link-actions,
.link-danger {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gap-related);
}

.link-danger {
    margin-top: var(--gap-related);
    padding-top: var(--gap-related);
    border-top: 1px solid var(--border-color);
}

/* assessment playback */
.playback {
    border-left: 4px solid var(--success-color);
}

.playback-stop {
    border-left-color: var(--stop-border);
}

.playback-lines {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.95rem;
}

@media (min-width: 640px) {
    .create-form {
        flex-direction: row;
        align-items: flex-end;
    }

    .create-form .form-group {
        flex: 1;
        max-width: 24rem;
    }

    .repeat-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .repeat-row .wide {
        grid-column: 1 / -1;
    }
}

@media (min-width: 900px) {
    .goal-row {
        grid-template-columns: repeat(4, 1fr);
    }

    .goal-row .wide {
        grid-column: span 2;
    }

    .injury-row {
        grid-template-columns: 1fr 1fr 2fr auto;
    }

    .injury-row .wide {
        grid-column: auto;
    }

    .capacity-groups {
        grid-template-columns: repeat(2, 1fr);
    }

    .athletes-page .card {
        padding: 1.5rem 2rem;
    }
}
