/* ========================================
   VIEW TEMPLATE - Styles CSS optimisés
   Fichier dédié pour view_lexique.html
   
   Organisation:
   1. Composants critiques (layout, sidebar)
   2. Modules interactifs (sommaire, concepts)
   3. Composants visuels (info-boxes, carrousel)
   4. Media queries responsives
   ======================================== */

/* ====== 1. COMPOSANTS CRITIQUES ====== */

/* Boutons latéraux flottants */
.sidebar-buttons {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-btn {
    background-color: #0046b5;
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-btn:hover {
    background-color: #003399;
    transform: scale(1.1);
}

/* Layout principal - Grid pour lexique */
.lexique-content-wrapper {
    display: grid;
    grid-template-columns: minmax(auto, 700px) 1fr;
    gap: 20px;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

.lexique-article-main {
    grid-column: 1;
}

.lexique-concepts-block {
    grid-column: 2;
    order: 2;
    display: block;
}

/* Ajustement de l'article pour le grid */
article {
    padding: 0 20px;
    position: relative;
}

/* Layout mobile responsive */
@media (max-width: 991.98px) {
    .lexique-content-wrapper {
        display: flex;
        flex-direction: column;
        padding: 0 !important;
    }

    .lexique-article-main {
        order: 1;
    }

    .lexique-concepts-block {
        order: 3;
        display: block;
        margin-top: 20px;
    }
}

/* ====== 2. MODULES INTERACTIFS ====== */

/* Section des concepts clés */
#concepts-section {
    margin-top: 0;
    padding: 15px;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
}

.concepts-sidebar {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    height: fit-content;
    min-width: 300px;
    max-width: 400px;
}

@media (max-width: 768px) {
    .concepts-sidebar {
        min-width: 0 !important;
        max-width: none !important;
    }
}

.concepts-section-title {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.concept-item {
    margin-bottom: 10px;
}

.concept-item:last-child {
    margin-bottom: 0;
}

.concept-title {
    font-size: 1.1em;
    color: #0056b3;
    cursor: pointer;
    padding: 10px;
    background-color: #e9ecef;
    border-radius: 3px;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
}

.concept-title:hover {
    background-color: #dcdcdc;
}

.concept-title .toggle-icon {
    font-weight: bold;
    font-size: 1.2em;
}

.concept-explanation {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 3px 3px;
    padding: 0 15px;
}

.concept-explanation.open {
    max-height: 500px;
    padding: 15px;
    transition: max-height 0.3s ease-in, padding 0.3s ease-in;
}

.concept-explanation p {
    margin: 0;
    font-size: 0.95em;
    line-height: 1.6;
}

/* ====== 3. COMPOSANTS VISUELS ====== */

/* Info-boxes (encarts) */
.info-box {
    border-left: 5px solid #ccc;
    margin: 1em 0 1.5em 0;
    padding: 12px;
    background-color: #f8f8f8;
    position: relative;
    border-radius: 8px;
}

.info-box.important { border-color: #e74c3c; background-color: #fdedeb; }
.info-box.tip { border-color: #27ae60; background-color: #e9f7ef; }
.info-box.note { border-color: #3498db; background-color: #ebf5fb; }
.info-box.essentiel { border-color: #f39c12; background-color: #fef5e7; }
.info-box.exemple { border-color: #9b59b6; background-color: #f4ecf7; }

.info-box .info-icon-title {
    align-items: center;
    margin-bottom: 8px;
}

.info-box .info-icon-title:before {
    font-family: Arial, sans-serif;
    margin-right: 10px;
    font-size: 16px;
}

.info-box.important .info-icon-title:before { content: "⚠️"; }
.info-box.tip .info-icon-title:before { content: "💡"; }
.info-box.note .info-icon-title:before { content: "📝"; }
.info-box.essentiel .info-icon-title:before { content: "🔑"; }
.info-box.exemple .info-icon-title:before { content: "📋"; }

.info-box .info-content {
    margin-left: 26px;
}

/* Sommaire (Table des matières) */
#sommaire-container {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.accordion-toggle {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 20px;
    align-items: center;
    justify-content: space-between;
}

.accordion-toggle .icon {
    transition: transform 0.3s ease;
}

.accordion-toggle.active .icon {
    transform: rotate(180deg);
}

.panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

#sommaire-container ul, #fixed-sommaire ul {
    list-style: none;
    margin: 0;
}

#sommaire-container li, #fixed-sommaire li {
    margin: 8px 0;
    position: relative;
}

#sommaire-container a, #fixed-sommaire a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
    display: block;
    font-size: 0.95em;
}

#sommaire-container a:hover, #fixed-sommaire a:hover {
    color: #007bff;
}

.progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: #007bff;
    transform-origin: top;
    transform: scaleY(0);
    transition: transform 0.1s ease-out;
}

/* Sommaire fixe */
#fixed-sommaire {
    display: none;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 1000;
    width: 230px;
    max-height: 425px;
    overflow-y: auto;
}

@media (min-width: 1300px) {
    #fixed-sommaire {
        position: fixed;
        left: 10px;
        top: 75px;
    }
}

