/* ============================================
   LEARN LAB — Feuille de style principale
   Charte graphique Worklab
   Police : Nunito (Google Fonts)
   ============================================ */

/* ---- Variables ---- */
:root {
    --bleu:        #1226AA;
    --corail:      #FF8672;
    --vert-eau:    #3BD4AE;
    --vert-clair:  #D2EA8E;
    --jaune:       #ECD925;
    --rose:        #FFBE9F;

    --blanc:       #FFFFFF;
    --gris-bg:     #F5F6FA;
    --gris-bord:   #E4E6F0;
    --gris-texte:  #6B7280;
    --noir-soft:   #1A1A2E;

    --radius-sm:   8px;
    --radius-md:   14px;
    --radius-lg:   24px;
    --shadow-sm:   0 2px 8px rgba(18,38,170,.08);
    --shadow-md:   0 6px 24px rgba(18,38,170,.12);
    --shadow-lg:   0 16px 48px rgba(18,38,170,.16);

    --transition:  .25s ease;
    --font:        'Nunito', sans-serif;
}

/* ---- Reset & base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.65;
    color: var(--noir-soft);
    background: var(--gris-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--bleu); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--corail); }

img { max-width: 100%; display: block; }

/* ---- Layout ---- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.site-main {
    flex: 1;
    padding-bottom: 60px;
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
    background: var(--blanc);
    border-bottom: 2px solid var(--gris-bord);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    height: 68px;
}

/* Logo */
.logo {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -.5px;
    flex-shrink: 0;
}
.logo-learn { color: var(--bleu); }
.logo-lab   { color: var(--corail); }

/* Navigation */
.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.nav-link {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .95rem;
    color: var(--gris-texte);
    transition: all var(--transition);
}
.nav-link:hover,
.nav-link.active {
    color: var(--bleu);
    background: rgba(18,38,170,.07);
}
.nav-link--admin {
    color: var(--corail);
}
.nav-link--admin:hover {
    background: rgba(255,134,114,.1);
    color: var(--corail);
}

/* User menu */
.header-actions { margin-left: auto; flex-shrink: 0; }

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bleu);
    color: var(--blanc);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: .95rem;
}

.user-name {
    font-weight: 700;
    font-size: .9rem;
    color: var(--noir-soft);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: var(--blanc);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gris-bord);
    min-width: 180px;
    overflow: hidden;
}
.user-menu:hover .user-dropdown { display: block; }

.user-dropdown a {
    display: block;
    padding: 10px 18px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--noir-soft);
    transition: background var(--transition);
}
.user-dropdown a:hover {
    background: var(--gris-bg);
    color: var(--bleu);
}

/* Menu mobile toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
}
.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--bleu);
    border-radius: 2px;
    transition: var(--transition);
}

/* ============================================
   FLASH MESSAGES
   ============================================ */
.flash {
    padding: 14px 0;
    font-weight: 600;
    font-size: .95rem;
}
.flash--success { background: var(--vert-clair); color: #1a5230; }
.flash--error   { background: #fde8e8; color: #c0392b; }
.flash--info    { background: #e8eeff; color: var(--bleu); }

/* ============================================
   BOUTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1;
}
.btn:focus { outline: 3px solid rgba(18,38,170,.3); outline-offset: 2px; }

.btn-primary {
    background: var(--bleu);
    color: var(--blanc);
    border-color: var(--bleu);
}
.btn-primary:hover {
    background: #0e1e8a;
    border-color: #0e1e8a;
    color: var(--blanc);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-corail {
    background: var(--corail);
    color: var(--blanc);
    border-color: var(--corail);
}
.btn-corail:hover {
    background: #e06a56;
    border-color: #e06a56;
    color: var(--blanc);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--bleu);
    border-color: var(--bleu);
}
.btn-outline:hover {
    background: var(--bleu);
    color: var(--blanc);
}

.btn-ghost {
    background: transparent;
    color: var(--gris-texte);
    border-color: var(--gris-bord);
}
.btn-ghost:hover {
    background: var(--gris-bg);
    color: var(--noir-soft);
}

.btn-sm { padding: 8px 16px; font-size: .875rem; }
.btn-lg { padding: 16px 32px; font-size: 1.1rem; }
.btn-full { width: 100%; justify-content: center; }

/* ============================================
   HERO (page catalogue)
   ============================================ */
.hero {
    background: var(--bleu);
    color: var(--blanc);
    padding: 64px 0 72px;
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 300px; height: 300px;
    border-radius: 50%;
    background: rgba(255,255,255,.05);
}
.hero::before {
    content: '';
    position: absolute;
    bottom: -80px; left: -40px;
    width: 250px; height: 250px;
    border-radius: 50%;
    background: rgba(255,134,114,.15);
}

.hero-content { position: relative; z-index: 1; }

.hero h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 16px;
}
.hero h1 span { color: var(--corail); }

.hero p {
    font-size: 1.1rem;
    opacity: .85;
    max-width: 520px;
    margin-bottom: 32px;
}

.hero-stats {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}
.hero-stat strong {
    display: block;
    font-size: 1.8rem;
    font-weight: 900;
}
.hero-stat span { font-size: .9rem; opacity: .8; }

/* ============================================
   FORMATION CARDS
   ============================================ */
.section {
    padding: 48px 0;
}
.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--noir-soft);
    margin-bottom: 28px;
}
.section-title span { color: var(--corail); }

