/* =========================
   RESET GLOBAL
========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  overflow-x: hidden;
}

/* =========================
   VARIABLES THEME CLAIR (Par défaut)
========================= */
:root {
  --background: #f6f8fa;
  --text: #24292f;
  --nav-bg: rgba(255, 255, 255, 0.85);
  --nav-border: #d0d7de;
  --card-bg: #ffffff;
  --card-border: #d0d7de;
  
  /* ROUGE POUR LE MODE CLAIR */
  --accent: #0969da; 
  --shadow: rgba(211, 47, 47, 0.15); /* Ombre légèrement teintée de rouge */
}

/* =========================
   VARIABLES THEME SOMBRE
========================= */
body.dark-mode {
  --background: #0d1117;
  --text: #c9d1d9;
  --nav-bg: rgba(13, 17, 23, 0.85);
  --nav-border: #30363d;
  --card-bg: #161b22;
  --card-border: #30363d;
  
  /* VIOLET CYBER POUR LE MODE SOMBRE 
     (Si tu préfères un rouge néon, remplace par : #ff4d4d) */
  --accent: #d32f2f; 
  --shadow: rgba(168, 85, 247, 0.15); /* Ombre assortie au violet */
}

/* =========================
   BODY & STRUCTURE
========================= */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--background);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: auto;
  padding: 40px 20px;
}

h1 {
  margin-bottom: 30px;
  font-size: 2.5rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  padding-bottom: 10px;
}

/* =========================
   NAVBAR (Glassmorphism)
========================= */
header {
  width: 100%;
}

nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 15px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--nav-border);
  transition: background 0.3s, border-color 0.3s;
}

nav strong {
  font-size: 20px;
  color: var(--text);
}

.menu {
  display: flex;
  gap: 20px;
  align-items: center;
}

nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: 0.2s;
}

nav a:hover {
  color: var(--accent);
}

/* Le lien de la page active */
nav a.active {
  color: var(--accent);
  font-weight: bold;
  /* Optionnel : un petit soulignement stylé */
  border-bottom: 2px solid var(--accent); 
  padding-bottom: 4px; 
}

.menu-toggle {
  display: none;
  font-size: 26px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
}

/* =========================
   HERO (Accueil)
========================= */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
}

.profile-pic {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--accent);
  box-shadow: 0 0 20px var(--shadow);
  margin-bottom: 20px;
}

.name {
  font-size: 32px;
  font-weight: bold;
}

.age {
  margin-top: 8px;
  font-size: 20px;
  color: gray;
}

.job {
  margin-top: 18px;
  font-size: 22px;
  font-weight: bold;
  color: var(--accent);
}

/* Effet Machine à écrire */
#typewriter {
  border-right: 2px solid var(--accent);
  padding-right: 5px;
  animation: blink 0.75s step-end infinite;
}

@keyframes blink {
  from, to { border-color: transparent; }
  50% { border-color: var(--accent); }
}

/* =========================
   CARDS & ANIMATIONS (Scroll)
========================= */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 4px 10px var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s, background 0.3s, border-color 0.3s, opacity 0.6s ease-out;
  opacity: 0;
  transform: translateY(30px);
}

.card.visible {
  opacity: 1;
  transform: translateY(0);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px var(--shadow);
  border-color: var(--accent);
}

.card h2 {
  margin-bottom: 15px;
  color: var(--text);
}

.card p {
  line-height: 1.6;
  margin-bottom: 15px;
}

/* =========================
   GRILLE DE COMPETENCES
========================= */
.skills-grid {
  display: grid;
  /* grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); */
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.skill-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(20px);
}

.skill-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.skill-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px var(--shadow);
  border-color: var(--accent);
}

.skill-card span.icon {
  font-size: 40px;
  display: block;
  margin-bottom: 10px;
}

.skill-card h3 {
  font-size: 16px;
  margin-bottom: 5px;
}

.skill-card p {
  font-size: 13px;
  color: gray;
}

