/* ======================== GÉNÉRATEUR DE CV ======================== */
/* Deux zones : formulaire (gauche) + aperçu de la feuille (droite).
   Sur mobile, des onglets basculent entre les deux. */

.cvb-wrap { max-width: 1360px; margin: 0 auto; padding: 40px 24px 80px; }

.cvb-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.cvb-intro { color: var(--text-secondary); font-size: 14px; line-height: 1.6; margin-top: 10px; max-width: 640px; }
.cvb-intro a { color: var(--ts-teal); font-weight: 600; }
.cvb-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.cvb-btn-primary { padding: 12px 24px; border-radius: 100px; border: none; background: var(--gradient-main); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; transition: var(--transition); }
.cvb-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 30px rgba(124,63,219,.35); }
.cvb-btn-ghost { padding: 12px 20px; border-radius: 100px; border: 1px solid var(--glass-border); background: transparent; color: var(--text-secondary); font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; transition: var(--transition); }
.cvb-btn-ghost:hover { color: var(--text-primary); border-color: var(--ts-purple); }

/* Barre de versions (Mes CV) */
.cvb-versions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-md); padding: 12px 16px; box-shadow: var(--shadow-sm); }
.cvb-versions-label { font-size: 13px; font-weight: 800; white-space: nowrap; }
.cvb-version-select { width: auto; min-width: 170px; max-width: 260px; margin-top: 0; padding: 8px 12px; font-weight: 600; }
.cvb-versions .cvb-btn-mini { margin-top: 0; }
.cvb-btn-mini:disabled { opacity: .35; cursor: default; }
.cvb-btn-mini:disabled:hover { color: var(--text-secondary); border-color: var(--glass-border); }
.cvb-versions-hint { font-size: 12px; color: var(--text-tertiary); flex-basis: 100%; }

/* Panneau des CV partagés */
.cvb-share-panel { background: rgba(0,163,163,.07); border: 1px solid rgba(0,163,163,.25); border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 18px; }
.cvb-share-panel-title { font-size: 14px; font-weight: 800; margin-bottom: 12px; }
.cvb-share-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid rgba(0,163,163,.15); }
.cvb-share-row:first-of-type { border-top: none; }
.cvb-share-name { font-weight: 700; font-size: 14px; }
.cvb-share-date { font-size: 12px; color: var(--text-secondary); margin-right: auto; }
.cvb-share-panel-hint { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-top: 10px; }

