/* Styles globaux — identité rivjob */
html { -webkit-text-size-adjust: 100%; }

body {
  background: #FAFAFA;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

/* Scrollbar discrète */
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }

/* Tabs mobile — état actif */
.tab-btn {
  color: #6b7280;
  background: transparent;
}
.tab-btn.active {
  color: #4f46e5;
  background: #eef2ff;
}

/* Aperçu CV — page A4 rendue à l'écran */
.cv-page {
  width: 210mm;
  min-height: 297mm;
  max-width: 100%;
  background: #ffffff;
  padding: 18mm 16mm;
  box-shadow: 0 20px 45px -20px rgba(79, 70, 229, 0.18), 0 8px 16px -12px rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  color: #111827;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10.5pt;
  line-height: 1.5;
  transition: box-shadow 0.2s ease;
  box-sizing: border-box;
}

/* Sur petits écrans on scale l'aperçu pour éviter le débordement horizontal */
@media (max-width: 900px) {
  .cv-page {
    padding: 12mm 10mm;
    font-size: 10pt;
  }
}

/* Formulaire : rendus consistants pour input/textarea/select */
#cv-form input,
#cv-form textarea,
#cv-form select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background: #ffffff;
  font-size: 0.875rem;
  color: #111827;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
#cv-form input:focus,
#cv-form textarea:focus,
#cv-form select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
#cv-form textarea {
  resize: vertical;
  min-height: 70px;
}
#cv-form label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.3rem;
}

/* Groupes de section dans le formulaire */
.form-section {
  padding-top: 0.5rem;
  border-top: 1px solid #f3f4f6;
}
.form-section:first-child { border-top: 0; padding-top: 0; }

.form-section-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: #111827;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-row {
  background: #fafafa;
  border: 1px solid #f3f4f6;
  border-radius: 0.85rem;
  padding: 0.75rem;
  margin-bottom: 0.6rem;
  position: relative;
}
.form-row .row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.form-row .row-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
}

.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #4f46e5;
  padding: 0.35rem 0.7rem;
  border-radius: 0.6rem;
  background: #eef2ff;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-add:hover { background: #e0e7ff; }

.btn-remove {
  font-size: 0.7rem;
  font-weight: 600;
  color: #ef4444;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 0.4rem;
}
.btn-remove:hover { background: #fee2e2; }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

/* Empêche que la colonne centrale déborde en desktop */
#col-preview { min-width: 0; }

/* Zone de scroll interne : le CV défile ici, la barre "Aperçu / Télécharger"
   reste ancrée en haut de la colonne centrale, elle-même sticky. */
.preview-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 12px 12px; /* évite de couper l'ombre du CV */
  scrollbar-width: thin;
}
.preview-scroll::-webkit-scrollbar {
  width: 8px;
}
.preview-scroll::-webkit-scrollbar-thumb {
  background: #e0e7ff;
  border-radius: 4px;
}
.preview-scroll::-webkit-scrollbar-thumb:hover {
  background: #c7d2fe;
}

/* ============================================================
   Panneau promo Rivjob — style logofa.st CodeFast (épuré)
   Pas de carte, pas de bordure : posé directement sur le fond.
   ============================================================ */
.promo {
  padding: 0.5rem 0 0 0.25rem;
}

.promo-title {
  font-size: 18px;
  font-weight: 800;
  color: #111827;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 0.85rem;
}

.promo-highlight {
  background: linear-gradient(180deg, transparent 55%, #e0e7ff 55%);
  padding: 0 2px;
}

.promo-bullets {
  list-style: disc;
  padding-left: 1.15rem;
  margin: 0 0 1.15rem 0;
}
.promo-bullets li {
  font-size: 13px;
  color: #374151;
  font-weight: 500;
  padding: 2px 0;
  line-height: 1.4;
}
.promo-bullets li::marker {
  color: #111827;
}

.promo-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #e9d5ff;
  color: #111827;
  font-weight: 700;
  font-size: 14px;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.12s ease;
}
.promo-cta:hover {
  background: #d8b4fe;
  transform: translateY(-1px);
}
.promo-cta-icon {
  font-family: 'SF Mono', ui-monospace, monospace;
  font-weight: 800;
  font-size: 13px;
  color: #6b21a8;
}

.promo-testis {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.promo-testi {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
}

.promo-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  flex-shrink: 0;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}

.promo-testi-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 3px;
  min-width: 0;
}

.promo-testi-body p {
  font-size: 12px;
  line-height: 1.45;
  color: #374151;
  margin: 0;
  font-weight: 500;
}

.promo-testi-name {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 600;
}

/* ============================================================
   Menu déroulant "Télécharger" (PDF / Word)
   ============================================================ */
.download-wrap {
  position: relative;
  display: inline-block;
}

.download-caret {
  font-size: 10px;
  line-height: 1;
  opacity: 0.85;
}

