/* ======================================================================
   Vidéothèque — Direction A « Console ».
   Le fichier conserve TOUS les noms de classes (couplés au JS Stimulus,
   aux Live Components et aux tests). Les variables --vid-* sont aliasées
   sur les tokens Direction A (tokens.css) → palette indigo + dark mode
   automatique. Les pages publiques /v/{token} (.ephemeral-page) forment
   un îlot sombre « cinéma » auto-contenu (cf. plus bas).
   ====================================================================== */

:root {
    --vid-brand:        var(--accent);
    --vid-brand-dark:   color-mix(in srgb, var(--accent) 84%, #000);
    --vid-brand-light:  var(--accent-soft);
    --vid-accent:       var(--accent);
    --vid-ink:          var(--text);
    --vid-text:         var(--text);
    --vid-muted:        var(--muted);
    --vid-line:         var(--border);
    --vid-field-bg:     var(--surface-2);
    --vid-surface:      var(--surface);
    --vid-danger:       var(--danger);
    --vid-danger-bg:    var(--danger-soft);
    --vid-radius:       var(--radius);
    --vid-radius-lg:    var(--radius-card);
    --vid-shadow:       var(--shadow);
    --vid-shadow-hover: var(--shadow);
}

/* ===== Search bar ===== */
.video-search-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    padding: 0;
    margin-bottom: 1.5rem;
}

.video-search-input {
    flex: 1 1 auto;
    min-width: 13.75rem;
    max-width: none;
    height: 2.875rem;
    padding: 0 0.95rem 0 2.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9aa6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.2-3.2'/%3E%3C/svg%3E") no-repeat 0.875rem center;
    background-size: 1.125rem 1.125rem;
    -webkit-appearance: none;
    appearance: none;
    font: inherit;
    font-size: 0.92rem;
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.video-search-input::-webkit-search-decoration,
.video-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.video-search-input::placeholder { color: var(--faint); }

.video-search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 0.1875rem var(--ring);
}

/* ===== Filter dropdown ===== */
.video-filter-dropdown {
    position: relative;
}

.video-filter-dropdown__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 2.75rem;
    padding: 0 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    user-select: none;
    list-style: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.video-filter-dropdown__toggle:hover {
    border-color: var(--border-strong);
}

.video-filter-dropdown__toggle::-webkit-details-marker {
    display: none;
}

.video-filter-dropdown__toggle::after {
    content: "▾";
    font-size: 0.7rem;
    color: var(--faint);
}

.video-filter-dropdown[open] .video-filter-dropdown__toggle {
    border-color: var(--accent);
    color: var(--accent);
}

.video-filter-dropdown__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.125rem;
    height: 1.125rem;
    padding: 0 0.3125rem;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: var(--accent-fg);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
}

.video-filter-dropdown__menu {
    position: absolute;
    top: calc(100% + 0.375rem);
    right: 0;
    z-index: 100;
    min-width: 15rem;
    max-height: 17.5rem;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.4rem 0;
}

.video-filter-dropdown__item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}

.video-filter-dropdown__item:hover {
    background: var(--surface-2);
}

.video-filter-dropdown__item input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent);
    cursor: pointer;
}

.video-filter-dropdown__separator {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.25rem 0;
}

/* Action « Réinitialiser » en bas du menu Groupes (pleine largeur). */
.video-filter-dropdown__reset {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.55rem 1rem;
    border: none;
    background: none;
    color: var(--danger);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
}

.video-filter-dropdown__reset:hover {
    background: var(--danger-soft);
}

/* ===== Pagination ===== */
.video-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 2rem 0 1rem;
}

.video-pagination__btn {
    padding: 0.5rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    transition: border-color 0.15s ease, color 0.15s ease;
}

.video-pagination__btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.video-pagination__info {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--muted);
}

/* ===== Layout grille ===== */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
    gap: 1.25rem;
}

.videos-empty {
    padding: 2.5rem 0;
    color: var(--faint);
}

