/* ===================================================================
   FEUILLE DE STYLE — LECTEUR VIDÉO KANJIYOMOU
   Calquée sur kanjiyomou-diaporama.css pour cohérence visuelle
   =================================================================== */

/* ── Conteneur principal ────────────────────────────────────────── */
.video-player-container {
    max-width: 100%;
    width: 100%;
    margin: 2em auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border: 1px solid #eaeaea;
    box-sizing: border-box;
}

/* ── Zone vidéo ─────────────────────────────────────────────────── */
.video-player-wrapper {
    position: relative;
    width: 100%;
    background: #000;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.video-player-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #000;
}

/* Sous-titres incrustés dans la vidéo (style cinéma, optionnel) */
.video-inline-subtitle {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    text-align: center;
    pointer-events: none;
    display: none; /* masqué par défaut — mode panneau utilisé */
    z-index: 5;
}

/* ── Barre de contrôles (niveau + toggles) ──────────────────────── */
.video-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 12px 20px;
    background: #fdfdfd;
    border-bottom: 1px solid #f0f0f0;
    gap: 12px;
    box-sizing: border-box;
}

/* Sélecteur de niveau — identique au diaporama */
.video-niveau-selector {
    display: flex;
    background: #f1f1f1;
    border-radius: 30px;
    padding: 3px;
    border: 1px solid #e5e5e5;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 2px;
}

.video-niveau-btn {
    border: none;
    background: transparent;
    padding: 6px 14px;
    font-size: 0.85em;
    font-weight: 600;
    color: #666;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    white-space: nowrap;
}