/* =========================
   BOUTONS & PDF
========================= */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  margin-top: 15px;
  transition: 0.3s;
}

.btn:hover {
  opacity: 0.8;
  transform: translateY(-2px);
}

iframe {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  margin-top: 15px;
}

/* =========================
   FLOATING BUTTONS (Theme/Lang)
========================= */
.floating-toggles {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--card-bg);
  padding: 15px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  box-shadow: 0 5px 20px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 9999;
}

.toggle-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: bold;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 34px;
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: .3s;
}

input:checked + .slider {
  background: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 768px) {
  .menu {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 60px;
    right: 20px;
    background: var(--nav-bg);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid var(--nav-border);
    box-shadow: 0 5px 20px var(--shadow);
  }
  .menu.show {
    display: flex;
  }
  .menu-toggle {
    display: block;
  }

  /* --- CORRECTION TAILLE LOGO MOBILE --- */
  .nav-icon {
    width: 24px;
    height: 24px;
  }
}

/* --- Responsive pour les écrans moyens (Tablettes) --- */
@media (max-width: 900px) {
  .skills-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 par ligne */
  }
}

/* --- Responsive pour les petits écrans (Téléphones) --- */
@media (max-width: 600px) {
  .skills-grid {
    grid-template-columns: 1fr; /* 1 par ligne */
  }
}

/* =========================
   NOUVEAUX BOUTONS PROJETS
========================= */

/* Bouton "Voir le projet" stylé et moderne */
.btn-project {
  display: block;
  text-align: center;
  background: transparent;
  color: var(--text);
  border: 2px solid var(--accent);
  padding: 12px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  margin-top: 25px;
  transition: all 0.3s ease;
}

.btn-project:hover {
  background: var(--accent);
  color: #fff !important;
  box-shadow: 0 0 15px var(--shadow);
  transform: translateY(-3px);
}

/* Bouton de retour en arrière stylé */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text);
  text-decoration: none;
  font-weight: bold;
  border-radius: 8px;
  transition: 0.3s ease;
  box-shadow: 0 2px 5px var(--shadow);
  /* AJOUT DE LA MARGE ICI POUR ELOIGNER DU TITRE */
  margin-bottom: 30px; 
  margin-right: 20px;
}

.back-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateX(-5px); /* Petit effet de glissement vers la gauche */
}

/* ============================================================
   SECTION DOCUMENTS & LIVRABLES (FORMATIONS & PROJETS)
   ============================================================ */

/* Titre principal de la zone documents */
.docs-title {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.8em;
    font-weight: bold;
    margin-top: 35px;
}

/* Description textuelle au-dessus des documents */
.docs-description {
    margin-bottom: 30px;
    line-height: 1.6;
}

/* Conteneur global (gestion de l'alignement vertical) */
.docs-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    width: 100%;
}

/* Lignes de documents (gestion de l'alignement horizontal) */
.docs-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 30px;
    width: 100%;
}

/* --- Carte d'aperçu du document --- */
.doc-preview {
    background: var(--card-bg);
    border: 2px dashed var(--card-border);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 450px; /* Taille agrandie pour une meilleure visibilité */
    height: 100%;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.doc-preview:hover {
    border-color: var(--accent);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--shadow);
}

/* Spécificité pour les documents officiels (Fiche RNCP) */
.doc-official {
    border-style: solid; /* Différenciation visuelle pour le côté officiel */
}

/* --- Image miniature (Thumbnail) --- */
.doc-thumb {
    width: 100%;
    height: 250px; /* Hauteur agrandie pour l'aperçu */
    object-fit: cover;
    object-position: top center;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    margin-bottom: 20px;
    box-shadow: 0 2px 5px var(--shadow);
}

/* --- Textes internes à la carte --- */
.doc-title {
    font-size: 1.4em;
    font-weight: bold;
    margin-top: 10px;
    margin-bottom: 10px;
}