/* ===== Boutons header ===== */
.video-upload-btn,
.video-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: filter 0.15s ease, transform 0.12s ease, border-color 0.15s ease, color 0.15s ease;
}
.video-upload-btn svg,
.video-back-btn svg { width: 1rem; height: 1rem; }

/* Bouton primaire (action principale) */
.video-upload-btn {
    background: var(--accent);
    color: var(--accent-fg);
    border: 1px solid var(--accent);
    box-shadow: var(--shadow);
}

.video-upload-btn:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
}

/* Bouton secondaire (retour, navigation) */
.video-back-btn {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.video-back-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ===== Card vidéo ===== */
.video-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.16s ease, border-color 0.16s ease;
}

.video-card:hover {
    transform: translateY(-0.125rem);
    border-color: var(--border-strong);
}

.video-card__thumbnail {
    position: relative;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #26263a, #141420);
    overflow: hidden;
}

.video-card__thumbnail img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Voile haut + bas pour la lisibilité des pastilles posées sur la miniature */
.video-card__thumbnail::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.30), rgba(0, 0, 0, 0) 32%, rgba(0, 0, 0, 0) 58%, rgba(0, 0, 0, 0.42));
    pointer-events: none;
    z-index: 1;
}

/* Lien couvrant la miniature -> page de lecture */
.video-card__thumb-link {
    position: absolute;
    inset: 0;
    z-index: 3;
    cursor: pointer;
}

/* Bouton lecture central */
.video-card__play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 3.375rem;
    height: 3.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.55);
    color: #fff;
    backdrop-filter: blur(0.125rem);
    pointer-events: none;
    transition: transform 0.16s ease, background 0.16s ease;
}
.video-card__play svg { width: 1.375rem; height: 1.375rem; margin-left: 0.125rem; }

.video-card:hover .video-card__play {
    transform: translate(-50%, -50%) scale(1.07);
    background: rgba(255, 255, 255, 0.28);
}

/* Pastilles posées sur la miniature */
.video-card__badges {
    position: absolute;
    z-index: 2;
    display: flex;
    gap: 0.375rem;
    max-width: calc(100% - 1.25rem);
}
.video-card__badges--tl { top: 0.625rem; left: 0.625rem; flex-wrap: wrap; }
.video-card__badges--tr {
    top: 0.625rem;
    right: 0.625rem;
    flex-direction: column;
    align-items: flex-end;
}

.video-card__badges .video-status,
.video-card__badges .video-visibility {
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Variantes solides (lisibles par-dessus l'image) */
.video-card__badges .video-status--ready       { background: var(--positive); color: #fff; }
.video-card__badges .video-status--transcoding { background: var(--warning);  color: #1a1205; }
.video-card__badges .video-status--failed       { background: var(--danger);   color: #fff; }
.video-card__badges .video-status--pending {
    background: rgba(18, 18, 26, 0.62);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.18);
}
.video-card__badges .video-visibility--private {
    background: rgba(18, 18, 26, 0.62);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.18);
}
.video-card__badges .video-visibility--groups   { background: var(--accent);  color: var(--accent-fg); }

/* Durée (coin bas droit) */
.video-card__duration {
    position: absolute;
    right: 0.625rem;
    bottom: 0.625rem;
    z-index: 2;
    padding: 0.125rem 0.4375rem;
    border-radius: 0.375rem;
    background: rgba(8, 8, 12, 0.80);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.video-card__body {
    padding: 1.05rem 1.1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.video-card__title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.0125rem;
    margin: 0;
    color: var(--text);
}

.video-card__meta {
    font-size: 0.8rem;
    color: var(--muted);
    margin: 0;
}

.video-card__watch-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    height: 2.625rem;
    padding: 0 1rem;
    background: var(--accent);
    color: var(--accent-fg);
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: var(--shadow);
    transition: filter 0.15s ease, transform 0.12s ease;
}
.video-card__watch-btn svg { width: 0.9375rem; height: 0.9375rem; }

.video-card__watch-btn:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
}

/* ===== Badges de statut (look .badge) ===== */
.video-status {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.5625rem;
    border-radius: var(--radius-pill);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.video-status--pending     { background: var(--surface-2);    color: var(--faint); }
.video-status--transcoding { background: var(--warning-soft); color: var(--warning); }
.video-status--ready       { background: var(--positive-soft); color: var(--positive); }
.video-status--failed      { background: var(--danger-soft);  color: var(--danger); }

/* ===== Formulaire d'upload ===== */
.video-upload-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    padding: 1.75rem;
}

.video-upload-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 1.3rem;
}

.video-upload-label {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text);
}

