/* ============================================
   PITCHU SPORT - Mesures, photos & data (V3)
   Complète budget.css (variables, boutons, modales, toasts)
   Pensé d'abord pour ORDINATEUR (tableaux larges, grandes photos),
   mais reste utilisable sur mobile.
   ============================================ */

.sport-main {
    max-width: 1100px;
    margin: 0 auto;
}

/* ============================================
   SÉLECTEUR DE PERSONNE
   ============================================ */
.sport-people {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.sport-person {
    padding: 0.45rem 1rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sport-person:hover { background: var(--bg-card-hover); }

.sport-person.active.pawel {
    background: var(--pawel-light);
    border-color: var(--pawel);
    color: var(--pawel);
}

.sport-person.active.seb {
    background: var(--seb-light);
    border-color: var(--seb);
    color: var(--seb);
}

/* ============================================
   ONGLETS
   ============================================ */
.sport-tabs {
    display: flex;
    gap: 0.4rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0.3rem;
    margin-bottom: 1.5rem;
}

.sport-tab {
    flex: 1;
    padding: 0.55rem 0.5rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.sport-tab:hover { background: var(--bg-card-hover); }

.sport-tab.active {
    background: var(--accent);
    color: #fff;
}

/* ============================================
   TEXTES / BLOCS GÉNÉRAUX
   ============================================ */
.sport-count {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.sport-hint {
    font-size: 0.83rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.sport-empty {
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem 1rem;
    font-size: 0.9rem;
    line-height: 1.8;
    margin-bottom: 1.2rem;
}

.sport-h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 1.6rem 0 0.8rem;
}

/* ============================================
   CARTES « DERNIÈRES VALEURS »
   ============================================ */
.sport-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.7rem;
    margin-bottom: 1.4rem;
}

.sport-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
}

.sport-stat.vide { opacity: 0.45; }

.sport-stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sport-stat-valeur {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}

.sport-stat-unite {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 0.2rem;
}

.sport-stat-bas {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.4rem;
    margin-top: 0.35rem;
    flex-wrap: wrap;
}

.sport-stat-date {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.sport-delta {
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.sport-delta.bon     { color: var(--accent-green); }
.sport-delta.mauvais { color: var(--accent-red); }
.sport-delta.neutre  { color: var(--text-muted); }

/* ============================================
   GRAPHIQUE D'ÉVOLUTION
   ============================================ */
.sport-chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    margin-bottom: 1.4rem;
}

.sport-chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
}

.sport-chart-head h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.sport-chart-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sport-chart-select {
    width: auto;
    min-width: 220px;
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
}

.sport-chart-periode {
    width: auto;
    min-width: 170px;
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
}

/* Les deux dates de la période personnalisée (masquées par défaut) */
.sport-chart-perso {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sport-chart-perso label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    margin: 0;
}

.sport-chart-perso input {
    width: auto;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

.sport-chart-legende {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5rem;
}

.sport-chart svg {
    display: block;
    width: 100%;
    height: auto;
}

.sport-chart-grille {
    stroke: var(--border);
    stroke-width: 1;
    stroke-dasharray: 3 4;
}

.sport-chart-texte {
    fill: var(--text-muted);
    font-size: 12px;
    font-family: inherit;
}

.sport-chart-ligne {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.5;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.sport-chart-point {
    fill: var(--bg-card);
    stroke: var(--accent);
    stroke-width: 2;
}

.sport-chart-vide {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 1.5rem 0;
}

/* ============================================
   TABLEAU HISTORIQUE (Mesures + Data)
   ============================================ */
.sport-table-wrap {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.4rem;
}

/* Historique Renpho : 600+ lignes. On borne la hauteur et on défile à
   l'intérieur — l'en-tête reste visible (position: sticky sur les th). */
.sport-table-long {
    max-height: 65vh;
    overflow-y: auto;
}

.sport-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    min-width: 900px;
}

.sport-table th {
    position: sticky;
    top: 0;
    background: var(--bg);
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    padding: 0.6rem 0.65rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.sport-th-unite {
    display: block;
    font-weight: 500;
    opacity: 0.7;
    text-transform: none;
}

.sport-table td {
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
}

.sport-table tbody tr:last-child td { border-bottom: none; }
.sport-table tbody tr:hover td { background: var(--bg-card-hover); }

.sport-td-date {
    font-weight: 600;
}

.sport-td-annee {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
}

.sport-td-vide { color: var(--text-muted); opacity: 0.5; }

.sport-td-note {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
    color: var(--text-secondary);
}

/* Badges de source (Data) */
.badge-renpho {
    background: var(--accent-light);
    color: var(--accent);
}

.badge-manuel {
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* ============================================
   PHOTOS
   ============================================ */
.sport-photo-groupe {
    margin-bottom: 1.8rem;
}

.sport-photo-date {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.7rem;
}

.sport-photo-date strong {
    font-size: 0.98rem;
    color: var(--text);
}

.sport-photo-date strong::first-letter { text-transform: uppercase; }

.sport-photo-date span {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.sport-photo-grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.7rem;
}

.sport-photo {
    margin: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: zoom-in;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.sport-photo:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.sport-photo img {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    background: var(--bg);
}

.sport-photo figcaption {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Aperçu dans la modale d'ajout */
.sport-photo-preview {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

.sport-photo-preview img {
    width: 72px;
    height: 96px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.sport-photo-progress {
    margin-top: 0.6rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* ============================================
   LIGHTBOX
   ============================================ */
.sport-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 20, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    z-index: 300;
    padding: 1.2rem;
}

.sport-lightbox.visible { display: flex; }

.sport-lightbox-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    max-width: min(92vw, 760px);
    max-height: 94vh;
}

.sport-lightbox-body img {
    max-width: 100%;
    max-height: 78vh;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.sport-lightbox-caption {
    color: #e5e7eb;
    font-size: 0.88rem;
    text-align: center;
}

.sport-lightbox-caption::first-letter { text-transform: uppercase; }

.sport-lightbox-close {
    position: absolute;
    top: 0.9rem;
    right: 1.1rem;
    background: none;
    border: none;
    color: #e5e7eb;
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
}

.sport-lightbox-nav {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e5e7eb;
    font-size: 1.9rem;
    line-height: 1;
    border-radius: var(--radius-full);
    width: 2.9rem;
    height: 2.9rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.sport-lightbox-nav:hover { background: rgba(255, 255, 255, 0.2); }

.sport-lightbox-delete { flex-shrink: 0; }

/* ============================================
   MODALES
   ============================================ */
.sport-modal { max-width: 640px; }

.sport-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.5rem 0.8rem;
}

.sport-form-grid .form-group { margin-bottom: 0.4rem; }

.sport-form-grid label {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.field-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* ============================================
   MOBILE (utilisable, même si pensé ordinateur)
   ============================================ */
@media (max-width: 640px) {
    .sport-tab { font-size: 0.75rem; padding: 0.5rem 0.25rem; }
    .sport-stats-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .sport-stat-valeur { font-size: 1.15rem; }
    .sport-photo-grille { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .sport-form-grid { grid-template-columns: repeat(2, 1fr); }
    .sport-lightbox-nav { width: 2.3rem; height: 2.3rem; font-size: 1.5rem; }
}
