/* =========================
   RESET
========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background: #f6f8fc;
    color: #333;
}

/* =========================
   HEADER (MODIFICATION : sticky)
========================= */
.header {
    height: 70px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
    /* ===== MODIFICATION : rendre le header sticky ===== */
    position: sticky;
    top: 0;
    z-index: 1050;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo h2 {
    color: #0f4bd8;
    font-weight: 700;
}

/* =========================
   LAYOUT PRINCIPAL (Sidebar + Main)
   (MODIFICATION : align-items: flex-start)
========================= */
.container {
    display: flex;
    min-height: 100vh;
    /* ===== MODIFICATION : aligner les enfants en haut ===== */
    align-items: flex-start;
}

/* =========================
   SIDEBAR (couleurs du projet)
   (MODIFICATION : sticky + hauteur + overflow)
========================= */
.sidebar {
    background: linear-gradient(180deg, #0a5596, #4094a4);
    width: 260px;
    padding: 20px 0;
    color: #f1f7f1;
    /* ===== MODIFICATION : rendre la sidebar sticky ===== */
    position: sticky;
    top: 70px; /* hauteur du header */
    height: calc(100vh - 70px); /* hauteur restante de l'écran */
    overflow-y: auto; /* permet de scroller à l'intérieur si besoin */
    flex-shrink: 0; /* empêche la sidebar de rétrécir */
    align-self: flex-start; /* reste en haut */
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar ul li {
    padding: 12px 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: .3s;
}

.sidebar ul li:hover:not(.sidebar-section-title) {
    background: rgba(255, 255, 255, 0.15);
}

.sidebar ul li a {
    color: #f1f7f1;
    text-decoration: none;
    display: flex;
    gap: 12px;
    width: 100%;
}

.sidebar ul li.active {
    background: #19b498;
    border-left: 5px solid #f1f7f1;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar ul li.active a {
    color: #ffffff;
}

/* ---------- TITRES DE SECTION ---------- */
.sidebar-section-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: #19b498 !important;
    cursor: default;
    pointer-events: none;
    padding: 20px 25px 5px 25px !important;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-section-title:first-of-type {
    padding-top: 0 !important;
    border-top: none;
}

/* ---------- BADGE DE NOTIFICATION DANS LA SIDEBAR ---------- */
.sidebar .badge.bg-danger {
    background-color: #e74c3c !important;
    color: #fff;
}

/* =========================
   MAIN CONTENT
========================= */
.main {
    flex: 1;
    padding: 25px;
}

/* =========================
   STATISTIQUES (Les 4 cartes en haut)
========================= */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}
.stat-content {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}
.stat-content h3 {
    font-size: 14px;
    margin-bottom: 0;
}
.stat-content .number {
    font-size: 24px; /* réduire un peu pour l'alignement */
}

.card {
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, .08);
    transition: .3s;
}

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

.card h3 {
    font-size: 14px;
    color: #777;
    margin-bottom: 10px;
}

.card .number {
    font-size: 30px;
    font-weight: bold;
}

.blue { border-top: 5px solid #2f80ed; }
.green { border-top: 5px solid #27ae60; }
.orange { border-top: 5px solid #f39c12; }
.red { border-top: 5px solid #eb5757; }

/* =========================
   BOUTONS
========================= */
.btn {
    display: inline-block;
    padding: 12px 25px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: .3s;
}

.btn-primary {
    background: #1f6bff;
    color: white;
}

.btn-primary:hover {
    background: #0d57e0;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

/* =========================
   DASHBOARD (Grille des cartes leçons)
========================= */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    background: #fff;
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
    align-items: center;
}

.lesson-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.lesson-card {
    background: #fff;
    border-radius: 15px;
    padding: 18px 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    transition: .3s;
}

.lesson-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.lesson-card .card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f4bd8;
}

.progress-bar {
    height: 8px;
    background: #eef2f7;
    border-radius: 10px;
    margin: 10px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1f6bff, #27ae60);
    border-radius: 10px;
}

/* =========================
   WORKFLOW TIMELINE
========================= */
.workflow-timeline {
    margin: 15px 0 10px 0;
}

.workflow-steps {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.step {
    flex: 1;
    min-width: 90px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px 6px;
    text-align: center;
    border-left: 4px solid #ccc;
    transition: .3s;
}

.step.done {
    border-left-color: #27ae60;
    background: #eafaf1;
}

.step.in_progress {
    border-left-color: #f39c12;
    background: #fef9e7;
    animation: pulse 1.5s infinite;
}

.step.pending {
    border-left-color: #95a5a6;
}

.step.rejected {
    border-left-color: #eb5757;
    background: #fdedec;
}

.step-number {
    font-weight: bold;
    font-size: 0.9rem;
    color: #0f4bd8;
}

.step-icon {
    font-size: 1rem;
    color: #0f4bd8;
    margin: 4px 0;
}

.step-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #333;
}

.step-duration {
    font-size: 0.6rem;
    color: #777;
}

.step .badge {
    font-size: 0.6rem;
    padding: 2px 6px;
}

/* =========================
   BADGE DE NOTIFICATION (sur la cloche)
========================= */
.badge-notif {
    position: absolute;
    top: -8px;
    right: -10px;
    background: #eb5757;
    color: #fff;
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* =========================
   TOASTS (notifications popup)
========================= */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    width: 100%;
}

.toast {
    background: #1f6bff;
    color: #fff;
    padding: 12px 18px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.4s ease;
    font-size: 0.95rem;
}

.toast .toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
}

.toast .toast-close:hover {
    opacity: 1;
}

/* =========================
   ANIMATIONS
========================= */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* =========================
   BOUTON WORKFLOW (spécifique)
========================= */
.btn-workflow {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 30px;
    background: #1f6bff;
    color: #fff;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    transition: .3s;
}

.btn-workflow:hover {
    background: #0d57e0;
}

/* =========================
   FOOTER (UE)
========================= */
.footer-ue {
    background: #0f2b5c;
    color: #d0d8e8;
    padding: 25px 0;
    margin-top: 40px;
    text-align: center;
    font-size: 0.85rem;
}

.lang-switcher {
    display: inline-block;
    margin-right: 15px;
}

.lang-switcher a {
    color: #0f4bd8;
    text-decoration: none;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    transition: .2s;
}

.lang-switcher a.active {
    background: #1f6bff;
    color: #fff;
}

.lang-switcher a:hover:not(.active) {
    background: #eef2f7;
}

.lang-switcher .separator {
    color: #ccc;
    margin: 0 4px;
}