.video-upload-input {
    padding: 0 0.95rem;
    height: 2.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    font: inherit;
    font-size: 0.92rem;
    color: var(--text);
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.video-upload-input::placeholder { color: var(--faint); }

.video-upload-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 0.1875rem var(--ring);
}

textarea.video-upload-input {
    height: auto;
    padding: 0.7rem 0.95rem;
    line-height: 1.5;
    resize: vertical;
}

/* L'input de type file a besoin d'un padding vertical (pas de height fixe) */
input[type="file"].video-upload-input {
    height: auto;
    padding: 0.6rem 0.95rem;
    line-height: 1.6;
}

.video-upload-hint {
    font-size: 0.8rem;
    color: var(--faint);
}

.video-upload-progress {
    height: 0.5rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.video-upload-progress__bar {
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-pill);
    transition: width 0.3s ease;
    width: 0%;
}

/* Phase transcodage : barre pleine animée en stripes */
@keyframes stripes {
    from { background-position: 1rem 0; }
    to   { background-position: 0 0; }
}

.video-upload-progress__bar.is-transcoding {
    background: repeating-linear-gradient(
        45deg,
        var(--accent) 0px,
        var(--accent) 0.625rem,
        color-mix(in srgb, var(--accent) 78%, #000) 0.625rem,
        color-mix(in srgb, var(--accent) 78%, #000) 1.25rem
    );
    background-size: 1rem 1rem;
    animation: stripes 0.6s linear infinite;
    transition: width 0.8s ease;
}

.video-upload-status {
    font-size: 0.9rem;
    color: var(--text);
    min-height: 1.25rem;
    margin: 0;
}

.video-upload-info {
    font-size: 0.8rem;
    color: var(--muted);
    min-height: 1rem;
    margin: -0.25rem 0 1rem;
}

.video-upload-submit {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.7rem 1.5rem;
    background: var(--accent);
    color: var(--accent-fg);
    border: none;
    border-radius: var(--radius);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: filter 0.15s ease, transform 0.12s ease;
}

.video-upload-submit svg { width: 1rem; height: 1rem; }

/* Dans un bloc-formulaire pleine largeur, le bouton de validation va à droite
   (téléverser, nouveau/éditer rôle, nouveau/éditer groupe…). Les pages de
   déverrouillage (mot de passe) n'utilisent pas .video-upload-wrapper → non touchées. */
.video-upload-wrapper .video-upload-submit {
    display: flex;
    width: fit-content;
    margin-left: auto;
}

/* Zone de danger (édition rôle / groupe) : titre + bouton alignés à droite */
.video-danger-zone { text-align: right; }
.video-danger-zone form { display: flex; justify-content: flex-end; }

.video-upload-submit:hover:not(:disabled) {
    filter: brightness(1.07);
    transform: translateY(-1px);
}

.video-upload-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

/* Bouton « Téléverser » + « Annuler » (affiché pendant l'upload) */
.video-upload-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

/* ===== Page de lecture ===== */
.video-watch-body {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.video-watch-left {
    flex: 1;
    min-width: 0;
}

/* ===== Panneau admin (colonne droite) ===== */
.video-watch-admin {
    width: 19.375rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.video-admin-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 1.1rem;
    background: var(--surface);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.video-admin-section--danger {
    border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
    background: var(--danger-soft);
    box-shadow: none;
}

.video-admin-section__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--faint);
    margin: 0 0 0.85rem;
}

.video-admin-section--danger .video-admin-section__title {
    color: var(--danger);
}

.video-admin-checkbox-group {
    margin-bottom: 0.75rem;
}

.video-admin-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text);
    padding: 0.2rem 0;
    cursor: pointer;
}

