/* Styles spécifiques pour la page d'accueil */

/* Import des polices utilisées sur le site (accueil seulement) */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code&family=Orbitron:wght@600&family=Lato:wght@400;700&display=swap');

/* Variables nécessaires pour l'accueil (indépendant des fiches) */
:root {
    --python-blue: #306998;
    --python-yellow: #FFD43B;
    --bg-light: #ffffff;
    --accent-bg: rgba(48, 105, 152, 0.05);
    --code-bg: #f0f0f0;
    --yellow-bg: rgba(255, 212, 59, 0.15);
}

/*
 * On applique la couleur de fond à l'élément HTML.
 * Cela permet au `body` de rester transparent (comme défini dans fiche-nsi.css)
 * pour laisser passer l'image de fond, tout en ayant une couleur de fond
 * générale pour la page d'accueil.
 */
html {
    background-color: #f4f7f6; /* Fond général de la page */
}

body {
    /* Centrage vertical et horizontal du contenu */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 2rem 1rem; /* Marge de sécurité sur les petits écrans */
    box-sizing: border-box;
    /* La couleur de fond est maintenant sur HTML, on s'assure que le body est bien transparent */
    background-color: transparent;
    color: #333;
}

.index-container {
    max-width: 800px;
    width: 100%;
    margin: 0; /* Le centrage est géré par le flexbox du body */
    padding: 2rem;
    background-color: #ffffff; /* Fond blanc pour le conteneur principal */
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* Ombre portée subtile */
    /* On réinitialise la grille pour la page d'accueil */
    display: block;
}

.search-container {
    margin-bottom: 1.5rem;
}

#search-bar {
    width: 100%;
    padding: 10px 15px;
    font-size: 1rem;
    border-radius: 6px;
    border: 1px solid #ddd;
    box-sizing: border-box;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1em;
    padding: 8px 12px; /* Zone cliquable plus grande */
    border-bottom: 2px solid #eee;
    border-radius: 6px; /* Coins arrondis pour l'effet de survol */
    cursor: pointer; /* Indique que toute la zone est cliquable */
    transition: background-color 0.2s ease;
    user-select: none; /* Empêche la sélection du texte sur toute la zone */
}

.list-header:hover {
    background-color: #f0f2f5; /* Effet de survol unifié */
}

.list-header h2 {
    /* On restaure le style "halo jaune" des fiches pour la cohérence */
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--python-blue);
    position: relative;
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    margin: 0;
    background: var(--yellow-bg);
    border-left: 0.5rem solid var(--python-yellow);
    border-radius: 6px;
    box-shadow: inset 0 0 0.15em rgba(255, 212, 59, 0.8);
}

/* Indicateur flèche pour l'accordéon */
.list-header h2::before {
    content: '▼';
    position: absolute;
    left: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--python-blue); /* Rendre la flèche visible sur le fond jaune */
    transition: transform 0.3s ease-in-out;
}

.list-header.collapsed h2::before {
    transform: translateY(-50%) rotate(-90deg);
}

.download-all-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

.download-all-link:hover {
    background-color: #e9ecef;
    color: #0056b3;
}

.download-all-link .icon {
    width: 18px;
    height: 18px;
}

.fiche-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
}

.fiche-list.collapsed {
    max-height: 0; /* Le JS gère la hauteur, !important n'est plus nécessaire */
}

.fiche-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.fiche-list li:last-child {
    border-bottom: none;
}

.fiche-list .fiche-name {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.2s ease;
}

.fiche-list .fiche-name:hover {
    color: #007bff;
}

.fiche-list .download-link {
    color: #6c757d;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fiche-list .download-link:hover {
    background-color: #e9ecef;
    color: #343a40;
}

.fiche-list .download-link .icon {
    width: 20px;
    height: 20px;
}

/* --- Footer Styles --- */
.index-footer {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
    color: #6c757d;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.footer-license {
    text-align: center;
    line-height: 1.5;
}

.footer-license a,
.footer-project a {
    color: #007bff;
    font-weight: 500;
    text-decoration: none;
}

.footer-license a:hover,
.footer-project a:hover {
    text-decoration: underline;
}

.license-icon {
    max-width: 1em;
    max-height: 1em;
    margin-left: .2em;
    vertical-align: text-bottom; /* Aligne mieux les icônes avec le texte */
}

.footer-project {
    margin-top: 0.75rem;
}

.footer-link-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    color: #6c757d;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link-item:hover {
    color: #007bff;
}

.footer-link-item .icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* --- Masonry Layout Styles --- */
.masonry-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.masonry-column {
    flex: 1;
    min-width: 0; /* Permet aux colonnes de se rétrécir */
}

.masonry-column section {
    margin-bottom: 20px;
    break-inside: avoid; /* Évite de couper les sections entre les colonnes */
}

/* Responsive masonry */
@media (max-width: 768px) {
    .masonry-wrapper {
        flex-direction: column;
        gap: 15px;
    }
    
    .masonry-column {
        width: 100%;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .masonry-wrapper {
        gap: 15px;
    }
}

@media (min-width: 1025px) {
    .masonry-wrapper {
        gap: 25px;
    }
}

/* --- Timestamp Styles --- */
.footer-timestamp {
    margin-top: 0.5rem;
    text-align: center;
}

.timestamp {
    font-size: 0.8rem;
    color: #6c757d;
    font-style: italic;
    background-color: #f8f9fa;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}