/* =================================================
   DESIGN SPÉCIFIQUE : PAGE TOME 1 (GREEN LIGHT THEME)
   ================================================= */
:root {
    --tome1-color: #84cc16;       /* Vert Clair Principal (Lime 500) */
    --tome1-light: #f7fee7;       /* Vert très très clair (fond) */
    --tome1-border: #bef264;      /* Bordure vert tendre */
    --tome1-dark: #3f6212;        /* Texte vert foncé */
}

/* --- 1. HERO SECTION (En-tête) --- */
.book-hero-section {
    background: linear-gradient(to bottom, #fff 0%, var(--tome1-light) 100%);
    
    /* On enlève l'espace de la section elle-même */
    padding-top: 0 !important; 
    padding-bottom: 4em;
    border-bottom: 1px solid var(--tome1-border);
}

/* C'EST ICI LE SECRET : On annule l'espace par défaut du conteneur */
.book-hero-section .container {
    /* Par défaut, c'était 4em. On le passe à 1em pour qu'il soit tout en haut */
    padding-top: 2em !important; 
}

/* Style du lien "Retour" */
.breadcrumb {
    margin-top: 0;       /* On s'assure qu'il ne pousse pas */
    margin-bottom: 2em; 
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.breadcrumb a {
    text-decoration: none;
    color: #94a3b8; 
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px; 
    transition: all 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--tome1-dark) !important; 
    transform: translateX(-5px); 
}

.hero-grid {
    display: flex;
    align-items: center;
    gap: 4em;
    margin-top: 2em;
}

/* =================================================
   AJUSTEMENTS MOBILES (INDISPENSABLES)
   ================================================= */

@media screen and (max-width: 900px) {
    
    /* 1. Sur mobile, on remet de l'espace en haut pour ne pas
          que le lien soit caché derrière la barre noire du menu */
    .book-hero-section .container {
        padding-top: 4em !important; /* On redonne de l'air */
    }

    /* 2. On centre le lien retour sur mobile pour faire propre */
    .breadcrumb {
        text-align: center;
        display: block; /* Prend toute la largeur */
    }
    
    /* 3. On réduit un peu la taille du titre "Compléments Inédits" 
          pour éviter qu'il ne soit énorme sur petit écran */
    .hero-content h2 {
        font-size: 1.8em;
    }
}

/* Image 3D du livre */
.hero-image { flex: 1; display: flex; justify-content: center; }
.book-3d-wrapper img {
    max-width: 280px;
    width: 100%;
    border-radius: 4px;
    box-shadow: -12px 12px 20px rgba(0,0,0,0.15), -4px 4px 6px rgba(0,0,0,0.1);
    transform: perspective(1000px) rotateY(-5deg);
    transition: transform 0.5s ease;
}
.book-3d-wrapper img:hover { transform: perspective(1000px) rotateY(0deg) scale(1.02); }

/* Contenu Texte */
.hero-content { flex: 1.5; }

.hero-badge {
    background: var(--tome1-color);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-content h2 {
    font-size: 2.2em;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    color: #0f172a;
}

.hero-desc { font-size: 1.1em; line-height: 1.6; color: #475569; }

/* Boite "Statistique Clé" */
.hero-key-stat {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #fff;
    border: 1px solid var(--tome1-border);
    padding: 15px 20px;
    border-radius: 8px;
    margin: 2em 0;
    /* Ombre ajustée au vert */
    box-shadow: 0 4px 6px rgba(132, 204, 22, 0.15);
}
.stat-icon { font-size: 2em; color: var(--tome1-color); }
.stat-text strong { display: block; color: var(--tome1-dark); font-size: 1.1em; }
.stat-text span { font-size: 0.9em; color: #4d7c0f; } /* Légèrement ajusté */

/* Boutons d'action */
.hero-actions { display: flex; gap: 1em; flex-wrap: wrap; }
.hero-actions .button.primary {
    /* Dégradé Vert */
    background: linear-gradient(135deg, #84cc16 0%, #65a30d 100%);
    /* Ombre verte */
    box-shadow: 0 4px 10px rgba(132, 204, 22, 0.4);
    border: none;
    color: #fff !important;
}

/* --- 2. GRILLE FICHIERS (Scripts) --- */
.section-gray { background-color: #f8fafc; border-top: 1px solid #e2e8f0; padding: 4em 0; }

.download-all-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 2.5em;
}
.special-dl {
    background: #0f172a; 
    color: #fff !important;
}
.meta-info { font-size: 0.85em; color: #94a3b8; font-style: italic; }
/* Grille responsive */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Cartes un peu plus larges */
    gap: 2em;
}

/* La carte principale */
.doc-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden; /* Important pour que l'image ne dépasse pas */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.doc-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--tome1-color);
}

/* Zone d'aperçu (Image ou Placeholder) */
.doc-preview {
    height: 180px;
    width: 100%;
    position: relative;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Si vous utilisez une vraie image */
.doc-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Remplit la zone sans déformer */
    object-position: top; /* Montre le haut du document */
    transition: transform 0.5s ease;
}

/* Zoom léger de l'image au survol */
.doc-card:hover .doc-preview img {
    transform: scale(1.05);
}


/* Badge "PDF" en haut à droite */
.doc-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 0.7em;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    z-index: 2;
}

/* Overlay au survol (Bouton Voir) */
.doc-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(var(--tome1-color-rgb, 50, 50, 150), 0.8); /* Fallback blue si var non définie */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 3;
}
/* Note: Si vous n'avez pas de variable RGB, utilisez: background: rgba(59, 130, 246, 0.8); */

.doc-card:hover .doc-overlay {
    opacity: 1;
}

.view-btn {
    background: white;
    color: var(--tome1-color);
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9em;
    transform: translateY(10px);
    transition: transform 0.3s ease;
}

.doc-card:hover .view-btn {
    transform: translateY(0);
}

/* Contenu textuel */
.doc-content {
    padding: 1.2em;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.doc-category {
    text-transform: uppercase;
    font-size: 0.7em;
    letter-spacing: 0.05em;
    color: var(--tome1-color);
    font-weight: 700;
    margin-bottom: 0.5em;
}

.doc-content h4 {
    margin: 0 0 1em 0;
    font-size: 1.1em;
    line-height: 1.4;
    color: #1e293b;
    flex-grow: 1; /* Pousse le footer vers le bas */
}

/* Pied de carte (Taille + Bouton téléchargement) */
.doc-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 1em;
    margin-top: auto;
}

.doc-size {
    font-size: 0.8em;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
}

.download-link {
    color: #64748b;
    font-size: 1.1em;
    transition: color 0.2s;
    padding: 5px;
}

.download-link:hover {
    color: var(--tome1-color);
}

/* --- 3. TABLEAU ERRATA --- */
.errata-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.errata-table { width: 100%; border-collapse: collapse; background: #fff; }
.errata-table th {
    background: #f8fafc;
    text-align: left;
    padding: 1em;
    font-size: 0.9em;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
}
.errata-table td {
    padding: 1em;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
    font-size: 0.95em;
}
.errata-table tr:last-child td { border-bottom: none; }

.page-num { font-weight: 800; color: #0f172a; }
.exo-ref { font-family: monospace; color: #64748b; background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 0.85em; }
.text-error { color: #ef4444; }
.text-correct { color: #15803d; } /* Vert foncé standard */

/* --- RESPONSIVE --- */
@media screen and (max-width: 900px) {
    .hero-grid { flex-direction: column; text-align: center; }
    .hero-content { width: 100%; }
    .hero-actions { justify-content: center; }
    .hero-key-stat { text-align: left; }
    .book-3d-wrapper img { max-width: 200px; }
    .download-all-wrapper { flex-direction: column; align-items: flex-start; }
}
/* Style de la zone Auteur */
.doc-meta {
    font-size: 0.85em;
    color: #555;
    margin-bottom: 10px; /* Espace avant le petit résumé */
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
}

.doc-meta i {
    color: #94a3b8; /* Icône grise claire */
    font-size: 0.9em;
}

/* Petit ajustement pour le titre pour qu'il soit bien espacé du nom */
.doc-content h4 {
    margin-bottom: 5px; 
}

/* Style du résumé (rappel si vous ne l'avez pas mis) */
.doc-excerpt {
    font-size: 0.9em;
    color: #64748b;
    margin-bottom: 15px;
    line-height: 1.4;
    
    /* Coupe le texte après 2 lignes proprement */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- LE BOUTON STYLÉ --- */
.sidebar-contact-btn {
    display: flex;
    align-items: center;       /* Centre verticalement */
    justify-content: center;   /* Centre horizontalement */
    gap: 12px;                 /* Espace propre entre icône et texte */
    
    width: 100%;               /* Prend toute la largeur dispo */
    max-width: 240px;          /* Mais ne devient pas gigantesque */
    padding: 12px 20px;        /* Hauteur confortable */
    
    /* Style "Ghost" sur fond foncé */
    background: rgba(255, 255, 255, 0.05); 
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;       /* Forme de "pilule" moderne */
    
    /* Texte */
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    
    transition: all 0.3s ease;
}

/* L'icône dans le bouton */
.sidebar-contact-btn i {
    font-size: 1.1em;
    margin: 0; 
    line-height: 1; /* Fixe l'alignement vertical */
}

/* EFFET AU SURVOL */
.sidebar-contact-btn:hover {
    background: var(--color-blue); /* Fond bleu */
    border-color: var(--color-blue);
    color: #ffffff !important;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}
/* =================================================
   MINI AVATARS (Sidebar) - Thème Vert (Tome 1)
   ================================================= */
.sidebar-avatars {
    display: flex;
    justify-content: center;
    gap: 15px; 
    margin-top: 2em; 
    padding-bottom: 0.5em;
}

.avatar-link {
    display: block;
    width: 80px;
    height: 80px;
    border-radius: 50%; 
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.2); 
    background-color: #fff;
    border-bottom: none !important; 
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.avatar-link img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    object-position: center top;
    display: block;
}

/* Effet au survol : Adapté au vert du Tome 1 */
.avatar-link:hover {
    transform: translateY(-3px) scale(1.05); 
    border-color: var(--tome1-color); /* Bordure verte */
    box-shadow: 0 4px 15px rgba(132, 204, 22, 0.5); /* Halo vert tendre */
}