/* Importation de la police Google Fonts pour un look moderne */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap');

/* Styles généraux */
:root {
    --primary-color: #337ab7;
    --secondary-color: #f8f9fa;
    --text-color: #333;
    --border-color: #dee2e6;
    --background-color: #f4f4f4;
    --card-bg-color: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --success-color: #28a745;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: #337ab7;
    color: white;
    padding: 1rem 2rem;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    /* Les styles de positionnement absolu pour le logo sont supprimés du header */
    display: flex; /* Conserver flexbox pour centrer le contenu du header */
    align-items: center;
    justify-content: center;
    flex-direction: column; /* Organiser le contenu en colonne si nécessaire */
}

header h1 {
    /* margin-left: 70px; */ /* Supprimez ou commentez cette ligne */
    margin: 0; /* Réinitialiser les marges par défaut si besoin */
}

.header-logo {
    /* Styles pour le cercle blanc */
    height: 50px;
    width: 50px;
    border-radius: 50%;
    background-color: white;
    padding: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Nouveaux styles pour le positionnement dans la sidebar */
    margin-bottom: 20px; /* Espace entre le logo et la navigation */
    margin-top: 20px; /* Espace depuis le haut de la sidebar */
    /* Pour centrer horizontalement dans la sidebar si elle a une largeur définie et que le logo est un bloc */
    margin-left: auto;
    margin-right: auto;
}

.header-logo img {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

.langue-selector, .date-today {
    margin-top: 1rem;
    font-size: 1rem;
}

.langue-selector select {
    padding: 0.5rem;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    cursor: pointer;
}

/* Conteneur principal */
.container {
    display: flex;
    flex: 1;
    max-width: 1200px;
    margin: 2rem auto;
    background: var(--card-bg-color);
    box-shadow: var(--shadow);
    border-radius: 12px;
    overflow: hidden;
}

/* Barre latérale */
.sidebar {
    width: 250px;
    background-color: var(--secondary-color);
    padding: 2rem;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin-top: 0; /* Assurez-vous qu'il n'y a pas de marge supérieure excessive */
}

.sidebar nav ul li a {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.3s, color 0.3s;
    font-weight: 500;
}

.sidebar nav ul li a:hover {
    background-color: var(--primary-color);
    color: white;
}

.sidebar nav ul li a.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow);
}

/* Contenu principal */
.content {
    flex: 1;
    padding: 2rem;
    position: relative;
}

.content-section {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden {
    display: none;
}

/* Style des sections de contenu */
h2 {
    font-size: 2rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.mot-du-jour-details, .mot-item {
    background: #fdfdfd;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.mot-du-jour-details h3, .mot-item h3 {
    margin-top: 0;
    font-size: 1.8rem;
    color: var(--primary-color);
}

.mot-item {
    border-left: 5px solid var(--primary-color);
}

/* Ajout de styles pour les sections "Explication" et "Contexte" */
.explication-section, .contexte-section {
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.explication-section h4, .contexte-section h4 {
    margin-top: 0;
    margin-bottom: 0.8rem;
    color: var(--text-color);
    font-size: 1.1rem;
}

/* Formulaires et boutons */
.date-range-selector, .dictionnaire-recherche {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
}

input[type="date"], input[type="text"], input[type="number"], textarea, select {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
}

button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2b6196;
}

/* Boutons spécifiques aux actions (ex: éditer, supprimer) */
button.btn-success {
    background-color: var(--success-color);
}
button.btn-success:hover {
    background-color: #218838;
}
button.btn-danger {
    background-color: var(--danger-color);
}
button.btn-danger:hover {
    background-color: #c82333;
}
button.btn-info {
    background-color: var(--info-color);
}
button.btn-info:hover {
    background-color: #138496;
}

/* Alphabet de navigation */
#alphabet-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.lettre-alphabet {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background-color: #e9ecef;
    border-radius: 50%;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.lettre-alphabet:hover {
    background-color: #d1d5db;
    transform: translateY(-2px);
}

.lettre-alphabet.active {
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
}

.lettre-alphabet.inactive {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Pagination */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pagination-controls button {
    padding: 0.5rem 1rem;
}

.pagination-controls button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.loading-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    display: none;
    text-align: center;
}

/* --- Styles spécifiques à la Page de Connexion Admin --- */
#login-container {
    max-width: 400px;
    margin: 4rem auto;
    background: var(--card-bg-color);
    box-shadow: var(--shadow);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
}

#login-container h2 {
    color: var(--primary-color);
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    font-size: 2rem;
}

#login-container .form-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

#login-container .form-group label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

#login-container input[type="email"],
#login-container input[type="password"] {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
}

#login-container button {
    width: 100%;
    padding: 0.8rem 1.5rem;
    margin-top: 1.5rem;
    font-size: 1.1rem;
}

/* --- Styles Spécifiques à la Page Admin --- */
#admin-content {
    max-width: 900px;
    margin: 2rem auto;
    background: var(--card-bg-color);
    box-shadow: var(--shadow);
    border-radius: 12px;
    padding: 2rem;
}

#admin-content h2 {
    text-align: center;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

/* Alertes / Messages */
.message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
    text-align: center;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Règle pour le design responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        margin: 1rem;
    }

    .sidebar {
        width: 100%;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar nav ul {
        display: flex;
        justify-content: space-around;
        gap: 0.5rem;
    }

    .sidebar nav ul li a {
        padding: 0.75rem;
        text-align: center;
        font-size: 0.9rem;
    }

    .content {
        padding: 1rem;
    }
    
    .date-range-selector, .dictionnaire-recherche {
        flex-direction: column;
        gap: 0.5rem;
    }

    input[type="date"], input[type="text"], button {
        width: 100%;
    }

    /* Admin responsive */
    #admin-content {
        margin: 1rem;
        padding: 1rem;
    }
}