.doc-type {
    font-size: 1em;
    color: gray;
    margin-bottom: 20px;
    flex-grow: 1; /* Pousse le bouton vers le bas pour l'alignement */
}

/* --- Bouton interne à la carte --- */
.doc-preview .btn {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    margin-top: auto;
}

/* Style spécifique pour le bouton d'accentuation (RNCP) */
.btn-accent {
    background-color: var(--accent) !important;
    color: #fff !important;
}

/* --- Responsive : Ajustements pour mobile --- */
@media (max-width: 600px) {
    .doc-preview {
        max-width: 100%;
        padding: 15px;
    }
    
    .doc-thumb {
        height: 180px; /* On réduit un peu la hauteur sur petit écran */
    }
}


/* ============================================================
   INTÉGRATION CV - ZÉRO MOUVEMENT & ZÉRO BORDURE
   ============================================================ */

/* 1. Conteneur principal (La Card) */
.cv-card-wrapper {
    max-width: 950px;
    margin: 40px auto;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px var(--shadow);
}

/* 2. En-tête (Titre et Bouton) */
.cv-header-minimal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* 3. LE MASQUE (La fenêtre de visualisation) */
.cv-mask {
    position: relative;
    width: 100%;
    /* Hauteur calculée pour un A4 sans scroll interne */
    height: 1280px; 
    overflow: hidden; /* COUPE TOUT CE QUI DÉPASSE */
    background: #ffffff; /* Fond blanc papier */
    border-radius: 4px;
    /* On empêche l'interaction directe pour bloquer le scroll interne */
    pointer-events: none; 
}

/* 4. L'IFRAME (Propulsée hors du cadre) */
.cv-iframe {
    position: absolute;
    /* Décalage agressif pour masquer les bordures et ombres natives */
    top: -15px; 
    left: -15px;
    
    /* On l'élargit de 60px pour être CERTAIN de sortir la scrollbar du cadre */
    width: calc(100% + 30px); 
    height: calc(100% + 30px);
    
    border: none !important;
    outline: none !important;
}

/* 5. Bouton de téléchargement */
.btn-download-icon {
    text-decoration: none;
    color: var(--accent);
    font-weight: bold;
    border: 2px solid var(--accent);
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
    /* On s'assure que le bouton reste cliquable malgré le pointer-events: none du parent */
    position: relative;
    z-index: 10;
}

.btn-download-icon:hover {
    background: var(--accent);
    color: #ffffff;
}

/* 6. Adaptation Mobile */
@media (max-width: 768px) {
    .cv-mask {
        height: 250px; /* On réduit la zone pour ne pas avoir un grand vide */
        background: transparent;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px dashed var(--card-border);
    }
    .cv-iframe {
        display: none;
    }
    .cv-mask::after {
        content: "📄 CV interactif optimisé pour PC";
        color: var(--text);
        font-style: italic;
    }
}

/* ============================================================
   BADGE CATÉGORIE DE TP
   ============================================================ */


/* --- Ajustements pour les TP --- */

/* Badge de catégorie */
.tp-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 12px;
    background: var(--accent); /* Utilise ta variable accent */
    color: #fff;
}