.video-niveau-btn:hover { color: #333; }

.video-niveau-btn.active {
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Couleurs par niveau */
.video-niveau-btn.active.niv-grade1 { background-color: #4caf50; }
.video-niveau-btn.active.niv-grade2 { background-color: #f39c12; }
.video-niveau-btn.active.niv-grade3 { background-color: #2196f3; }
.video-niveau-btn.active.niv-grade4 { background-color: #9c27b0; }
.video-niveau-btn.active.niv-natif  { background-color: #8c1c13; }
/* Fallback pour niveaux génériques */
.video-niveau-btn.active.niv-other  { background-color: #607d8b; }

/* Toggles d'affichage */
.video-display-toggles {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.video-toggle-btn {
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #555;
    transition: all 0.2s ease;
    font-weight: bold;
    white-space: nowrap;
}

.video-toggle-btn:hover {
    border-color: #999;
    background: #fafafa;
}

.video-toggle-btn.active {
    background: #eef5fa;
    border-color: #0074c7;
    color: #0074c7;
}

/* ── Panneau de sous-titres ─────────────────────────────────────── */
.video-subtitle-panel {
    padding: 20px 30px;
    min-height: 120px;
    background: #ffffff;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 12px;
    box-sizing: border-box;
}

/* Couplet de sous-titre */
.video-subtitle-couplet {
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-left: 3px solid transparent;
}

.video-subtitle-couplet:hover {
    background: #f5f5f5;
}

.video-subtitle-couplet.active {
    background: #eef5fa;
    border-left-color: #0074c7;
}

/* Texte japonais du sous-titre */
.video-subtitle-jp {
    font-size: 1.15em;
    line-height: 1.8;
    color: #2c3e50;
    font-family: "MS Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
    letter-spacing: 0.05em;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Support furigana (ruby) */
.video-subtitle-jp ruby { ruby-position: over; }
.video-subtitle-jp rt {
    font-size: 0.55em;
    color: #7f8c8d;
    user-select: none;
}

/* Traduction française */
.video-subtitle-fr {
    font-size: 0.95em;
    color: #555555;
    line-height: 1.6;
    border-left: 3px solid #ddd;
    padding-left: 12px;
    font-style: italic;
    margin-top: 6px;
    word-break: break-word;
    overflow-wrap: break-word;
    display: none;
}

.video-subtitle-fr.visible { display: block; }

/* Badge timing */
.video-subtitle-timing {
    font-size: 0.72em;
    color: #aaa;
    font-family: monospace;
    margin-bottom: 2px;
    display: none; /* masqué par défaut, visible si option activée */
}

.video-subtitle-timing.visible { display: block; }

/* Message "pas de sous-titre" */
.video-no-subtitle {
    text-align: center;
    color: #aaa;
    font-size: 0.95em;
    padding: 1em 0;
}

/* Message "chargement" */
.video-loading-subtitle {
    text-align: center;
    color: #888;
    font-size: 0.9em;
    animation: pulse-opacity 1.5s infinite;
}

@keyframes pulse-opacity {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ── Zone "sous-titre actif" en haut du panneau ─────────────────── */
.video-active-subtitle-display {
    background: linear-gradient(135deg, #f8faff 0%, #eef5fa 100%);
    border: 1px solid #d0e4f5;
    border-radius: 12px;
    padding: 16px 22px;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
    position: relative;
}

.video-active-subtitle-display::before {
    content: '▶ En cours';
    position: absolute;
    top: -10px;
    left: 14px;
    background: #0074c7;
    color: white;
    font-size: 0.7em;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    letter-spacing: 0.05em;
}

.video-active-jp {
    font-size: 1.25em;
    line-height: 1.8;
    color: #1a2942;
    font-family: "MS Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
    letter-spacing: 0.05em;
    word-break: break-word;
}

.video-active-jp ruby { ruby-position: over; }
.video-active-jp rt {
    font-size: 0.55em;
    color: #6a8099;
    user-select: none;
}

.video-active-fr {
    font-size: 1em;
    color: #555;
    font-style: italic;
    border-left: 3px solid #0074c7;
    padding-left: 12px;
    line-height: 1.6;
    display: none;
}

.video-active-fr.visible { display: block; }

/* ── Barre de scroll du panneau complet ─────────────────────────── */
.video-transcript-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    background: #fafafa;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.video-transcript-list::-webkit-scrollbar {
    width: 4px;
}
.video-transcript-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* ── Footer info ────────────────────────────────────────────────── */
.video-player-footer {
    padding: 10px 20px;
    background: #fdfdfd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.82em;
    color: #888;
    box-sizing: border-box;
}

.video-player-footer a {
    color: #8c1c13;
    text-decoration: none;
    font-weight: 600;
}

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

/* ── Animation pulse (bouton audio diaporama réutilisé) ─────────── */
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(0, 116, 199, 0.4); }
    70%  { box-shadow: 0 0 0 10px rgba(0, 116, 199, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 116, 199, 0); }
}

/* ── Mobile (max-width: 600px) ──────────────────────────────────── */
@media (max-width: 600px) {
    .video-player-container {
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .video-controls {
        flex-direction: column;
        align-items: stretch;
        padding: 10px 12px;
        gap: 8px;
    }

    .video-niveau-selector {
        justify-content: center;
        width: 100%;
    }

    .video-niveau-btn {
        flex: 1;
        text-align: center;
        padding: 6px 8px;
        font-size: 0.78em;
    }

    .video-display-toggles {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        width: 100%;
    }

    .video-toggle-btn {
        padding: 6px 4px;
        font-size: 0.78em;
        justify-content: center;
    }

    .video-subtitle-panel {
        padding: 14px 14px;
        min-height: auto;
    }

    .video-active-jp { font-size: 1.1em; }
    .video-active-fr { font-size: 0.9em; }

    .video-transcript-list { max-height: 200px; }

    .video-subtitle-jp { font-size: 1em; }
    .video-subtitle-fr { font-size: 0.88em; }
}

/* ── Page récapitulative videos.php ─────────────────────────────── */
.videos-hero {
    text-align: center;
    padding: 1.5em 0 2em;
}

.videos-hero h1 {
    font-size: clamp(1.6em, 4vw, 2.4em);
    color: #2c3e50;
    margin-bottom: 0.4em;
}

.videos-subtitle {
    color: #666;
    font-size: 1.05em;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.8em;
    margin-top: 1.5em;
}

/* Carte vidéo */
.video-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.09);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    border: 1px solid #eee;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.14);
}

.video-card-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #1a1a2e;
    overflow: hidden;
}

.video-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.video-card:hover .video-card-img-wrap img {
    transform: scale(1.04);
}

.video-card-no-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4em;
    color: #555;
}

/* Icône lecture */
.video-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0);
    transition: background 0.2s ease;
}

.video-card:hover .video-play-overlay {
    background: rgba(0,0,0,0.3);
}

.video-play-icon {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,0.92);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4em;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.video-card:hover .video-play-icon {
    opacity: 1;
    transform: scale(1);
}

/* Badge durée */
.video-duree-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 0.78em;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

/* Corps de la carte */
.video-card-body {
    padding: 1.1em 1.3em 1.3em;
    display: flex;
    flex-direction: column;
    gap: 0.4em;
    flex: 1;
}

.video-card-title {
    font-size: 1.1em;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    line-height: 1.3;
}

.video-card-jp {
    font-family: "Noto Serif JP", "MS Mincho", serif;
    font-size: 1em;
    color: #8c1c13;
    margin: 0;
}

/* Badges de niveau */
.video-card-niveaux {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 0.3em;
}

.video-niv-badge {
    font-size: 0.75em;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 20px;
    color: #fff;
}

.vniv-grade1 { background: #4caf50; }
.vniv-grade2 { background: #f39c12; }
.vniv-grade3 { background: #2196f3; }
.vniv-grade4 { background: #9c27b0; }
.vniv-natif  { background: #8c1c13; }
.vniv-other  { background: #607d8b; }

/* CTA */
.video-card-cta {
    margin-top: auto;
    padding-top: 0.8em;
    font-size: 0.88em;
    font-weight: 700;
    color: #8c1c13;
    display: inline-block;
}

@media (max-width: 600px) {
    .videos-grid {
        grid-template-columns: 1fr;
        gap: 1.2em;
    }
    .video-card { border-radius: 10px; }
    .videos-hero h1 { font-size: 1.5em; }
}
