/* ============================================================
   MediaHub v2 — Stylesheet
   Thème accessible, sombre, haute lisibilité
   Police : Atkinson Hyperlegible (conçue pour la lisibilité)
   ============================================================ */

:root {
    --bg-primary:    #0f1015;
    --bg-secondary:  #161821;
    --bg-card:       #1c1e2c;
    --bg-card-hover: #252840;
    --bg-input:      #131420;
    --bg-overlay:    rgba(0,0,0,0.75);

    --text-primary:   #eaebef;
    --text-secondary: #a0a3b8;
    --text-muted:     #6b6f8a;

    --accent:         #7b8aff;
    --accent-hover:   #9ba6ff;
    --accent-glow:    rgba(123,138,255,0.25);
    --accent-soft:    rgba(123,138,255,0.12);

    --success:   #3dd9a0;
    --warning:   #ffc244;
    --danger:    #ff6b6b;
    --cc-green:  #2dd47a;

    --border:       #2a2d45;
    --border-focus: #7b8aff;

    --focus-ring:   0 0 0 3px rgba(123,138,255,0.5);

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 16px;

    --shadow:     0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);

    --font:      'Atkinson Hyperlegible', system-ui, sans-serif;
    --font-mono: 'Courier New', monospace;

    --header-h: 64px;
    --max-w:    1360px;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: underline; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }

/* ── Skip links (accessibilité) ────────────────────────────── */
.skip-links {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9999;
    display: flex;
    gap: 2px;
}

.skip-link {
    position: absolute;
    top: -200px;
    left: 0;
    padding: 0.7rem 1.2rem;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: var(--shadow);
}
.skip-link:focus {
    position: static;
    outline: 3px solid #fff;
    outline-offset: -3px;
}

/* ── Texte réservé aux lecteurs d'écran ───────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ── Focus visible (accessibilité) ────────────────────────── */
:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* ── Header ───────────────────────────────────────────────── */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: rgba(15,16,21,0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
    text-decoration: none;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
}

.header-nav {
    display: flex;
    gap: 0.25rem;
    margin-left: 1rem;
}

.nav-link {
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
}
.nav-link:hover,
.nav-link.active {
    background: var(--accent-soft);
    color: var(--accent-hover);
}
.nav-link[aria-current="page"] {
    background: var(--accent-soft);
    color: var(--accent);
}

.header-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-badge { display: flex; align-items: center; gap: 0.5rem; }

.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-name { font-size: 0.9rem; color: var(--text-secondary); }

