@font-face {
    font-family: 'Zetkin';
    src: url('assets/zetkin/Zetkin-Regular.woff2') format('woff2'),
         url('assets/zetkin/Zetkin-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-stretch: normal;
}

@font-face {
    font-family: 'Zetkin';
    src: url('assets/zetkin/Zetkin-Wide.woff2') format('woff2'),
         url('assets/zetkin/Zetkin-Wide.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-stretch: expanded;
}

@font-face {
    font-family: 'Zetkin';
    src: url('assets/zetkin/Zetkin-RegularOblique.woff2') format('woff2'),
         url('assets/zetkin/Zetkin-RegularOblique.woff') format('woff');
    font-weight: normal;
    font-style: oblique;
    font-stretch: normal;
}

@font-face {
    font-family: 'Zetkin';
    src: url('assets/zetkin/Zetkin-Bold.woff2') format('woff2'),
         url('assets/zetkin/Zetkin-Bold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
    font-stretch: normal;
}

@font-face {
    font-family: 'Zetkin';
    src: url('assets/zetkin/Zetkin-BoldOblique.woff2') format('woff2'),
         url('assets/zetkin/Zetkin-BoldOblique.woff') format('woff');
    font-weight: bold;
    font-style: oblique;
    font-stretch: normal;
}

/* Styles globaux pour le body */
body {
    font-family: 'Zetkin', sans-serif;
    margin: 0;
    padding: 0;
    color: #141239;
    min-height: 100vh;
    background-color: cornflowerblue;
}

/* Style spécifique pour la page d'accueil */
body.home {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 2rem;
}

/* Style spécifique pour les pages de cours */
body.course-page {
    padding: 2rem 0;
}

/* Conteneur principal */
.container {
    text-align: center;
    width: 90%;
    max-width: 1200px;
    padding: 20px;
    margin: 0 auto;
}

/* Style de l'en-tête */
header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: normal;
    color: white;
}

/* Style de l'en-tête des pages de cours */
.course-page header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: normal;
    color: #141239;
}


strong {
    font-weight: bold;
}

.disclaimer {
    margin-top: 50px;
    color: grey;
    font-size: 0.8em;
    line-height: 1.8em;
    letter-spacing: 0.6px;
}

/* Grille des tuiles */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    position: relative;
    background: cornflowerblue;
    padding: 20px;
    border-radius: 15px;
}

/* Style des tuiles */
.tile {
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 0;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: visible;
}

/* Style des images de couverture */
.tile .cover-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 15px 15px 0 0;
    margin-bottom: 0;
}

/* Conteneur pour le texte */
.tile .content {
    padding: 20px;
    background: white;
    border-radius: 0 0 15px 15px;
}

/* Style pour les tuiles inactives */
.tile.inactive {
    cursor: not-allowed;
    opacity: 0.7;
    filter: grayscale(100%);
}

.tile.inactive::after {
    content: "Bientôt disponible";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9em;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.tile.inactive:hover::after {
    opacity: 1;
}

/* Agrandissement et ombre plus prononcée au survol */
.tile:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

/* Titre dans chaque tuile */
.tile h2 {
    font-size: 1.5em;
    color: #333;
    margin: 0 0 10px 0;
}

.tile p {
    color: #666;
    margin: 0 0 10px 0;
}

.lessons-count {
    font-size: 0.9em;
    color: #888;
    margin-top: auto;
}

/* Bouton retour */
.back-button {
    display: inline-block;
    padding: 10px 20px;
    margin-bottom: 20px;
    background-color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Zetkin', sans-serif;
    font-size: 1em;
    transition: background-color 0.3s ease;
    color: #141239;
    width: auto;
}

.back-button:hover {
    background-color: #f0f0f0;
}

/* Styles pour la modale */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 15px;
    width: 450px;
    text-align: center;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease;
    position: relative;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content h2 {
    margin-top: 0;
    font-size: 2em;
    color: #333;
}

.modal-content input {
    width: 90%;
    padding: 12px;
    margin-top: 15px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 1em;
}

.modal-content button {
    margin-top: 20px;
    padding: 12px 25px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.modal-content button:hover {
    background-color: #45a049;
}

.modal-content .close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5em;
    cursor: pointer;
    color: #aaa;
    transition: color 0.3s ease;
}

.modal-content .close-btn:hover {
    color: #000;
}

.modal-content .error-message {
    color: red;
    margin-top: 10px;
    display: none;
}

/* Adaptation pour les petits écrans */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 15px;
        margin: 10px auto;
    }
    
    .grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .back-button {
        width: 100%;
        margin-bottom: 15px;
    }
}