/* Modale de partage */
.cvb-modal-overlay { position: fixed; inset: 0; background: rgba(10,14,26,.6); backdrop-filter: blur(4px); z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeUp .25s ease; }
.cvb-modal { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); padding: 28px; max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.cvb-modal-title { font-size: 19px; font-weight: 800; margin-bottom: 14px; line-height: 1.3; }
.cvb-modal-text { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 14px; }
.cvb-modal-box { background: var(--glass-hover); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 14px; }
.cvb-modal-box-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--text-secondary); margin-bottom: 8px; }
.cvb-modal-list { list-style: none; padding: 0; margin: 0; }
.cvb-modal-list li { font-size: 13.5px; line-height: 1.6; margin-bottom: 4px; }
.cvb-modal-warn { font-size: 13px; line-height: 1.5; color: #B45309; background: rgba(255,171,0,.12); padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.cvb-modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }

/* Vue conseiller (admin) */
.cvb-admin-notice { background: rgba(0,163,163,.07); border: 1px solid rgba(0,163,163,.25); border-radius: var(--radius-md); padding: 14px 18px; margin-bottom: 22px; font-size: 13.5px; line-height: 1.6; color: var(--text-secondary); }
.cvb-admin-badge { display: inline-block; padding: 4px 12px; border-radius: 100px; background: rgba(0,163,163,.14); color: var(--ts-teal); font-size: 12px; font-weight: 700; white-space: nowrap; }
.cvb-modal-wide { max-width: 900px; }
.cvb-modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.cvb-modal-sub { font-size: 13px; color: var(--text-secondary); }
.cvb-admin-share { border-top: 1px solid var(--glass-border); padding-top: 18px; margin-top: 18px; }
.cvb-admin-share:first-of-type { border-top: none; margin-top: 0; }
.cvb-admin-share-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cvb-admin-sheet-holder { overflow: hidden; }
.cvb-admin-zoom { transform-origin: top left; }

/* Onglets mobile */
.cvb-tabs { display: none; gap: 8px; margin-bottom: 18px; position: sticky; top: 76px; z-index: 20; }
.cvb-tab { flex: 1; padding: 12px; border-radius: 100px; border: 1px solid var(--glass-border); background: var(--glass-bg); color: var(--text-secondary); font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; box-shadow: var(--shadow-sm); }
.cvb-tab.active { background: var(--gradient-main); color: #fff; border-color: transparent; }

.cvb-layout { display: grid; grid-template-columns: minmax(380px, 460px) 1fr; gap: 28px; align-items: start; }
/* min-width:0 : sans ça, la feuille de CV (794px fixes) empêche les colonnes
   de la grille de rétrécir, et l'aperçu ne se met pas à l'échelle sur mobile */
.cvb-form-col, .cvb-preview-col { min-width: 0; }

/* ---- Formulaire ---- */
.cvb-card { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); padding: 22px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.cvb-card-title { font-size: 16px; font-weight: 800; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.cvb-optional { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--ts-teal); background: rgba(0,163,163,.1); padding: 3px 8px; border-radius: 100px; }

.cvb-input { width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--glass-border); background: var(--bg); color: var(--text-primary); font-size: 14px; font-family: inherit; margin-top: 10px; transition: border-color .2s; }
.cvb-input:focus { outline: none; border-color: var(--ts-purple); }
.cvb-input::placeholder { color: var(--text-tertiary); }
textarea.cvb-input { resize: vertical; line-height: 1.5; }
select.cvb-input { cursor: pointer; }

.cvb-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cvb-hint { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-top: 8px; background: var(--glass-hover); padding: 8px 12px; border-radius: var(--radius-sm); }
.cvb-hint-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.cvb-sub-label { font-size: 12px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }

.cvb-btn-mini { padding: 8px 14px; border-radius: 100px; border: 1px solid var(--glass-border); background: transparent; color: var(--text-secondary); font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; white-space: nowrap; margin-top: 8px; transition: var(--transition); }
.cvb-btn-mini:hover { color: var(--text-primary); border-color: var(--ts-purple); }
.cvb-btn-mini.danger:hover { color: #e5484d; border-color: #e5484d; }
.cvb-btn-add { width: 100%; padding: 12px; border-radius: var(--radius-sm); border: 1.5px dashed var(--glass-border); background: transparent; color: var(--ts-purple); font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; margin-top: 12px; transition: var(--transition); }
.cvb-btn-add:hover { border-color: var(--ts-purple); background: var(--glass-hover); }
.cvb-btn-bottom { width: 100%; display: none; }

/* Éléments de liste (expérience / formation) */
.cvb-item { border: 1px solid var(--glass-border); border-radius: var(--radius-md); padding: 14px; margin-top: 12px; background: var(--bg); }
.cvb-item-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--text-secondary); }
.cvb-item-tools { display: flex; gap: 4px; }
.cvb-btn-x { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--glass-border); background: transparent; color: var(--text-secondary); font-size: 13px; cursor: pointer; font-family: inherit; line-height: 1; transition: var(--transition); }
.cvb-btn-x:hover:not(:disabled) { color: var(--text-primary); border-color: var(--ts-purple); }
.cvb-btn-x.danger:hover { color: #e5484d; border-color: #e5484d; }
.cvb-btn-x:disabled { opacity: .3; cursor: default; }
.cvb-lang-row { grid-template-columns: 1fr 1fr 28px; align-items: center; }
.cvb-lang-row .cvb-btn-x { margin-top: 10px; }

/* Photo */
.cvb-photo-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.cvb-photo-thumb { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid var(--glass-border); }
.cvb-photo-empty { display: flex; align-items: center; justify-content: center; font-size: 22px; background: var(--glass-hover); }
.cvb-photo-label { display: inline-block; }

/* Tags */
.cvb-tag-input-row { display: flex; gap: 8px; align-items: flex-end; }
.cvb-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cvb-tag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 100px; background: var(--gradient-main); color: #fff; font-size: 13px; font-weight: 600; }
.cvb-tag button { border: none; background: none; color: rgba(255,255,255,.8); cursor: pointer; font-size: 11px; padding: 0; line-height: 1; font-family: inherit; }
.cvb-tag button:hover { color: #fff; }
.cvb-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cvb-suggestion { padding: 5px 12px; border-radius: 100px; border: 1px dashed var(--glass-border); background: transparent; color: var(--text-secondary); font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; transition: var(--transition); }
.cvb-suggestion:hover { color: var(--ts-purple); border-color: var(--ts-purple); }

/* Apparence */
.cvb-appearance-row { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; }
.cvb-swatches { display: flex; gap: 8px; }
.cvb-swatch { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; transition: var(--transition); }
.cvb-swatch:hover { transform: scale(1.12); }
.cvb-swatch.active { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--bg) inset; }

/* ---- Colonne aperçu ---- */
.cvb-preview-col { position: sticky; top: 90px; }
.cvb-preview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; min-height: 26px; }
.cvb-autosave { font-size: 12px; color: var(--text-tertiary); font-weight: 600; margin-left: auto; }
.cvb-page-warn { font-size: 12px; font-weight: 700; color: #B45309; background: rgba(255,171,0,.14); padding: 5px 12px; border-radius: 100px; }

.cv-zoom-holder { overflow: hidden; }
.cv-zoom { transform-origin: top left; }

/* ======================== LA FEUILLE DE CV ======================== */
/* Conçue à 794px de large = format A4 à 96dpi. La feuille reste toujours
   blanche (même en thème sombre) : c'est un document destiné à l'impression. */

.cv-sheet { --cva: #7C3FDB; width: 794px; min-height: 1123px; background: #fff; color: #26243B; font-family: 'Galano', -apple-system, sans-serif; box-shadow: var(--shadow-lg); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; }

.cv-head-band { display: flex; align-items: center; gap: 24px; padding: 36px 42px 26px; border-bottom: 4px solid var(--cva); }
.cv-photo { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; border: 3px solid var(--cva); flex-shrink: 0; }
.cv-name { font-size: 32px; font-weight: 400; letter-spacing: .5px; color: #1B1830; line-height: 1.15; }
.cv-name strong { font-weight: 800; }
.cv-job { font-size: 14px; font-weight: 700; color: var(--cva); text-transform: uppercase; letter-spacing: 1.5px; margin-top: 6px; }

.cv-cols { display: flex; flex: 1; align-items: stretch; }
.cv-side { width: 252px; flex-shrink: 0; background: #F6F5FB; padding: 26px 24px; }
.cv-main { flex: 1; padding: 26px 30px; min-width: 0; }

.cv-h2 { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; color: var(--cva); margin-bottom: 10px; padding-bottom: 5px; border-bottom: 2px solid var(--cva); }
.cv-side-sec { margin-bottom: 22px; }
.cv-sec { margin-bottom: 20px; }

.cv-c-item { font-size: 12.5px; line-height: 1.5; margin-bottom: 7px; word-break: break-word; }

.cv-ul { list-style: none; padding: 0; margin: 0; }
.cv-ul li { font-size: 12.5px; line-height: 1.55; padding-left: 14px; position: relative; margin-bottom: 5px; }
.cv-ul li::before { content: '●'; position: absolute; left: 0; top: 0; font-size: 7px; line-height: 20px; color: var(--cva); }

.cv-lang { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; margin-bottom: 7px; gap: 8px; }
.cv-lang-lvl { color: #6B6885; font-size: 11.5px; white-space: nowrap; }

.cv-pitch { font-size: 13px; line-height: 1.65; color: #3D3A55; font-style: italic; border-left: 3px solid var(--cva); padding: 2px 0 2px 14px; margin-bottom: 22px; }

.cv-x { margin-bottom: 16px; }
.cv-x-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cv-x-role { font-size: 14.5px; font-weight: 700; color: #1B1830; }
.cv-x-period { font-size: 12px; font-weight: 600; color: var(--cva); white-space: nowrap; }
.cv-x-org { font-size: 12.5px; color: #6B6885; font-weight: 600; margin-top: 2px; }
.cv-x-ul { margin-top: 6px; }

.cv-ph { color: #B9B6CC; font-style: italic; font-weight: 400; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .cvb-layout { grid-template-columns: 1fr; }
    .cvb-tabs { display: flex; }
    .cvb-preview-col { display: none; position: static; }
    .cvb-layout.show-preview .cvb-preview-col { display: block; }
    .cvb-layout.show-preview .cvb-form-col { display: none; }
    .cvb-btn-bottom { display: block; }
}
@media (max-width: 560px) {
    .cvb-wrap { padding: 24px 14px 60px; }
    .cvb-row { grid-template-columns: 1fr; gap: 0; }
    .cvb-lang-row { grid-template-columns: 1fr 1fr 28px; gap: 8px; }
    .cvb-appearance-row { grid-template-columns: 1fr; }
}

/* ======================== IMPRESSION (export PDF) ======================== */
/* La classe cv-print-mode est posée sur <body> le temps de l'impression :
   tout est masqué sauf la feuille de CV, imprimée en pleine page A4. */

@media print {
    body.cv-print-mode { background: #fff !important; }
    @page { size: A4; margin: 0; }

    /* Ne garder que la page du CV */
    body.cv-print-mode > *:not(.main) { display: none !important; }
    body.cv-print-mode .main { padding: 0 !important; }
    body.cv-print-mode .main > *:not(#page-cv-builder) { display: none !important; }
    body.cv-print-mode #page-cv-builder { display: block !important; min-height: 0; }
    body.cv-print-mode .cvb-wrap { padding: 0; max-width: none; }
    body.cv-print-mode .cvb-head, body.cv-print-mode .cvb-versions, body.cv-print-mode .cvb-tabs,
    body.cv-print-mode .cvb-form-col, body.cv-print-mode .cvb-preview-head { display: none !important; }
    body.cv-print-mode .cvb-layout { display: block; }
    body.cv-print-mode .cvb-preview-col { display: block !important; position: static; }

    /* Feuille à taille réelle, sans échelle d'aperçu ni décor */
    body.cv-print-mode .cv-zoom-holder { overflow: visible; height: auto !important; }
    body.cv-print-mode .cv-zoom { transform: none !important; }
    body.cv-print-mode .cv-sheet { width: 210mm; min-height: 296mm; box-shadow: none; border-radius: 0; }

    /* Force l'impression des fonds colorés (bandeau, colonne latérale, puces) */
    body.cv-print-mode * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
