/* ============================================================
   MOBILE ÉDITEUR — Onglets Formulaire / Aperçu
   Visible uniquement sur mobile (≤900px)
   Desktop : inchangé
   ============================================================ */

/* Barre d'onglets — cachée par défaut (desktop) */
.mobile-editor-tabs {
  display: none;
}

@media(max-width: 900px) {

  /* ── Barre d'onglets ── */
  .mobile-editor-tabs {
    display: flex;
    background: var(--card-bg);
    border-bottom: 2px solid var(--border);
    /* pas de position:sticky — le scroll parent est overflow:visible
       donc sticky devenait fixed et chevauchait le contenu */
    position: relative;
    z-index: 10;
    flex-shrink: 0;
  }

  .mobile-tab-btn {
    flex: 1;
    padding: 12px 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: color .15s, border-color .15s;
  }

  .mobile-tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
  }

  .mobile-tab-btn i {
    font-size: 14px;
  }

  /* ── Éditeur CV : show-form / show-preview ── */
  .editor-layout.show-form .editor-panel {
    display: flex !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .editor-layout.show-form .editor-preview {
    display: none !important;
  }

  .editor-layout.show-preview .editor-panel {
    display: none !important;
  }

  .editor-layout.show-preview .editor-preview {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    min-height: 60vh;
    overflow: visible !important;
  }

  /* ── Éditeur LM : show-form / show-preview ── */
  .lettre-layout.show-form .lettre-panel {
    display: flex !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    border-bottom: none !important;
  }
  .lettre-layout.show-form .lettre-scroll {
    overflow-y: auto !important;
    max-height: none !important;
  }

  .lettre-layout.show-form .lettre-preview-panel {
    display: none !important;
  }

  .lettre-layout.show-preview .lettre-panel {
    display: none !important;
  }

  .lettre-layout.show-preview .lettre-preview-panel {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    min-height: 60vh;
    overflow: visible !important;
  }

  /* ── Boutons action compact sur mobile ── */
  .editor-btns {
    flex-wrap: wrap;
    gap: 4px;
  }

  .editor-btns .btn {
    font-size: 11px;
    padding: 5px 8px;
  }

  /* ── Layout éditeur mobile ── */
  .editor-layout {
    flex-direction: column;
    height: auto;
    min-height: 0;
  }

  .lettre-layout {
    flex-direction: column;
    height: auto;
    min-height: 0;
  }
}


/* ============================================================
   BOUTONS FLOTTANTS NAVIGATION MOBILE — Éditeur CV + LM
   Visibles uniquement sur mobile dans les sections d'édition
   ============================================================ */
#mobile-float-nav {
  position: fixed;
  right: 14px;
  bottom: 80px;
  z-index: 300;
  display: flex !important;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

#mobile-float-nav.visible {
  pointer-events: all;
}

#float-btn-up,
#float-btn-down {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(8, 145, 178, 0.55);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
  opacity: 0;
  transform: translateX(60px);
  transition: opacity .25s ease, transform .25s ease, background .15s;
  pointer-events: none;
}

#mobile-float-nav.visible #float-btn-up,
#mobile-float-nav.visible #float-btn-down {
  opacity: 1;
  transform: translateX(0);
  pointer-events: all;
}

#float-btn-down {
  transition-delay: .05s;
}

#float-btn-up:active,
#float-btn-down:active {
  background: rgba(8, 145, 178, 0.9);
  transform: scale(.92);
}

/* Caché sur desktop */
@media(min-width: 901px) {
  #mobile-float-nav {
    display: none !important;
  }
}

@media print {
  .sidebar,
  .topbar,
  .editor-panel,
  .lettre-panel,
  .modal {
    display: none !important;
  }

  .editor-preview,
  .lettre-preview-panel {
    height: auto;
    overflow: visible;
  }
}