.video-admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: var(--accent-fg);
    border: none;
    border-radius: var(--radius);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: filter 0.15s ease, transform 0.12s ease;
}

.video-admin-btn:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
}

.video-admin-feedback {
    font-size: 0.8rem;
    margin: 0.5rem 0 0;
}

.video-admin-feedback--ok {
    color: var(--positive);
}

.video-admin-feedback--error {
    color: var(--danger);
}

/* ===== Page de lecture — ancien wrapper (compat) ===== */
.video-watch-wrapper {
    max-width: 60rem;
}

.video-player {
    background: #000;
    border-radius: var(--radius-card);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow);
}

.video-player__element {
    width: 100%;
    display: block;
    aspect-ratio: 16 / 9;
}

.video-player__error {
    padding: 1rem;
    color: #ff6b6b;
    text-align: center;
    background: #111;
}

.video-player__quality {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    z-index: 10;
}

.video-player__quality-btn {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.5rem;
    padding: 0.2rem 0.5rem;
    font: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
}

.video-player__quality-btn:hover {
    background: rgba(0, 0, 0, 0.85);
}

.video-player__quality-btn--active {
    background: rgba(255, 255, 255, 0.22);
    border-color: #fff;
    font-weight: 600;
}

.video-watch-meta {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.video-watch-meta__date,
.video-watch-meta__duration {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0;
}

.video-watch-meta__description {
    margin: 0.5rem 0 0;
    color: var(--text);
    line-height: 1.55;
}

/* ===== Édition inline du titre ===== */
.video-edit-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.video-edit-title-input {
    font: inherit;
    font-size: 1.4rem;
    font-weight: 700;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.3rem 0.6rem;
    flex: 1;
    min-width: 0;
    background: var(--surface);
    color: var(--text);
}

.video-edit-title-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 0.1875rem var(--ring);
}

.video-edit-title-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.4375rem;
    color: var(--faint);
    flex-shrink: 0;
    transition: color 0.15s ease, background 0.15s ease;
}
.video-edit-title-btn svg { width: 1rem; height: 1rem; }

.video-edit-title-btn:hover {
    color: var(--accent);
    background: var(--surface-2);
}

.video-edit-title-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 0.25rem;
}

/* ===== Actions admin ===== */
.video-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.video-card__actions {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    margin-top: auto;
}
.video-card__actions > div { display: flex; }

/* Bouton suppression de la carte : icône seule, carré (scopé à la grille).
   Hauteur fixe = même carré que la vidéo soit prête (à côté de « Regarder »)
   ou en transcodage (bouton seul). */
.video-card__actions .video-btn-delete--small {
    width: 2.625rem;
    height: 2.625rem;
    padding: 0;
    justify-content: center;
    flex-shrink: 0;
}
.video-card__actions .video-btn-delete--small svg { width: 1rem; height: 1rem; }

