/* utils */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&family=Varela+Round&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Montserrat", serif;
}

body {
    background-color: #F9F9F9;
    line-height: 1.6;
}

.link{ color: #337ab7; }
a { text-decoration: none;}
a:hover { text-decoration: underline; }

/* HEADER */

header {
    color: #fff;
    border-bottom: 1px solid #d9d9d9;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
    padding: 10px 14px;
    height: 64px;
    min-height: 64px;
    z-index: 2;
    display: flex;
    flex-wrap: nowrap;
    align-content: flex-start;
    align-items: center;
    justify-content: space-between;
}
header h1 {
    font-size: 17px;
    color: black;
    font-family: "Varela Round", sans-serif;
    font-weight: 400;
}
header img, header a{
    height: 25px;
    width: 25px;
    margin-right: 30px;
    transition: all .2s ease-in-out;
}
header img:hover {
    cursor: pointer;
    transform: scale(1.3);
}


/* MAIN */
main {
    display: flex;
    height: 100%;
    min-height: calc(100vh - 64px);
    width: 100%;
    position: relative;
}

/* SOMMAIRE */
#sommaire {
    width: 400px;
    background: #fff;
    overflow-y: auto;
    padding-top: 10px;
    height: calc(100vh - 90px);
    padding-bottom: 20px;
    transition: width .18s ease, padding .18s ease;
    margin-top: 10px;
    margin-left: 10px;
    border-radius: 15px;
    -webkit-box-shadow: 5px 5px 20px -3px rgba(0, 0, 0, 0.1);
    box-shadow: 5px 5px 20px -3px rgba(0, 0, 0, 0.1);
}

/* Bouton rabattable (carret) */
#sommaireToggle{
    position: absolute;
    top: 50%;
    left: 408px;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: #bdf5fb;
    color: #444;
    border-radius: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    z-index: 10;
    user-select: none;
    transition: all 0.1s;
}
#sommaireToggle:hover{
    background: #e2e2e2;
}
#sommaireToggleCaret{
    margin-top: -5px;
    font-size: 27px;
    line-height: 1;
}

/* État replié */
body.sommaire-collapsed #sommaire{
    width: 0;
    padding: 0;
    overflow: hidden;
}
body.sommaire-collapsed #sommaire > div{
    visibility: hidden;
}
body.sommaire-collapsed #sommaireToggle{
    left: 0;
    transform: translate(0, -50%);
    border-left: 1px solid #d0d0d0;
}

.category{
    font-weight: bold;
}
.category, .videoLink{
    display: flex;
    gap: 5px;
    align-items: center;
    margin: 5px 0 0 5px;
    font-size: 12px;
    padding: 3px 10px;
    transition: all .15s ease-in-out;
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
    box-sizing: border-box;
}
.category:hover, .videoLink:hover {
    background: #ebebeb;
    cursor: pointer;
}
.category img, .videoLink img{
    height: 17px;
    width: 17px;
    flex-shrink: 0;
}
.category p,
.videoLink p {
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.videoLink__difficulty {
    margin-left: auto;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0.02em;
    white-space: nowrap;
    border: 1px solid transparent;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
#sommaire .videoLink .videoLink__difficulty[data-level="debutant"],
.videoLink__difficulty[data-level="debutant"],
.video-meta__badge--difficulty.video-meta__badge--debutant,
.videoLink__difficulty--debutant {
    background: #b2edb2;
    color: #1b5e20;
    border-color: rgb(0 255 13 / 28%);
}
#sommaire .videoLink .videoLink__difficulty[data-level="intermediaire"],
.videoLink__difficulty[data-level="intermediaire"],
.video-meta__badge--difficulty.video-meta__badge--intermediaire,
.videoLink__difficulty--intermediaire {
    background: #ffe0b2;
    color: #8f5204;
    border-color: rgb(255 170 61 / 28%);
}
#sommaire .videoLink .videoLink__difficulty[data-level="expert"],
.videoLink__difficulty[data-level="expert"],
.video-meta__badge--difficulty.video-meta__badge--expert,
.videoLink__difficulty--expert {
    background: #f8bbd0;
    color: #8b255b;
    border-color: rgb(255 0 136 / 22%);
}
.selected{
    background: #e3eff5;
}
/* Zone de lecture */
#playZone{
    flex: 1;
    width: auto;
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    align-items: center;
}
.videoZone{
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 16px;
    gap: 12px;
    overflow: hidden;
}

.videoZone__media {
    flex: 1 1 auto;
    min-height: 120px;
    width: 100%;
    max-height: calc(100vh - 64px - 56px - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.noVideo{
    color: #939393;
    font-size: 16px;
    text-align: center;
}

/* Player */
#videoPlayer{
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background: #000;
    border-radius: 8px;
}

body.video-meta-modal-open {
    overflow: hidden;
}


footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.9rem;
    color: #6b7280;
}

@media screen and (max-width: 1024px) {
    #sommaire{
        position: absolute;
        left: 0;
        top: 0;
        z-index: 20;
        height: calc(100vh - 64px);
        max-width: 90vw;
        width: 300px;
    }

    /* Quand le sommaire est replié en mode overlay, on évite de laisser un padding/ombre */
    body.sommaire-collapsed #sommaire{
        box-shadow: none;
    }

    /* Le bouton reste collé au bord droit du sommaire (et à gauche quand replié) */
    #sommaireToggle{
        z-index: 25;
    }

    header{
        padding: 0 10px;
        height: 45px;
        min-height: 45px;
    }
    header h1 {
        font-size: 14px;
    }
    header img, header a{
        height: 20px;
        width: 20px;
        margin-right: 10px;
    }
    main, #sommaire{
        min-height: calc(100vh - 45px);
    }
    #sommaireToggle{
        left: 310px;
    }
    .category img, .videoLink img {
        height: 14px;
        width: 14px;
    }
    .category, .videoLink{
        margin: 5px 0 0 0;
        padding: 3px 7px;
    }
    .videoLink__difficulty {
        font-size: 9px;
        padding: 2px 7px;
    }
}