@media (max-width: 1299px) {
    #fixed-sommaire {
        display: none !important;
    }
}

a.active {
    color: #007bff !important;
    font-weight: 500;
}

/* Boutons de catégories */
.category-button {
    border-radius: 18px;
    font-size: 16px;
    border: none;
    padding: 5px 20px;
    margin-right: 5px;
    cursor: pointer;
}

.category-button a {
    color: black;
    text-decoration: none;
}

/* Couleurs des catégories */
.category-color-0 { background-color: #bef1ff; }
.category-color-1 { background-color: #ffd6e6; }
.category-color-2 { background-color: #c1f7d5; }
.category-color-3 { background-color: #ffe4b5; }
.category-color-4 { background-color: #e0c6ff; }
.category-color-5 { background-color: #fff4bd; }
.category-color-6 { background-color: #ffcab8; }
.category-color-7 { background-color: #dadee3; }
.category-color-8 { background-color: #d4f0c6; }
.category-color-9 { background-color: #ffd7b5; }
.category-color-10 { background-color: #e0e6ff; }

/* Articles recommandés - Carrousel */
.recommended-articles {
    margin: 40px 0;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.carousel-title {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
    font-weight: bold;
}

.recommended-articles h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
}

.recommended-carousel-container {
    position: relative;
}

.carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
    z-index: 2;
}

.carousel-control:hover {
    background: rgba(0, 0, 0, 0.7);
}

.carousel-control.prev {
    left: 0;
}

.carousel-control.next {
    right: 0;
}

.recommended-carousel {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 10px 0;
}

.recommended-carousel::-webkit-scrollbar {
    display: none;
}

.recommended-item {
    flex: 0 0 300px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    opacity: 1 !important;
}

.recommended-carousel.single-item {
    justify-content: center;
}

.recommended-carousel.single-item .recommended-item {
    flex: 0 0 80%;
    max-width: 600px;
}

.recommended-item:hover {
    transform: translateY(-5px);
}

.recommended-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.recommended-video-container {
    width: 100%;
    height: 200px;
    position: relative;
}

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

.recommended-content {
    padding: 15px;
}

.recommended-title {
    display: block;
    font-size: 18px;
    color: #333;
    text-decoration: none;
    margin-bottom: 10px;
    font-weight: 500;
    line-height: 1.4;
}

.recommended-title:hover {
    color: #007bff;
}

.recommended-content p {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

/* ====== 4. MEDIA QUERIES RESPONSIVES ====== */

/* Responsive mobile pour le carrousel */
@media (max-width: 768px) {
    .carousel-control {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }

    .recommended-item {
        flex: 0 0 280px;
    }
}