:root { --ui-primaire: #8b5cf6; --ui-fond: #f8fafc; --ui-bordure: #cbd5e1; --ui-sombre: #0f172a; }
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', system-ui, sans-serif; }
body { background-color: var(--ui-fond); color: var(--ui-sombre); height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* INTERFACE UTILISATEUR */
header { background: white; border-bottom: 1px solid var(--ui-bordure); padding: 12px 25px; display: flex; justify-content: space-between; align-items: center; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.logo { font-size: 1.5rem; font-weight: 800; color: var(--ui-primaire); }
.btn-telecharger { background: var(--ui-primaire); color: white; border: none; padding: 10px 20px; border-radius: 8px; font-weight: bold; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 6px rgba(139, 92, 246, 0.25); }
.btn-telecharger:hover { background: #7c3aed; transform: translateY(-1px); }
.app-principale { display: flex; height: calc(100vh - 60px); }

/* SIDEBAR (GAUCHE) */
.barre-laterale-editeur { width: 450px; background: white; border-right: 1px solid var(--ui-bordure); overflow-y: auto; padding: 30px; display: flex; flex-direction: column; gap: 2rem; }
.section-formulaire { display: flex; flex-direction: column; gap: 1rem; }
.etiquette-section { font-size: 0.85rem; font-weight: 800; color: #64748b; text-transform: uppercase; border-bottom: 2px solid #e2e8f0; padding-bottom: 5px; }
.groupe-saisie label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; color: #334155; }
.groupe-saisie input, .groupe-saisie textarea, .groupe-saisie select { width: 100%; padding: 10px; border: 1px solid var(--ui-bordure); border-radius: 6px; font-size: 0.9rem; background: #f8fafc; transition: 0.2s; }
.groupe-saisie input:focus, .groupe-saisie textarea:focus { border-color: var(--ui-primaire); outline: none; background: white; }
.groupe-saisie textarea { min-height: 100px; resize: vertical; }
.groupe-saisie input[type="range"] { padding: 0; background: transparent; accent-color: var(--ui-primaire); cursor: pointer; }
.televersement-photo { border: 2px dashed var(--ui-primaire); padding: 20px; text-align: center; border-radius: 8px; cursor: pointer; color: var(--ui-primaire); background: #f5f3ff; font-weight: 600; }

/* PREVIEW (DROITE) */
.panneau-apercu { flex-grow: 1; background: #e2e8f0; padding: 40px; overflow-y: auto; display: flex; justify-content: center; align-items: flex-start; }
#zone-rendu-cv { width: 210mm; height: 297mm; background: white; box-shadow: 0 10px 30px rgba(0,0,0,0.15); position: relative; overflow: hidden; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }

/* ROGNAGE */
.superposition-modal-rognage { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.9); z-index: 1000; justify-content: center; align-items: center; }
.boite-rognage { background: white; padding: 25px; border-radius: 12px; width: 600px; max-width: 95%; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.5); }
.conteneur-rognage { width: 100%; height: 400px; background: #e2e8f0; margin-bottom: 20px; display: flex; justify-content: center; align-items: center; }
.conteneur-rognage img { display: block; max-width: 100%; max-height: 100%; }
.actions-rognage { display: flex; justify-content: flex-end; gap: 10px; }
.btn { padding: 10px 20px; border-radius: 6px; border: none; cursor: pointer; font-weight: bold; }
.btn-annuler { background: #e2e8f0; color: #333; }
.btn-confirmer { background: var(--ui-primaire); color: white; }

/* RÉGLAGES D'ESPACEMENTS DYNAMIQUES */
#zone-rendu-cv { --espacement-titre: 8px; --espacement-paragraphe: 19px; }
#zone-rendu-cv .texte-cv { white-space: pre-wrap; font-size: 0.9rem; line-height: 1.4; margin-bottom: var(--espacement-paragraphe); }
#zone-rendu-cv .titre-section { margin-bottom: var(--espacement-titre); }
.liste-contact { display: flex; flex-direction: column; gap: 8px; }
.element-contact { display: flex; align-items: center; gap: 12px; }
.element-contact i { width: 16px; text-align: center; opacity: 0.8; font-size: 0.95em; }
.photo { background-size: cover; background-position: center; display: block; }

/* THÈMES */
/* 1. Corporate minimaliste */
.t-corp { color: #1e293b; padding: 40px; height: 100%; }
.t-corp .en-tete { display: flex; align-items: center; border-bottom: 3px solid #1e293b; padding-bottom: 15px; margin-bottom: 15px; }
.t-corp .photo { width: 90px; height: 90px; border-radius: 50%; margin-right: 25px; background-color: #eee;}
.t-corp h1 { font-size: 2.5rem; letter-spacing: -1px; margin-bottom: 5px; }
.t-corp .mise-en-page { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; }
.t-corp .titre-section { border-bottom: 1px solid #cbd5e1; padding-bottom: 4px; color: #0f172a; text-transform: uppercase; font-weight: bold; margin: 12px 0 0px; }

/* 2. Glassmorphism */
.t-verre { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); color: #1f2937; padding: 30px; height: 100%; }
.t-verre .conteneur-verre { background: rgba(255, 255, 255, 0.45); backdrop-filter: blur(10px); border-radius: 20px; padding: 30px; border: 1px solid rgba(255,255,255,0.6); box-shadow: 0 8px 32px rgba(0,0,0,0.1); height: 100%; display: grid; grid-template-columns: 1fr 2fr; gap: 30px; }
.t-verre .photo { width: 100%; aspect-ratio: 1; border-radius: 50%; margin-bottom: 15px; border: 4px solid white; box-shadow: 0 4px 15px rgba(0,0,0,0.1); background-color: white;}
.t-verre h1 { font-size: 2.5rem; color: #374151; margin-bottom: 5px; }
.t-verre .titre-section { font-size: 1rem; text-transform: uppercase; letter-spacing: 2px; color: #4b5563; margin: 15px 0 0px; padding-bottom: 4px; border-bottom: 1px solid rgba(0,0,0,0.1); }

/* 3. Pastel nature */
.t-pastel { background: #fdfbf7; color: #4a5d23; padding: 40px; position: relative; border-top: 20px solid #8fbc8f; height: 100%; }
.t-pastel .mise-en-page { display: grid; grid-template-columns: 1.8fr 1.2fr; gap: 35px; }
.t-pastel .en-tete { text-align: center; margin-bottom: 25px; }
.t-pastel .photo { width: 120px; height: 120px; border-radius: 30px; margin: 0 auto 15px auto; border: 3px solid #8fbc8f; background-color: #eee;}
.t-pastel h1 { font-family: Georgia, serif; font-size: 2.2rem; color: #2e3b1f; line-height: 1.1; margin-bottom: 5px; }
.t-pastel .boite { background: #f4ebd8; padding: 12px 18px; border-radius: 15px; margin-bottom: var(--espacement-paragraphe); }
.t-pastel .titre-section { color: #2e3b1f; text-transform: uppercase; font-weight: bold; border-bottom: 2px solid #8fbc8f; display: inline-block; margin-bottom: 5px; }

/* 4. Tech moderne */
.t-tech { color: #1e293b; display: grid; grid-template-columns: 280px 1fr; height: 100%; }
.t-tech .barre-laterale { background: #0f172a; color: white; padding: 40px; }
.t-tech .principal { padding: 40px; }
.t-tech .photo { width: 100%; aspect-ratio: 1; border-radius: 20px; background-color: #334155; margin-bottom: 25px; border: 4px solid #6366f1; }
.t-tech h1 { font-size: 2.2rem; color: #6366f1; text-transform: uppercase; margin-bottom: 5px; }
.t-tech .titre-section { border-bottom: 2px solid #6366f1; padding-bottom: 4px; margin: 15px 0 0px; font-size: 1.1rem; color: inherit; text-transform: uppercase; font-weight: bold;}

/* 5. Bold start-up */
.t-bold { background: white; color: black; display: flex; flex-direction: column; height: 100%; }
.t-bold .en-tete { background: #ffe600; padding: 25px 40px; display: flex; align-items: center; gap: 30px; border-bottom: 5px solid black; }
.t-bold .photo { width: 110px; height: 110px; border: 5px solid black; box-shadow: 6px 6px 0px black; background-color: white;}
.t-bold h1 { font-size: 2.8rem; font-weight: 900; text-transform: uppercase; line-height: 1; margin-bottom: 12px; }
.t-bold .mise-en-page { display: grid; grid-template-columns: 1fr 1fr; gap: 0; flex-grow: 1; }
.t-bold .colonne { padding: 30px 40px; }
.t-bold .colonne:first-child { border-right: 5px solid black; }
.t-bold .titre-section { font-size: 1.1rem; font-weight: 900; background: black; color: white; padding: 4px 10px; display: inline-block; }

/* 6. Créatif étudiant */
.t-crea { color: #431407; background: #fffcf0; height: 100%; }
.t-crea .en-tete-crea { background: #fde047; padding: 30px 40px 70px; border-radius: 0 0 50% 50%; text-align: center; position: relative; margin-bottom: 85px;}
.t-crea .photo { width: 130px; height: 130px; border-radius: 50%; border: 8px solid #fffcf0; position: absolute; bottom: -65px; left: 50%; transform: translateX(-50%); background-color: white;}
.t-crea .contenu { padding: 0 40px 40px; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.t-crea h1 { font-size: 2.8rem; font-family: 'Georgia', serif; }
.t-crea .boite { background: #fef9c3; padding: 15px 20px; border-radius: 20px; margin-bottom: var(--espacement-paragraphe); }
.t-crea .titre-section { font-weight: bold; font-size: 1.1rem; border-bottom: 2px dashed #fbbf24; display: inline-block;}

/* 7. Élégant resto */
.t-resto { padding: 0; background: #ffffff; color: #4b3621; height: 100%; }
.t-resto .bande-superieure { height: 15px; background: #8b4513; }
.t-resto .en-tete { padding: 25px 40px; text-align: center; border-bottom: 1px double #8b4513; margin: 0 40px; }
.t-resto .photo { width: 110px; height: 140px; float: left; margin-right: 20px; border: 1px solid #ddd; background-color: #eee;}
.t-resto .conteneur { padding: 25px 40px; display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.t-resto h1 { font-family: 'Times New Roman', serif; font-size: 2.5rem; letter-spacing: 3px; text-transform: uppercase;}
.t-resto .titre-section { text-align: center; text-transform: uppercase; letter-spacing: 2px; border-top: 1px solid #8b4513; border-bottom: 1px solid #8b4513; padding: 4px 0; margin: 15px 0 0px; }

/* 8. Premium velours */
.t-velours { background: #ffffff; color: #333; display: grid; grid-template-columns: 30% 70%; height: 100%; }
.t-velours .barre-laterale { background: #4a0e17; color: #f4e8d3; padding: 30px 25px; }
.t-velours .principal { padding: 30px 40px; }
.t-velours .photo { width: 100%; aspect-ratio: 0.8; border: 2px solid #d4af37; margin-bottom: 25px; background-color: #eee;}
.t-velours h1 { font-family: 'Playfair Display', serif; font-size: 3rem; color: #4a0e17; margin-bottom: 5px; }
.t-velours .titre-section { font-family: 'Playfair Display', serif; color: #d4af37; font-size: 1.3rem; border-bottom: 1px solid #d4af37; padding-bottom: 6px; margin: 15px 0 0px; text-transform: uppercase; }
.t-velours .barre-laterale .titre-section { border-color: #f4e8d3; color: #f4e8d3; padding-bottom: 6px; }

/* 9. Cyberpunk rétro */
.t-cyber { background: #0b0c10; color: grey; padding: 40px; border: 10px solid #45a29e; height: 100%; }
.t-cyber .en-tete { background: #1f2833; padding: 20px 30px; clip-path: polygon(0 0, 100% 0, 95% 100%, 0% 100%); display: flex; align-items: center; gap: 30px; margin-bottom: 20px; }
.t-cyber .photo { width: 100px; height: 100px; clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); }
.t-cyber h1 { font-size: 2.5rem; color: #66fcf1; text-transform: uppercase; letter-spacing: 2px; text-shadow: 2px 2px 0px #1f2833; }
.t-cyber .mise-en-page { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.t-cyber .titre-section { font-size: 1rem; color: #1f2833; background: #66fcf1; display: inline-block; padding: 2px 15px; transform: skewX(-15deg); margin: 15px 0 0px; font-weight: bold; text-transform: uppercase; }

/* 10. Néon tech */
.t-neon { background: #0a0a0a; color: grey; font-family: 'Courier New', monospace; display: grid; grid-template-columns: 250px 1fr; height: 100%; }
.t-neon .barre-laterale { background: #111; border-right: 2px dashed #00ffcc; padding: 30px; }
.t-neon .principal { padding: 30px 40px; }
.t-neon .photo { width: 100%; aspect-ratio: 1; border: 2px solid #00ffcc; margin-bottom: 20px; background-color: #222;}
.t-neon h1 { color: #00ffcc; font-size: 2rem; text-transform: uppercase; }
.t-neon .titre-section { color: #ff00ff; border-bottom: 1px solid #333; padding-bottom: 4px; margin: 15px 0 0px; text-transform: uppercase;}

/* RESPONSIVE */
@media (max-width: 900px) {
    body {
        height: auto;
        overflow-y: auto;
    }
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px;
    }
    .btn-telecharger {
        width: 100%;
    }
    .app-principale {
        flex-direction: column;
        height: auto;
    }
    .barre-laterale-editeur {
        width: 100%;
        padding: 20px;
        border-right: none;
        border-bottom: 2px solid var(--ui-bordure);
        overflow-y: visible;
    }
    .panneau-apercu {
        width: 100%;
        padding: 20px 0;
        overflow: hidden;
        display: block;
    }
    #zone-rendu-cv {
        margin: 0;
    }
    .boite-rognage {
        padding: 15px;
    }
    .conteneur-rognage {
        height: 250px;
    }
    .actions-rognage {
        flex-direction: column;
    }
    .actions-rognage .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* EXPORTATION PDF */
@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }
    body {
        margin: 0;
        padding: 0;
        height: auto;
        overflow: visible;
        background-color: white;
    }
    
    header, .barre-laterale-editeur, .superposition-modal-rognage {
        display: none !important;
    }
    
    .app-principale {
        display: block;
        height: auto;
    }
    
    .panneau-apercu {
        padding: 0;
        background: transparent;
        overflow: visible;
        display: block;
    }
    
    #zone-rendu-cv {
        box-shadow: none;
        width: 210mm;
        height: 297mm;
        margin: 0 !important;
        transform: none !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        page-break-after: avoid;
        page-break-before: avoid;
    }
}