/* Style du bouton de déconnexion */
.logout-button {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    background-color: white;
    color: #141239;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
    z-index: 1000;
    font-family: 'Zetkin', sans-serif;
}

.logout-button:hover {
    background-color: #f0f0f0;
}

.back-home {
    display: inline-block;
    padding: 10px 20px;
    margin-bottom: 20px;
    background: none;
    border: none;
    color: #141239;
    font-family: 'Zetkin', sans-serif;
    font-size: 1em;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.3s ease;
}

.back-home:hover {
    color: #4a4a4a;
}

/* Styles pour le conteneur des modules */
.modules-container {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 10px;
    z-index: 10;
    padding: 0 20px;
    animation: slideDown 0.3s ease-out;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Animation de déploiement */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Grille des modules */
.modules-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Style des modules */
.modules-grid .tile {
    background-color: white;
    transform: none;
    flex-direction: row;
    align-items: center;
    padding: 10px;
    height: auto;
    transition: all 0.2s ease;
    margin: 0;
    border-radius: 10px;
}

.modules-grid .tile .cover-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    margin: 0 15px 0 0;
}

.modules-grid .tile .content {
    padding: 0;
    text-align: left;
    flex: 1;
}

.modules-grid .tile h2 {
    font-size: 1.1em;
    margin: 0 0 5px 0;
}

.modules-grid .tile p {
    font-size: 0.9em;
    margin: 0;
    color: #666;
}

.modules-grid .tile:hover {
    transform: translateX(10px);
    background-color: #f8f9fa;
}

.modules-grid .tile.inactive {
    opacity: 0.5;
}

.modules-grid .tile.inactive:hover::after {
    content: "Bientôt disponible";
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8em;
}

/* Adaptation pour les petits écrans */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .tile {
        margin-bottom: 0;
    }

    .modules-container {
        position: static;
        margin: -15px 0 30px 0;
        padding: 10px;
        max-width: 100%;
        transform-origin: top;
        animation: slideDownMobile 0.3s ease-out;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 0 0 15px 15px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }

    @keyframes slideDownMobile {
        from {
            opacity: 0;
            transform: scaleY(0);
            margin-bottom: 0;
        }
        to {
            opacity: 1;
            transform: scaleY(1);
            margin-bottom: 30px;
        }
    }

    .modules-grid {
        padding: 5px;
        background: none;
        box-shadow: none;
        border-radius: 0;
    }

    .modules-grid .tile {
        border-radius: 8px;
        margin: 5px 0;
        background: white;
    }

    .modules-grid .tile .cover-image {
        width: 50px;
        height: 50px;
        margin-right: 10px;
    }

    .modules-grid .tile .content {
        padding-right: 10px;
    }

    .modules-grid .tile h2 {
        font-size: 1em;
    }

    .modules-grid .tile p {
        font-size: 0.85em;
    }

    .modules-grid .tile:hover {
        transform: translateX(5px);
    }
}

/* Styles pour le chargement progressif des images */
.lazy {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.lazy.loaded {
    opacity: 1;
}

/* Placeholder pour les images en cours de chargement */
.lazy:not(.loaded) {
    background: #f0f0f0;
    position: relative;
}

.lazy:not(.loaded)::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border: 2px solid #ccc;
    border-top-color: #666;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}
