/* ---------------------------------------------------------------------------
   Lane Coach

   Assenta nos componentes da Lane (lane.css) e muda o que a distingue:
   cabeçalho preto da marca Lane, laranja como cor de ação, e densidade
   pensada para usar com uma mão, durante o treino.

   O laranja de ação é mais escuro do que o do logótipo (#FD4E05) para o
   texto branco dos botões cumprir o contraste mínimo.
   --------------------------------------------------------------------------- */

.surface-coach {
    --brand: #C23C06;
    --brand-hi: #C23C06;
    --brand-soft: #FFF0E7;
    --brand-ink: #7A2604;
    --content-max: 760px;
    --coach-ink: #0B0B0D;
    --coach-cream: #EEECDF;
    --coach-orange: #FD4E05;
}

/* --- Cabeçalho ------------------------------------------------------------ */

.surface-coach .hdr { background: var(--coach-ink); color: var(--coach-cream); }
.surface-coach .hdr__btn { background: rgba(255, 255, 255, .1); color: var(--coach-cream); }
.surface-coach .hdr__btn--plain { background: none; }
.surface-coach .hdr__title strong { color: #fff; }

.coach-brand { display: flex; align-items: center; justify-content: center; color: var(--coach-cream); font-size: 21px; }
.coach-brand .product-logo { font-size: 21px; }

/* --- Números do dia ------------------------------------------------------- */

.coach-hero { background: var(--surface); padding: 16px 20px 14px; border-bottom: 1px solid var(--line); }
.coach-hero__day { font-size: 12px; font-weight: 800; letter-spacing: .1em; color: var(--text-3); text-transform: uppercase; }
.coach-hero__hello { font-size: 26px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; line-height: 1.1; }

.figs { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-bottom: 1px solid var(--line); }
.fig { padding: 12px 16px 13px; border-right: 1px solid var(--line-soft); min-width: 0; }
.fig:last-child { border-right: 0; }
.fig strong { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.fig span { display: block; font-size: 12px; font-weight: 650; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Linhas de treino ----------------------------------------------------- */

.t-time { width: 66px; flex: none; text-align: left; }
.t-time strong { display: block; font-size: 16px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap; }
.t-time span { display: block; font-size: 11.5px; font-weight: 700; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.is-cancelled .row__title { text-decoration: line-through; color: var(--text-3); }

.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.day-head.is-today { color: var(--brand); }

/* --- Presenças ------------------------------------------------------------ */

.att-legend {
    display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 16px;
    background: var(--surface); border-bottom: 1px solid var(--line);
    font-size: 12.5px; font-weight: 650; color: var(--text-2);
}
.att-legend span { display: inline-flex; align-items: center; gap: 6px; }
.att-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.att-row {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px 9px 16px; background: var(--surface);
    border-bottom: 1px solid var(--line-soft);
}
.att-row__body { flex: 1; min-width: 0; }
.att-row__name { display: block; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-row__meta { display: block; font-size: 12.5px; color: var(--text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.att-btns { display: flex; gap: 6px; flex: none; }
.att-btn {
    width: 42px; height: 42px; border-radius: 11px;
    border: 1px solid var(--field-border); background: var(--field);
    display: grid; place-items: center; color: var(--text-3);
    cursor: pointer; touch-action: manipulation;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.att-btn:disabled { cursor: default; opacity: .55; }
.att-btn[aria-pressed="true"][data-estado="presente"]    { background: #1E9E45; border-color: #1E9E45; color: #fff; }
.att-btn[aria-pressed="true"][data-estado="atrasado"]    { background: #A25E00; border-color: #A25E00; color: #fff; }
.att-btn[aria-pressed="true"][data-estado="justificado"] { background: #4A5A78; border-color: #4A5A78; color: #fff; }
.att-btn[aria-pressed="true"][data-estado="ausente"]     { background: #D12A1F; border-color: #D12A1F; color: #fff; }

/* Ainda não confirmado pelo servidor: nunca parece guardado. */
.att-row.is-pending .att-btn[aria-pressed="true"] {
    background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .28) 0 5px, transparent 5px 10px);
}
.att-row.is-pending .att-row__meta::after { content: " · por enviar"; color: var(--warn-ink); font-weight: 700; }

.att-bar {
    position: sticky;
    bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom));
    z-index: 30;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px 10px 16px;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--field-border);
    border-bottom: 1px solid var(--field-border);
}
.att-bar__count { flex: 1; min-width: 0; }
.att-bar__count strong { display: block; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }

.sync { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--text-3); }
.sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.sync--ok { color: var(--ok-ink); }
.sync--busy { color: var(--brand); }
.sync--pending { color: var(--warn-ink); }
.sync--offline { color: var(--danger); }

/* --- Texto de treino ------------------------------------------------------ */

.plan { padding: 14px 20px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.plan__text { font-size: 15px; line-height: 1.55; white-space: pre-wrap; color: #2B2B32; }
.plan__empty { font-size: 14px; color: var(--text-3); }

.note { padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line-soft); }
.note__meta { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--text-3); }
.note__text { font-size: 14.5px; line-height: 1.5; margin-top: 4px; white-space: pre-wrap; }

.vis { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 5px; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.vis--interna { background: #F0F0F4; color: #5A5A63; }
.vis--equipa { background: #E8EEF9; color: #2B4A80; }
.vis--atleta_familia { background: var(--ok-soft); color: var(--ok-ink); }

/* --- Formulários ---------------------------------------------------------- */

.form-block { padding: 14px 20px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.form-block + .form-block { border-top: 0; }
.form-row { display: grid; gap: 12px; margin-top: 14px; }
.form-row:first-child { margin-top: 0; }
/*
 * Dois campos lado a lado — enquanto couberem.
 *
 * Era `1fr 1fr` em qualquer largura: num telemóvel de 320 px davam duas
 * colunas de 138 px, onde uma data já não cabe e o rótulo parte em três
 * linhas. Com auto-fit, as colunas nascem do espaço: há duas quando há
 * espaço para duas, e uma quando não há. Sem breakpoint nenhum, e igual em
 * qualquer telemóvel — que é o que se quer, porque os telemóveis não vêm
 * todos com a mesma largura.
 *
 * O `min(100%, …)` é o que impede o transbordo no caso extremo: numa coluna
 * mais estreita do que o mínimo, o mínimo passa a ser a coluna.
 */
.form-row--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr)); }

/* Três campos (por exemplo: prova, marca, unidade). Mesma regra, mínimo mais
   pequeno porque cada um deles é curto. */
.form-row--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 7.5rem), 1fr)); }

/* Um campo largo seguido de dois estreitos. Abaixo do ponto em que os três
   cabem, empilham. */
.form-row--2-1-1 { grid-template-columns: 2fr 1fr 1fr; }

@media (max-width: 30rem) {
    .form-row--2-1-1 { grid-template-columns: minmax(0, 1fr); }
}
.form-actions-bar { padding: 14px 20px 22px; display: grid; gap: 10px; }

/* --- Entrada -------------------------------------------------------------- */

.coach-auth {
    min-height: 100vh; min-height: 100dvh;
    display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; justify-items: center; gap: 26px;
    padding: calc(28px + env(safe-area-inset-top)) 22px calc(28px + env(safe-area-inset-bottom));
    background:
        radial-gradient(60% 40% at 50% 0%, rgba(253, 78, 5, .16), transparent 70%),
        var(--coach-ink);
    color: var(--coach-cream);
}
.coach-auth__brand { display: grid; justify-items: center; gap: 12px; text-align: center; }
.coach-auth__brand .product-logo { font-size: clamp(24px, 8.4vw, 34px); color: var(--coach-cream); }
.coach-auth__brand p { margin: 0; font-size: 14px; color: #A6A6AF; }
.coach-auth__card { width: 100%; max-width: 400px; background: #fff; color: var(--text); border-radius: 22px; padding: 24px 22px 22px; }
.coach-auth__card h1 { font-size: 21px; letter-spacing: -.02em; }
.coach-auth__club { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #A6A6AF; }
.coach-auth__club img { width: 34px; height: 34px; object-fit: contain; }

/* --- Contexto (Lane · Coach · Club) -------------------------------------- */

.ctx { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; padding: 14px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.ctx__item {
    display: grid; gap: 6px; padding: 14px; border-radius: 14px;
    border: 1px solid var(--field-border); background: var(--field); color: var(--text); text-decoration: none;
}
.ctx__item[aria-current="true"] { border-color: var(--brand); background: var(--brand-soft); }
.ctx__item .product-logo, .ctx__item .lane-logo { font-size: 17px; height: 17px; color: var(--text); }
.ctx__item span { font-size: 12.5px; color: var(--text-2); }

/* --- Ecrãs largos --------------------------------------------------------- */

@media (min-width: 56.25rem) {
    .surface-coach .shell { box-shadow: 0 0 0 1px var(--line); }
    .coach-cols { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
    .coach-cols > div { min-width: 0; }
    .coach-cols > div + div { border-left: 1px solid var(--line); }
}

@media (max-width: 22.4375rem) {
    .att-btn { width: 38px; height: 38px; }
    .att-btns { gap: 4px; }
    .fig { padding-left: 12px; padding-right: 12px; }
}

/* Uma linha de resumo é uma linha: o plano do treino não pode empurrar a
   altura da linha para três vezes o normal. */
.row__meta--uma-linha {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* O nome do grupo também não parte em duas linhas numa lista. */
.surface-coach .row__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Número de staff ------------------------------------------------------ */

.staff-num { text-align: center; padding: 6px 0 2px; }
.staff-num__etiqueta {
    display: block; font-size: 11.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .09em; color: var(--text-3);
}
.staff-num__valor {
    display: block; margin-top: 6px;
    font-size: clamp(30px, 9vw, 38px); font-weight: 800;
    letter-spacing: .16em; font-variant-numeric: tabular-nums; line-height: 1.1;
}

/* O comutador de contexto: os cartões encolhem em vez de empurrarem a página.
   minmax(140px, …) prometia 140 mesmo quando não cabiam — min() dá a promessa
   só quando há espaço para a cumprir. */
.ctx { grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); }
.ctx__item { min-width: 0; }
.ctx__item .product-logo,
.ctx__item .lane-logo { max-width: 100%; }
.ctx__item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