.video-btn-delete {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.video-btn-delete:hover {
    background: var(--danger);
    color: #fff;
}

.video-btn-delete--small {
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
}
.video-btn-delete--small svg { width: 0.875rem; height: 0.875rem; }

.video-btn-cancel {
    padding: 0.5rem 1rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.video-btn-cancel:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}

/* ===== Modale de confirmation ===== */
.video-confirm-dialog {
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 1.75rem;
    max-width: 26.25rem;
    width: 90%;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1.5rem 3.75rem -1.25rem rgba(0, 0, 0, 0.5);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.video-confirm-dialog::backdrop {
    background: rgba(8, 8, 12, 0.5);
    backdrop-filter: blur(0.125rem);
}

.video-confirm-dialog p {
    margin: 0 0 1.25rem;
    color: var(--text);
    line-height: 1.5;
}

.video-confirm-dialog__actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ===== Badges d'accès (index vidéos) ===== */
.video-visibility {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.5625rem;
    border-radius: var(--radius-pill);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: middle;
}

.video-visibility--private  { background: var(--surface-2);   color: var(--faint); }
.video-visibility--groups   { background: var(--accent-soft); color: var(--accent); }

/* ===== Page d'unlock ===== */
.video-unlock-wrapper {
    max-width: 27.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    padding: 1.75rem;
}

.video-unlock-desc {
    margin: 0 0 1.25rem;
    color: var(--muted);
    line-height: 1.5;
}

.video-unlock-error {
    padding: 0.7rem 1rem;
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* ===== Carte unlock éphémère (sur page sombre) ===== */
.ephemeral-unlock-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 2rem 2.25rem 2.25rem;
    width: 100%;
    max-width: 25rem;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.5);
}

.ephemeral-unlock-card__header {
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.ephemeral-unlock-card__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.3rem;
}

.ephemeral-unlock-card__subtitle {
    font-size: 0.875rem;
    color: var(--muted);
    margin: 0;
}

.ephemeral-unlock-card__desc {
    font-size: 0.875rem;
    color: var(--muted);
    margin: 0 0 1.5rem;
    line-height: 1.5;
}

/* Bouton secondaire « Renvoyer le code » (subdued + état désactivé pendant le cooldown) */
.reset-resend-btn {
    display: inline-block;
    padding: 0.5rem 1.1rem;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.reset-resend-btn:hover:not(:disabled) {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.reset-resend-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    color: var(--muted);
}

/* ===== Groupes d'accès — tableau (look .data-table) ===== */
.video-group-table-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.video-group-table th,
.video-group-table td {
    padding: 0.85rem 1.1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.video-group-table tbody tr:last-child td {
    border-bottom: none;
}

.video-group-table tbody tr {
    transition: background 0.12s ease;
}

.video-group-table tbody tr:hover {
    background: var(--surface-2);
}

.video-group-table th {
    font-weight: 700;
    color: var(--faint);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--surface-2);
}

.video-group-table__actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Boutons-icônes de la colonne Actions (visualiser / modifier / supprimer) */
.video-group-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s, transform 0.15s;
}

.video-group-action svg {
    width: 1.05rem;
    height: 1.05rem;
}

.video-group-action:hover {
    transform: translateY(-1px);
}

/* Code couleur sémantique par action */
.video-group-action--view { color: var(--accent); }
.video-group-action--edit { color: #ffa600; }
.video-group-action--delete { color: var(--danger); }

.video-group-action--view:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.video-group-action--edit:hover {
    border-color: var(--warning);
    background: var(--warning-soft);
}

.video-group-action--delete:hover {
    border-color: var(--danger);
    background: var(--danger-soft);
}

.video-group-link {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

.video-group-link:hover {
    color: var(--accent);
}

.video-group-description {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0 0 1rem;
}

.video-group-show-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.video-group-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    padding: 1.1rem;
}

.video-group-panel__title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--faint);
    margin: 0 0 0.85rem;
}

.video-group-list {
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
}

.video-group-list--compact {
    margin-bottom: 0.5rem;
}

.video-group-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    gap: 0.5rem;
}

.video-group-item:last-child {
    border-bottom: none;
}

.video-group-empty {
    font-size: 0.85rem;
    color: var(--faint);
    margin: 0 0 0.75rem;
}

.video-group-add-form {
    margin-top: 0.75rem;
}

.video-group-select {
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text);
}

.video-group-manage-link {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted);
    margin-left: 0.4rem;
    text-decoration: none;
}