.download-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #ffffff;
  border: 1px solid #eef2ff;
  border-radius: 14px;
  box-shadow: 0 20px 40px -12px rgba(79, 70, 229, 0.18), 0 6px 14px -8px rgba(0,0,0,0.08);
  padding: 6px;
  min-width: 170px;
  z-index: 60;
  animation: downloadMenuFade 0.12s ease-out;
}

@keyframes downloadMenuFade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.download-menu button {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
  font-family: inherit;
}
.download-menu button:hover {
  background: #eef2ff;
  color: #4f46e5;
}

.download-menu-icon {
  font-size: 14px;
  line-height: 1;
}

/* ============================================================
   Drag & drop des sections dans l'aperçu CV
   ============================================================ */
.cv-draggable {
  position: relative;
  cursor: grab;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
  border-radius: 6px;
}
.cv-draggable:active {
  cursor: grabbing;
}

/* Poignée : petit "⋮⋮" en haut à gauche, visible au survol */
.cv-draggable::before {
  content: "⠿";
  position: absolute;
  top: 2pt;
  left: -14pt;
  color: #a5b4fc;
  font-size: 13pt;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  font-weight: 700;
}
.cv-draggable:hover::before {
  opacity: 1;
}

/* Léger surlignage au survol pour montrer que c'est déplaçable */
.cv-draggable:hover {
  background: rgba(238, 242, 255, 0.5);
}

/* Section en cours de glissement */
.cv-dragging {
  opacity: 0.35;
}

/* Indicateurs de dépôt (au-dessus / au-dessous de la section cible) */
.cv-drag-over-top {
  box-shadow: 0 -3px 0 0 #6366f1;
}
.cv-drag-over-bottom {
  box-shadow: 0 3px 0 0 #6366f1;
}

/* Petite astuce sous "Aperçu en direct" */
.preview-hint {
  color: #9ca3af;
  font-weight: 500;
  font-size: 11px;
  margin-left: 6px;
}

/* Pas de poignée / surlignage à l'impression ni dans le PDF cloné */
@media print {
  .cv-draggable::before { display: none !important; }
  .cv-draggable:hover { background: transparent !important; }
  .cv-draggable { cursor: auto !important; }
}
.pdf-clone .cv-draggable::before { display: none !important; }
.pdf-clone .cv-draggable { cursor: auto !important; background: transparent !important; }

/* Drag & drop des sections du formulaire (colonne gauche) */
.form-section[data-section-key] {
  transition: opacity 0.15s ease, box-shadow 0.15s ease;
  border-radius: 8px;
}

.form-section-title[draggable="true"] {
  cursor: grab;
  padding-left: 1.15rem;
  position: relative;
  user-select: none;
}
.form-section-title[draggable="true"]:active {
  cursor: grabbing;
}
.form-section-title[draggable="true"]::before {
  content: "⠿";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: #c7d2fe;
  font-size: 14px;
  line-height: 1;
  transition: color 0.15s ease;
  pointer-events: none;
}
.form-section-title[draggable="true"]:hover::before {
  color: #6366f1;
}

.form-section.cv-dragging {
  opacity: 0.4;
}
.form-section.cv-drag-over-top {
  box-shadow: 0 -3px 0 0 #6366f1;
}
.form-section.cv-drag-over-bottom {
  box-shadow: 0 3px 0 0 #6366f1;
}

/* ============================================================
   Modale post-téléchargement (redirection Rivjob)
   ============================================================ */
.jb-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.jb-modal[hidden] { display: none; }

.jb-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(4px);
  animation: jbFade 0.18s ease-out;
}

.jb-modal-card {
  position: relative;
  background: #ffffff;
  border-radius: 20px;
  padding: 2rem 1.75rem 1.5rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 60px -15px rgba(76, 29, 149, 0.35), 0 0 0 1px rgba(0,0,0,0.04);
  animation: jbPop 0.22s cubic-bezier(.2,.9,.3,1.2);
}

.jb-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: transparent;
  border: 0;
  font-size: 26px;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}
.jb-modal-close:hover {
  color: #111827;
  background: #f3f4f6;
}

.jb-modal-emoji {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 0.75rem;
}

.jb-modal-title {
  font-size: 20px;
  font-weight: 800;
  color: #111827;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

.jb-modal-text {
  font-size: 14px;
  color: #4b5563;
  line-height: 1.5;
  margin: 0 0 1.25rem;
}

.jb-modal-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  padding: 0.85rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 10px 25px -8px rgba(99, 102, 241, 0.55);
  transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.jb-modal-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.jb-modal-cta-icon {
  font-family: 'SF Mono', ui-monospace, monospace;
  font-weight: 800;
}

.jb-modal-skip {
  display: block;
  margin: 0.85rem auto 0;
  background: transparent;
  border: 0;
  color: #9ca3af;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.15s ease;
}
.jb-modal-skip:hover { color: #4b5563; }

@keyframes jbFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes jbPop {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