.formations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.card {
    background: var(--blanc);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--gris-bord);
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.card-top {
    height: 8px;
    flex-shrink: 0;
}

.card-thumbnail {
    height: 160px;
    background: var(--gris-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.card-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.card-thumbnail-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.card-body {
    padding: 20px 22px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-category {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gris-texte);
    margin-bottom: 6px;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--noir-soft);
    margin-bottom: 8px;
    line-height: 1.3;
}

.card-desc {
    font-size: .9rem;
    color: var(--gris-texte);
    line-height: 1.5;
    flex: 1;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
    gap: 4px;
}
.badge-level { background: var(--gris-bg); color: var(--gris-texte); }
.badge-duration { background: rgba(18,38,170,.08); color: var(--bleu); }

.card-footer {
    padding: 0 22px 20px;
}

/* Barre de progression */
.progress-bar-wrap {
    margin-bottom: 12px;
}
.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
    font-weight: 700;
    color: var(--gris-texte);
    margin-bottom: 6px;
}
.progress-bar {
    height: 6px;
    background: var(--gris-bord);
    border-radius: 10px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 10px;
    background: var(--vert-eau);
    transition: width .4s ease;
}

/* ============================================
   FORMULAIRES
   ============================================ */
.form-card {
    background: var(--blanc);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    max-width: 480px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}
.form-label {
    display: block;
    font-size: .875rem;
    font-weight: 700;
    color: var(--noir-soft);
    margin-bottom: 6px;
}
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gris-bord);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 1rem;
    color: var(--noir-soft);
    background: var(--blanc);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus {
    outline: none;
    border-color: var(--bleu);
    box-shadow: 0 0 0 3px rgba(18,38,170,.1);
}
.form-input::placeholder { color: #aaa; }
.form-hint {
    font-size: .8rem;
    color: var(--gris-texte);
    margin-top: 4px;
}
.form-error {
    font-size: .8rem;
    color: #c0392b;
    margin-top: 4px;
    font-weight: 600;
}

/* Tabs */
.form-tabs {
    display: flex;
    border-bottom: 2px solid var(--gris-bord);
    margin-bottom: 28px;
}
.form-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-weight: 700;
    font-size: .9rem;
    color: var(--gris-texte);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: var(--font);
}
.form-tab.active {
    color: var(--bleu);
    border-bottom-color: var(--bleu);
}
.form-tab-content { display: none; }
.form-tab-content.active { display: block; }

/* ============================================
   PAGE LOGIN
   ============================================ */
.login-page {
    min-height: calc(100vh - 68px);
    display: flex;
    align-items: center;
    padding: 40px 0;
    background: var(--gris-bg);
}

.login-brand {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo {
    font-size: 2.2rem;
    font-weight: 900;
    display: block;
    margin-bottom: 8px;
}
.login-subtitle {
    font-size: .9rem;
    color: var(--gris-texte);
}

/* ============================================
   DASHBOARD
   ============================================ */
.page-header {
    background: var(--blanc);
    border-bottom: 2px solid var(--gris-bord);
    padding: 32px 0;
    margin-bottom: 40px;
}
.page-header h1 {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--noir-soft);
}
.page-header p {
    color: var(--gris-texte);
    margin-top: 4px;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}
.stat-card {
    background: var(--blanc);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gris-bord);
    display: flex;
    align-items: center;
    gap: 18px;
}
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-info strong {
    display: block;
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--noir-soft);
    line-height: 1;
}
.stat-info span {
    font-size: .85rem;
    color: var(--gris-texte);
    font-weight: 600;
}