.video-group-manage-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.video-admin-btn--add {
    width: 100%;
    text-align: left;
    justify-content: flex-start;
    font-size: 0.84rem;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

.video-admin-btn--add:hover {
    background: var(--accent-soft);
    color: var(--accent);
    filter: none;
    transform: none;
}

.video-admin-btn--small {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
}

/* ===== Liens externes — liste compacte (panneau watch) ===== */
.video-share-link-list {
    list-style: none;
    margin: 0 0 0.5rem;
    padding: 0;
}

.video-share-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.video-share-link:last-child {
    border-bottom: none;
}

.video-share-link__info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.video-share-link__label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-share-link__meta {
    font-size: 0.75rem;
    color: var(--faint);
}

.video-share-link .video-admin-btn--small {
    flex-shrink: 0;
}

/* ===== Liens éphémères — panneau admin ===== */
.video-ephemeral-create {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* Le bouton « Générer » garde sa largeur naturelle (padding habituel) et se
   place à droite du bloc. */
.video-ephemeral-create .video-admin-btn {
    align-self: flex-end;
}

.video-ephemeral-select,
.video-ephemeral-input {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
}
.video-ephemeral-select:focus,
.video-ephemeral-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 0.1875rem var(--ring);
}

/* Flèche personnalisée du select, avec une marge à droite (moins collée au bord). */
.video-ephemeral-select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 2.2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9aa6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 0.7rem;
}

.video-ephemeral-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.video-ephemeral-empty {
    font-size: 0.82rem;
    color: var(--faint);
}

.video-ephemeral-item {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.7rem;
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.video-ephemeral-item__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
    align-items: center;
}

.video-ephemeral-item__actions {
    display: flex;
    gap: 0.4rem;
}

.video-ephemeral-status {
    font-weight: 700;
    font-size: 0.72rem;
}

.video-ephemeral-status--valid   { color: var(--positive); }
.video-ephemeral-status--invalid { color: var(--danger); }

.video-ephemeral-expiry,
.video-ephemeral-views {
    color: var(--muted);
}

.video-ephemeral-label {
    font-style: italic;
    color: var(--muted);
}

/* ===== Page de gestion des liens éphémères ===== */
.video-manage-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.video-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--muted);
}

.video-breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.video-breadcrumb a:hover {
    text-decoration: underline;
}

.video-breadcrumb__sep {
    color: var(--faint);
}

/* Conteneur à défilement horizontal pour le tableau des liens générés :
   sur écrans étroits, le tableau défile à l'intérieur sans déborder du parent. */