/* Couleurs spécifiques aux catégories */
.tp-tag.cloud { background: #6366f1; }    /* Indigo */
.tp-tag.security { background: #d32f2f; } /* Rouge (ou var --accent) */
.tp-tag.network { background: #0ea5e9; }  /* Bleu ciel */
.tp-tag.system { background: #64748b; }   /* Gris Ardoise */

/* Force les cartes à avoir la même hauteur et pousse le bouton en bas */
.skills-grid .card {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 100%;
}

.skills-grid .card p {
    flex-grow: 1; /* Pousse le bouton vers le bas */
    font-size: 0.95rem;
    color: var(--text);
    opacity: 0.9;
}

/* Alignement du titre de la page */
h1 {
    margin-top: 10px;
}

/* =========================
   PLACEHOLDER "EN COURS"
========================= */

/* Ce bloc remplace l'image .doc-thumb */
.doc-placeholder {
    /* Dimensions identiques à tes images d'aperçu */
    width: 100%;
    height: 250px; 

    /* Centrage parfait du texte */
    display: flex;
    justify-content: center;
    align-items: center;

    /* Style visuel "En travaux" */
    background-color: rgba(128, 128, 128, 0.05); /* Fond subtil transparent */
    border: 2px dashed var(--card-border); /* Bordure en pointillés */
    border-radius: 8px;
    margin-bottom: 20px; /* Marge identique à l'image */
    
    /* Style du texte */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: gray; /* Couleur neutre par défaut */
    transition: all 0.3s ease;
}

/* Effet au survol : le texte et la bordure prennent la couleur d'accentuation */
.doc-preview:hover .doc-placeholder {
    color: var(--accent);
    border-color: var(--accent);
    background-color: rgba(128, 128, 128, 0.1);
}

/* Carte globale désactivée */
.doc-disabled {
    cursor: not-allowed; /* Curseur \"interdit\" */
    opacity: 0.7;        /* Rend la carte légèrement transparente */
}

/* On annule les effets de survol pour la carte désactivée */
.doc-disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--card-border);
}

.doc-disabled:hover .doc-placeholder {
    /* Le texte reste gris au lieu de prendre la couleur d'accentuation */
    color: gray; 
    border-color: var(--card-border);
    background-color: rgba(128, 128, 128, 0.05);
}

/* Bouton désactivé (gris et non cliquable) */
.btn-disabled {
    background-color: #6c757d !important; /* Gris neutre */
    color: #ffffff !important;
    pointer-events: none; /* Empêche tout clic techniquement */
    opacity: 0.8;
}

/* =========================================
   CLASSES UTILITAIRES (REMPLACEMENT STYLES INLINE)
   ========================================= */

/* Navigation Branding */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-icon {
  width: 50px;
  height: 30px;
  border-radius: 5px;
  object-fit: cover;
}

/* Certifications */
.cert-card-flex {
  display: flex;
  align-items: center;
  gap: 25px;
  flex-wrap: wrap;
}
.cert-icon {
  font-size: 60px;
  text-align: center;
  min-width: 80px;
}
.cert-content {
  flex: 1;
  min-width: 250px;
}
.cert-title {
  margin-bottom: 5px;
}
.text-accent-bold {
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 10px;
}
.cert-action {
  text-align: right;
}
.cert-btn {
  margin-top: 0;
}

/* Contact */
.contact-info {
  margin-top: 15px;
  font-size: 18px;
}
.contact-link {
  color: var(--accent);
  text-decoration: none;
}

/* Typographie et Espacements communs */
.page-main-title {
  text-align: center;
  margin: 10px 0 40px 0;
  border: none;
}
.custom-list {
  margin-left: 20px;
  line-height: 1.8;
}
.custom-list-mt {
  margin-left: 20px;
  margin-top: 15px;
  line-height: 1.8;
}
.list-item-mt {
  margin-top: 10px;
}
.text-accent {
  color: var(--accent);
}

.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.mb-25 { margin-bottom: 25px; }
.mb-50 { margin-bottom: 50px; }

/* Projets & TP spécifiques */
.project-title {
  margin: 40px 0;
}
.text-center {
  text-align: center;
}
.btn-full-auto {
  width: 100%;
  margin-top: auto;
}
.btn-danger {
  background: #d04423 !important;
}
.btn-danger:hover {
  background: #a83519 !important;
}
.title-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 40px 0;
}
.back-absolute {
  position: absolute;
  left: 0;
  margin: 0;
  padding: 8px 15px;
  font-size: 0.85rem;
}
.tp-main-title {
  margin: 0;
  border: none;
  font-size: 2.2rem;
  text-align: center;
}
.flex-center {
  display: flex;
  justify-content: center;
}
.doc-preview-large {
  max-width: 400px;
  width: 100%;
}