@media screen and (max-width: 400px) {
    #sommaire {
        width: 280px;
    }
    #sommaireToggle {
        left: 290px;
    }
    .videoLink{
        font-size: 10px;
    }
}

/* Indentation arbre : catégories et vidéos par profondeur */
.category[data-depth="0"] { margin-left: 5px; padding-left: 10px; }
.category[data-depth="1"] { margin-left: 20px; padding-left: 10px; }
.category[data-depth="2"] { margin-left: 35px; padding-left: 10px; }
.category[data-depth="3"] { margin-left: 50px; padding-left: 10px; }
.category[data-depth="4"] { margin-left: 65px; padding-left: 10px; }
.category[data-depth="5"] { margin-left: 80px; padding-left: 10px; }
.category[data-depth="6"] { margin-left: 95px; padding-left: 10px; }
.category[data-depth="7"] { margin-left: 110px; padding-left: 10px; }
.category[data-depth="8"] { margin-left: 125px; padding-left: 10px; }

.videoLink[data-depth="1"] { margin-left: 20px; padding-left: 10px; }
.videoLink[data-depth="2"] { margin-left: 35px; padding-left: 10px; }
.videoLink[data-depth="3"] { margin-left: 50px; padding-left: 10px; }
.videoLink[data-depth="4"] { margin-left: 65px; padding-left: 10px; }
.videoLink[data-depth="5"] { margin-left: 80px; padding-left: 10px; }
.videoLink[data-depth="6"] { margin-left: 95px; padding-left: 10px; }
.videoLink[data-depth="7"] { margin-left: 110px; padding-left: 10px; }
.videoLink[data-depth="8"] { margin-left: 125px; padding-left: 10px; }
.videoLink[data-depth="9"] { margin-left: 140px; padding-left: 10px; }

/* Anciennes classes depth-N (compatibilité) */
.category.depth-0 { margin-left: 5px; padding-left: 10px; }
.category.depth-1, .videoLink.depth-1 { margin-left: 20px; padding-left: 10px; }
.category.depth-2, .videoLink.depth-2 { margin-left: 35px; padding-left: 10px; }
.category.depth-3, .videoLink.depth-3 { margin-left: 50px; padding-left: 10px; }
.category.depth-4, .videoLink.depth-4 { margin-left: 65px; padding-left: 10px; }
.category.depth-5, .videoLink.depth-5 { margin-left: 80px; padding-left: 10px; }
.category.depth-6, .videoLink.depth-6 { margin-left: 95px; padding-left: 10px; }

.video-meta {
    flex-shrink: 0;
    width: 100%;
    max-height: min(28vh, 200px);
    margin-top: 0;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.video-meta:hover {
    border-color: #c5c5c5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.video-meta--expandable {
    cursor: pointer;
}

.video-meta__title {
    margin: 0 0 8px 0;
    color: #1a1a1a;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.video-meta__description {
    color: #333;
    font-size: 14px;
    line-height: 1.5;
    margin: 8px 0 0 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-word;
}

.video-meta__hint {
    display: none;
    margin-top: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #337ab7;
    letter-spacing: 0.01em;
}

.video-meta__details {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    gap: 8px;
    flex-shrink: 0;
}

.video-meta__badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef3f8;
    color: #2f4858;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    border: 1px solid rgba(47, 72, 88, 0.12);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
/* Popup détails vidéo (plein écran) */
.video-meta-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.video-meta-modal[hidden] {
    display: none;
}

.video-meta-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.62);
}

.video-meta-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(760px, 100%);
    max-height: min(90vh, 100%);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.video-meta-modal__close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 999px;
    background: #f3f4f6;
    color: #374151;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.video-meta-modal__close:hover {
    background: #e5e7eb;
}

.video-meta-modal__body {
    overflow-y: auto;
    padding: 28px 24px 24px;
    flex: 1;
    min-height: 0;
}

.video-meta-modal__title {
    margin: 0 36px 14px 0;
    color: #1a1a1a;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.35;
}

.video-meta-modal__details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.video-meta-modal__description {
    margin: 0;
    color: #333;
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

@media screen and (max-width: 1024px) {
    .videoZone__media {
        max-height: calc(100vh - 45px - 48px - 180px);
    }

    .video-meta {
        max-height: min(26vh, 180px);
    }

    .video-meta-modal {
        padding: 10px;
    }

    .video-meta-modal__dialog {
        width: 100%;
        max-height: 94vh;
        border-radius: 10px;
    }

    .video-meta-modal__title {
        font-size: 18px;
    }
}