.video-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.video-ephemeral-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.video-ephemeral-table th,
.video-ephemeral-table td {
    padding: 0.7rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.video-ephemeral-table th {
    background: var(--surface-2);
    font-weight: 700;
    color: var(--faint);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
}

.video-ephemeral-table tbody tr:last-child td {
    border-bottom: none;
}

.video-ephemeral-table tbody tr:hover {
    background: var(--surface-2);
}

.video-ephemeral-row--invalid td {
    opacity: 0.55;
}

.video-ephemeral-date {
    white-space: nowrap;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.video-ephemeral-author {
    font-size: 0.8rem;
    color: var(--text);
    max-width: 11.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-ephemeral-url {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.4375rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--muted);
    background: var(--surface-2);
    cursor: text;
}

.video-ephemeral-table .video-ephemeral-url {
    width: 16.25rem;
}

.video-ephemeral-table .video-ephemeral-item__actions {
    white-space: nowrap;
}

/* ======================================================================
   PAGES PUBLIQUES /v/{token} — îlot sombre « cinéma » auto-contenu.
   On redéfinit les tokens Direction A sur .ephemeral-page : tous les
   descendants (y compris les alias --vid-*) résolvent en sombre, quel
   que soit le thème global de l'utilisateur.
   ====================================================================== */
.ephemeral-page {
    --bg: #0a0a0d;
    --surface: #141418;
    --surface-2: #1c1c22;
    --border: #27272e;
    --border-strong: #37373f;
    --text: #f3f3f6;
    --muted: #9d9daa;
    --faint: #6c6c79;
    --accent: #8585f0;
    --accent-fg: #ffffff;
    --accent-soft: #222240;
    --positive: #3fc97c;
    --positive-soft: #142a1f;
    --warning: #e3ad48;
    --warning-soft: #2a2110;
    --danger: #f06a6a;
    --danger-soft: #2c1616;
    --ring: rgba(133, 133, 240, 0.45);
    --shadow: 0 1px 0.125rem rgba(0, 0, 0, 0.5), 0 0.625rem 1.75rem -0.875rem rgba(0, 0, 0, 0.7);

    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ephemeral-wrapper {
    width: 100%;
    max-width: 56.25rem;
    padding: 2rem 1.5rem;
}

.ephemeral-wrapper--expired {
    text-align: center;
}

.ephemeral-title {
    color: var(--text);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.0187rem;
    margin-bottom: 0.25rem;
}

.ephemeral-label {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.ephemeral-meta {
    margin-top: 0.75rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.ephemeral-expires {
    margin-top: 0.25rem;
}

.ephemeral-reason {
    color: var(--danger);
    font-size: 1.1rem;
    margin-top: 1rem;
}

/* ======================================================================
   RESPONSIVE — tablette & mobile
   ====================================================================== */

/* Tablette : la page de lecture passe en colonne (lecteur puis panneau) */
@media (max-width: 992px) {
    .video-watch-body {
        flex-direction: column;
    }

    .video-watch-admin {
        width: 100%;
    }

    .video-group-show-body {
        grid-template-columns: 1fr;
    }
}

/* Mobile / petite tablette */
@media (max-width: 768px) {
    .videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(13.75rem, 1fr));
        gap: 1rem;
    }

    .video-search-bar {
        gap: 0.6rem;
    }

    .video-search-input {
        flex: 1 1 100%;
        max-width: none;
    }

    /* Mobile : le bouton « Groupes » passe à gauche → le menu s'ouvre vers la
       droite (aligné à gauche). Au-dessus de 768px il reste aligné à droite. */
    .video-filter-dropdown__menu {
        left: 0;
        right: auto;
    }

    .video-upload-wrapper {
        padding: 1.25rem;
    }

    /* Tableau des groupes -> cartes empilées */
    .video-group-table,
    .video-group-table thead,
    .video-group-table tbody,
    .video-group-table th,
    .video-group-table td,
    .video-group-table tr {
        display: block;
    }

    .video-group-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .video-group-table tbody tr {
        padding: 0.85rem 1.1rem;
        border-bottom: 1px solid var(--border);
    }

    .video-group-table tbody tr:last-child {
        border-bottom: none;
    }

    .video-group-table td {
        border: none;
        padding: 0.25rem 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
    }

    /* Libellé de colonne injecté via data-label sur chaque <td> */
    .video-group-table td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--faint);
        flex-shrink: 0;
    }

    .video-group-table td[data-label="Actions"] {
        justify-content: flex-end;
        padding-top: 0.6rem;
    }

    .video-group-table td[data-label="Actions"]::before {
        display: none;
    }

}

/* Très petits écrans */
@media (max-width: 480px) {
    .videos-grid {
        grid-template-columns: 1fr;
    }

    .video-confirm-dialog {
        padding: 1.25rem;
    }

    .video-confirm-dialog__actions {
        flex-direction: column-reverse;
    }

    .video-confirm-dialog__actions button {
        width: 100%;
    }
}

/* ── Gestion des utilisateurs (admin) ───────────────────────── */
.user-admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.user-admin-toolbar input[type="search"] {
    flex: 1 1 16rem;
    max-width: 24rem;
}

.user-admin-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.user-admin-filter {
    padding: 0.4rem 0.85rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.user-admin-filter:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.user-admin-filter.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
}

.user-status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 600;
}

.user-status-badge--active {
    background: rgba(46, 160, 67, 0.15);
    color: #2ea043;
}

.user-status-badge--invited {
    background: var(--warning-soft);
    color: var(--warning);
}

.user-status-badge--deactivated {
    background: var(--surface-2);
    color: var(--muted);
}

.user-admin-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
}

.user-admin-pagination button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}