.btn-logout {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-logout:hover { background: rgba(255,107,107,0.15); color: var(--danger); }

/* ── Main ─────────────────────────────────────────────────── */
.app-main {
    flex: 1;
    max-width: var(--max-w);
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ── Footer ───────────────────────────────────────────────── */
.app-footer {
    border-top: 1px solid var(--border);
    padding: 1.25rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-help { margin-top: 0.3rem; }

.btn-help-link {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8rem;
    padding: 0.2rem 0.7rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-help-link:hover,
.btn-help-link:focus {
    color: var(--accent);
    border-color: var(--accent);
    outline: none;
    box-shadow: var(--focus-ring);
}

.footer-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Page titles ──────────────────────────────────────────── */
.page-title {
    font-size: 1.7rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.page-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: -1rem;
    margin-bottom: 1.5rem;
}

/* ── Formulaires ──────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
    padding: 0.7rem 0.9rem;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--border-focus);
    box-shadow: var(--focus-ring);
    outline: none;
}

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

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a0a3b8' fill='none' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.form-textarea { min-height: 100px; resize: vertical; }

.form-error {
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 700;
}

/* ── Boutons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.2;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

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

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.9rem; }

/* ── Recherche ────────────────────────────────────────────── */
.search-section {
    margin-bottom: 2rem;
}

.search-box {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-box .form-input {
    flex: 1;
    font-size: 1.1rem;
    padding: 0.8rem 1rem;
}

.search-filters {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.search-filters summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 0.5rem 0;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

/* ── Résultats vidéos ─────────────────────────────────────── */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.results-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.video-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}
.video-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}
.video-card:focus-within {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.video-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.video-thumb {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--bg-secondary);
}

.video-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.video-duration {
    position: absolute;
    bottom: 8px; right: 8px;
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
}

.video-info {
    padding: 0.75rem 1rem 1rem;
}

.video-title {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 0.35rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.video-meta span::after {
    content: '·';
    margin-left: 0.5rem;
}
.video-meta span:last-child::after { content: ''; }

.video-license { margin-top: 0.4rem; }

/* ── Sélection de vidéos ─────────────────────────────────── */
.select-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.select-toolbar-left,
.select-toolbar-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.select-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-left: 0.25rem;
}

/* Carte vidéo sélectionnable : positionnement relatif pour la case à cocher */
.video-card-selectable {
    position: relative;
}

.video-select {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
}

.video-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--accent);
}

.video-checkbox-label {
    cursor: pointer;
}

/* Retour visuel quand la carte est cochée */
.video-card-checked {
    outline: 3px solid var(--accent);
    outline-offset: -3px;
    background: var(--accent-soft);
}

.video-card-checked .video-card-link {
    opacity: 0.85;
}

/* Bouton d'exclusion de chaîne sur la carte vidéo */
.video-actions {
    padding: 0.25rem 1rem 0.75rem;
}

.btn-exclude-channel {
    display: inline-block;
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-exclude-channel:hover,
.btn-exclude-channel:focus {
    background: var(--danger);
    color: #fff;
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ── Indicateur de correspondance des mots-clés ──────────── */
.keyword-match {
    margin-top: 0.5rem;
    padding: 0.3rem 0;
    font-size: 0.78rem;
    line-height: 1.5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
}

.match-score {
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
}

.match-high .match-score {
    background: var(--success-bg, #d4edda);
    color: var(--success-text, #155724);
}
.match-medium .match-score {
    background: var(--warning-bg, #fff3cd);
    color: var(--warning-text, #856404);
}
.match-low .match-score {
    background: var(--danger-bg, #f8d7da);
    color: var(--danger-text, #721c24);
}

.match-found {
    color: var(--success, #28a745);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}

.match-missing {
    color: var(--text-muted);
    text-decoration: line-through;
    opacity: 0.7;
}

.match-legend {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
}

.match-legend .match-found {
    font-size: 0.82rem;
}

.match-legend .match-missing {
    font-size: 0.82rem;
}

/* Bouton de suppression de tag (page exclusions) */
.btn-tag-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0 0.2rem;
    line-height: 1;
    transition: color 0.2s;
}

.btn-tag-remove:hover {
    color: var(--danger);
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-cc { background: rgba(45,212,122,0.15); color: var(--cc-green); }
.badge-yt { background: rgba(160,163,184,0.1); color: var(--text-muted); }
.badge-hd { background: rgba(123,138,255,0.15); color: var(--accent); }

/* ── Alertes ──────────────────────────────────────────────── */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert p { margin: 0; }

.alert-info    { background: rgba(123,138,255,0.08); border-color: var(--accent); }
.alert-success { background: rgba(61,217,160,0.08); border-color: var(--success); color: var(--success); }
.alert-error   { background: rgba(255,107,107,0.08); border-color: var(--danger); color: var(--danger); }
.alert-warning { background: rgba(255,194,68,0.08); border-color: var(--warning); color: var(--warning); }

/* ── Page Watch ───────────────────────────────────────────── */
.watch-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
}

.player-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}

.player-container iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
}

.video-details { margin-top: 1.25rem; }

.video-details h1 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.video-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.video-description {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    white-space: pre-wrap;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-height: 200px;
    overflow-y: auto;
}

.video-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.75rem;
}

.tag-chip {
    display: inline-block;
    padding: 3px 10px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
}
.tag-chip:hover { background: var(--accent-glow); }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.sidebar-card {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border);
}
.sidebar-card:last-child { border-bottom: none; }

.sidebar-thumb {
    width: 160px;
    aspect-ratio: 16/9;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-secondary);
}
.sidebar-thumb img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-info { flex: 1; min-width: 0; }

.sidebar-info h3 {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sidebar-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ── Auth pages ───────────────────────────────────────────── */
.auth-wrapper {
    max-width: 420px;
    margin: 3rem auto;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
}

.auth-card h1 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
}

/* ── Arbres de recherche ──────────────────────────────────── */
.tree-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.tree-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: border-color 0.2s;
}
.tree-card:hover { border-color: var(--accent); }

.tree-card h3 {
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

.tree-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.tree-meta {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Layout arbre : navigation + contenu */
.tree-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
}

@media (max-width: 800px) {
    .tree-layout {
        grid-template-columns: 1fr;
    }
}

.tree-nav {
    min-width: 0;
}

.tree-content {
    min-width: 0;
}

/* Arbre visuel (listes imbriquées simples) */
.tree-view {
    padding-left: 0;
    list-style: none;
}

.tree-view ul {
    padding-left: 1.25rem;
    list-style: none;
    border-left: 2px solid var(--border);
    margin-top: 0.15rem;
}

.tree-item {
    margin: 0.15rem 0;
}

.tree-link {
    display: block;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.tree-link:hover {
    background: var(--bg-card-hover);
    color: var(--accent-hover);
}

.tree-link:focus {
    outline: none;
    box-shadow: var(--focus-ring);
    background: var(--bg-card-hover);
}

.tree-item-active > .tree-link {
    background: var(--accent-soft);
    color: var(--accent);
}

.tree-count {
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Page de visionnage ──────────────────────────────────── */
.player-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    background: #000;
}

.player-iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

.video-detail {
    margin-bottom: 2rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

@media (max-width: 800px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-main p {
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.detail-channel {
    font-size: 1rem !important;
    margin-bottom: 0.75rem !important;
}

.detail-stats {
    color: var(--text-secondary);
}

.detail-actions {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    align-self: start;
}

.detail-actions h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.video-description {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
}

/* Tags */
.tag-list {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.tag {
    display: inline-block;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.1rem 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ── Annotations ─────────────────────────────────────────── */
.annotations-section {
    margin-top: 2rem;
    border-top: 2px solid var(--border);
    padding-top: 1.5rem;
}

.annotations-section h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.annotation-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.annotation-card p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.annotation-card footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a, .pagination span {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
}

.pagination a {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.pagination a:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ── Actions bar ──────────────────────────────────────────── */
.actions-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

/* ── Panneau d'aide raccourcis clavier ────────────────────── */
.kbd-help-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg-overlay);
    align-items: center;
    justify-content: center;
}
.kbd-help-overlay[open] { display: flex; }

.kbd-help-panel {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 520px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.kbd-help-panel h2 {
    font-size: 1.2rem;
    margin-bottom: 1.25rem;
}

.kbd-help-list {
    list-style: none;
    padding: 0;
}

.kbd-help-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.kbd-help-list li:last-child { border-bottom: none; }

.kbd-key {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 1.8rem;
    text-align: center;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
    .watch-layout { grid-template-columns: 1fr; }
    .header-nav { display: none; }
    .video-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .app-main { padding: 1rem; }
    .search-box { flex-direction: column; }
    .filters-grid { grid-template-columns: 1fr; }
}

/* ── Table (admin) ────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

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

.data-table th {
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-secondary);
}

.data-table tbody tr:hover { background: var(--bg-card); }

/* ── Transcription ───────────────────────────────────────── */
.transcript-section {
    margin-top: 2rem;
    border-top: 2px solid var(--border);
    padding-top: 1.5rem;
}

.transcript-section h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.transcript-segments {
    max-height: 500px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.transcript-segment {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.transcript-time {
    display: inline-block;
    min-width: 3.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    margin-right: 0.5rem;
    text-decoration: none;
}

.transcript-time:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ── Accès rapide ───────────────────────────────────────── */
.quick-access {
    margin-bottom: 1.5rem;
}

.quick-access-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.quick-access-bar .form-label {
    font-size: 0.85rem;
    margin-bottom: 0;
}

.quick-access-bar .form-select {
    padding: 0.45rem 2rem 0.45rem 0.7rem;
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .quick-access-bar { flex-direction: column; align-items: stretch; }
}

/* ═════════════════════════════════════════════════════════════
   ONGLETS DE MOTEURS (v2.2)
   Motif ARIA tablist/tab/tabpanel, navigation clavier complète.
   ═════════════════════════════════════════════════════════════ */

.engine-tabs {
    margin: 1rem 0 0.5rem 0;
}

.engine-tabs-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem 0;
    border-bottom: 2px solid var(--border);
}

.engine-tab {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    padding: 0.55rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    bottom: -2px;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.engine-tab:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.engine-tab:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    z-index: 2;
}

.engine-tab[aria-selected="true"] {
    color: var(--accent);
    background: var(--bg-card);
    border-color: var(--border);
    border-bottom-color: var(--bg-card);
}

.engine-tab-count {
    display: inline-block;
    margin-left: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--accent);
    color: var(--bg-primary);
    border-radius: 10px;
    padding: 0.05rem 0.5rem;
    min-width: 1.3rem;
    text-align: center;
}

.engine-tab[aria-selected="true"] .engine-tab-count {
    background: var(--accent-hover);
}

.engine-tab-count[data-count="0"] {
    display: none;
}

/* Panneaux d'onglets */
.engine-tab-panel {
    padding: 1rem 0.25rem 0.25rem 0.25rem;
}

.engine-tab-panel[hidden] {
    display: none !important;
}

/* Titre h2 de l'onglet actif — sert d'ancre de navigation pour NVDA.
   Visuellement discret car le contexte est déjà donné par les onglets,
   mais pleinement présent dans l'arbre d'accessibilité. */
.engine-tab-panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.6rem 0;
    padding: 0;
    border: none;
}

.engine-tab-panel-intro {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 0.85rem 0;
    font-style: italic;
}

/* ── Sources dans un panneau d'onglet ───────────────────── */
.engine-sources {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.6rem;
    padding: 0;
    margin: 0;
    list-style: none;
    border: none;
}

.engine-sources legend {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
}

.engine-source-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
    transition: border-color 0.15s, background 0.15s;
}

.engine-source-item:hover,
.engine-source-item:focus-within {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.engine-source-label {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.engine-source-label input[type="checkbox"] {
    accent-color: var(--accent);
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.engine-source-name {
    flex-grow: 1;
}

.engine-source-paid {
    display: inline-block;
    margin-left: 0.4rem;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--warning);
    color: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 0.05rem 0.4rem;
    vertical-align: middle;
    cursor: help;
}

.engine-source-description {
    display: block;
    margin: 0.25rem 0 0 1.75rem;
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ── Ancien .search-sources (rétrocompatibilité) ───────── */
.search-sources {
    border: none;
    padding: 0.5rem 0;
    margin: 0.5rem 0 0 0;
}

.search-sources legend {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
}

.search-source-option {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.search-source-option input {
    accent-color: var(--accent);
}

.search-sources-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.search-sources-separator {
    display: inline-block;
    width: 1px;
    height: 1.2rem;
    background: var(--border);
    margin: 0 0.5rem;
    vertical-align: middle;
}

/* ── Résultats locaux ────────────────────────────────────── */
.local-results {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.local-results h3 {
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

/* ── Cases à cocher dans les formulaires (v2.2) ─────────── */
.form-group-inline {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 600;
}

.form-checkbox-label input[type="checkbox"] {
    accent-color: var(--accent);
    width: 1.1rem;
    height: 1.1rem;
}

.form-checkbox-inline {
    justify-content: center;
}

.form-help-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0.2rem 0 0 1.6rem;
    line-height: 1.4;
}

/* ── Badges supplémentaires pour les types de résultats ── */
.badge-book,
.badge-paper,
.badge-encyclopedia,
.badge-archive {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    vertical-align: middle;
    margin-left: 0.3rem;
}

.badge-book         { background: #6b4e3a; color: #ffd8b8; }
.badge-paper        { background: #3a4e6b; color: #b8d8ff; }
.badge-encyclopedia { background: #4e3a6b; color: #d8b8ff; }
.badge-archive      { background: #3a3a3a; color: #cccccc; }

/* ── Résultats web (SearXNG) ─────────────────────────────── */
.web-results {
    margin-top: 2rem;
    border-top: 2px solid var(--accent-soft);
    padding-top: 1rem;
}

.web-results h2 {
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.web-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.web-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s, background 0.2s;
}

.web-card:hover,
.web-card:focus-within {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.web-card-link {
    display: block;
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: inherit;
}

.web-card-link:hover,
.web-card-link:focus {
    text-decoration: none;
    color: inherit;
}

.web-card-link:focus {
    outline: 3px solid var(--accent);
    outline-offset: -3px;
    border-radius: var(--radius);
}

.web-card-domain {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0 0 0.2rem 0;
}

.web-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    margin: 0 0 0.3rem 0;
    line-height: 1.3;
}

.web-card:hover .web-card-title,
.web-card:focus-within .web-card-title {
    color: var(--accent-hover);
}

.web-card-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.45;
}

.web-card-meta {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.3rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.web-card-engines {
    opacity: 0.7;
}

/* ── Badges de type ──────────────────────────────────────── */
.badge-news,
.badge-video,
.badge-audio,
.badge-image {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    vertical-align: middle;
    margin-left: 0.3rem;
}

.badge-news  { background: #3b4d9e; color: #c5cfff; }
.badge-video { background: #7b3a3a; color: #ffb8b8; }
.badge-audio { background: #3a6b5a; color: #b8ffd8; }
.badge-image { background: #6b5a3a; color: #ffd8b8; }

/* ── Audio card (futurs podcasts) ─────────────────────────── */
.audio-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s;
}

.audio-card:hover,
.audio-card:focus-within {
    border-color: var(--accent);
}

.audio-card-link {
    display: block;
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: inherit;
}

.audio-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    margin: 0 0 0.3rem 0;
}

.audio-card-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0;
}