/* ============================================
   ADMIN
   ============================================ */
.admin-layout {
    display: flex;
    min-height: calc(100vh - 68px);
}

.admin-sidebar {
    width: 240px;
    background: var(--blanc);
    border-right: 2px solid var(--gris-bord);
    padding: 28px 0;
    flex-shrink: 0;
}
.admin-sidebar-title {
    padding: 0 20px 16px;
    font-size: .75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--gris-texte);
}
.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    font-weight: 700;
    font-size: .9rem;
    color: var(--gris-texte);
    transition: all var(--transition);
    border-left: 3px solid transparent;
}
.admin-nav a:hover,
.admin-nav a.active {
    color: var(--bleu);
    background: rgba(18,38,170,.05);
    border-left-color: var(--bleu);
}

.admin-content {
    flex: 1;
    padding: 36px 40px;
    overflow: auto;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}
.admin-header h1 {
    font-size: 1.5rem;
    font-weight: 900;
}

/* Tables admin */
.table-wrap {
    background: var(--blanc);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gris-bord);
    overflow: hidden;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.data-table th {
    background: var(--gris-bg);
    padding: 12px 16px;
    text-align: left;
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gris-texte);
    border-bottom: 2px solid var(--gris-bord);
}
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gris-bord);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gris-bg); }
.data-table .actions {
    display: flex;
    gap: 8px;
}

/* Modales */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--blanc);
    border-radius: var(--radius-lg);
    padding: 36px;
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
    animation: modalIn .2s ease;
}
@keyframes modalIn {
    from { transform: translateY(-20px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.modal-title {
    font-size: 1.2rem;
    font-weight: 800;
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--gris-texte);
    line-height: 1;
    padding: 4px;
}
.modal-close:hover { color: var(--noir-soft); }

/* ============================================
   FORMATION PAGE (vue module)
   ============================================ */
.formation-hero {
    padding: 48px 0 40px;
    margin-bottom: 0;
}
.formation-hero-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 40px;
}
.formation-breadcrumb {
    font-size: .85rem;
    color: var(--gris-texte);
    margin-bottom: 12px;
}
.formation-breadcrumb a { color: var(--gris-texte); }
.formation-breadcrumb a:hover { color: var(--bleu); }
.formation-title {
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 12px;
}
.formation-desc {
    color: var(--gris-texte);
    max-width: 560px;
    margin-bottom: 20px;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--gris-texte);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--noir-soft);
    margin-bottom: 8px;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    background: var(--blanc);
    border-top: 2px solid var(--gris-bord);
    padding: 36px 0 24px;
    margin-top: auto;
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 32px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.footer-brand .logo-learn { color: var(--bleu); font-weight: 900; font-size: 1.3rem; }
.footer-brand .logo-lab   { color: var(--corail); font-weight: 900; font-size: 1.3rem; }
.footer-brand p { color: var(--gris-texte); font-size: .85rem; margin-top: 4px; }
.footer-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}
.footer-links a {
    color: var(--gris-texte);
    font-size: .9rem;
    font-weight: 600;
}
.footer-links a:hover { color: var(--bleu); }
.footer-bottom {
    border-top: 1px solid var(--gris-bord);
    padding-top: 16px;
    font-size: .8rem;
    color: var(--gris-texte);
}

/* ============================================
   UTILITAIRES
   ============================================ */
.text-center { text-align: center; }
.text-muted   { color: var(--gris-texte); }
.text-bleu    { color: var(--bleu); }
.text-corail  { color: var(--corail); }
.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-16 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .main-nav { display: none; }
    .main-nav.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 68px; left: 0; right: 0;
        background: var(--blanc);
        border-bottom: 2px solid var(--gris-bord);
        padding: 12px 24px 20px;
        box-shadow: var(--shadow-md);
        z-index: 99;
    }
    .menu-toggle { display: flex; }
    .header-inner { position: relative; }

    .hero { padding: 40px 0 48px; }
    .hero-stats { gap: 24px; }

    .formations-grid { grid-template-columns: 1fr; }

    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; border-right: none; border-bottom: 2px solid var(--gris-bord); padding: 16px 0; }
    .admin-content { padding: 24px 16px; }

    .form-card { padding: 28px 20px; }

    .formation-hero-inner { grid-template-columns: 1fr; }

    .stats-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .stats-row { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.6rem; }
}
