/* ============================================================
   MON VISUEL — éléments, textes, images, calques, assistant
   ============================================================ */

.section-hint {
  font-size: 12.5px;
  color: #94a3b8;
  margin: -4px 0 10px;
  line-height: 1.45;
}

/* ── Titres de bloc ── */
.calques-titre {
  font-size: 13.5px;
  color: #e2e8f0;
  margin: 16px 0 6px;
  padding-top: 12px;
  border-top: 1px solid #334155;
}
.calques-titre:first-of-type { margin-top: 4px; padding-top: 0; border-top: none; }
.calques-titre small { font-weight: 400; color: #64748b; font-size: 11px; }

/* ── ② ACTIONS RAPIDES ── */
.actions-rapides {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0 4px;
}
.btn-action {
  flex: 1 1 auto;
  min-width: 130px;
  background: #1e293b;
  border: 1px solid #475569;
  color: #e2e8f0;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  text-align: center;
}
.btn-action:hover { border-color: #f59e0b; background: #263449; }
.btn-action.fichier { position: relative; overflow: hidden; }
.btn-action.fichier input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 100px;
}
.btn-action.apercu {
  background: linear-gradient(90deg, #172554, #1e3a8a);
  border-color: #3b82f6;
  color: #dbeafe;
}
.btn-action.apercu.actif {
  background: #166534;
  border-color: #22c55e;
  color: #bbf7d0;
}

/* ── Liste des calques ── */
.calques-liste {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 8px;
  max-height: 280px;
  overflow-y: auto;
}
.calque {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 9px;
  padding: 7px 9px;
  cursor: pointer;
  transition: all 0.15s;
}
.calque:hover { border-color: #f59e0b; background: #1e293b; }
.calque.actif {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.13);
  box-shadow: inset 3px 0 0 #f59e0b;
}
.calque.masque { opacity: 0.45; }
.calque-mini { flex-shrink: 0; line-height: 0; }
.calque-mini svg { display: block; }
.calque-ic { font-size: 20px; flex-shrink: 0; width: 26px; text-align: center; }
.calque-img {
  width: 26px; height: 26px;
  object-fit: contain;
  border-radius: 4px;
  background: #1e293b;
  flex-shrink: 0;
}
.calque-info { flex: 1; min-width: 0; }
.calque-info b {
  display: block;
  font-size: 12.5px;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calque-info small { font-size: 10.5px; color: #64748b; }
.calque-actions { display: flex; gap: 3px; flex-shrink: 0; }
.calque-actions button {
  background: #334155;
  border: none;
  color: #e2e8f0;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  font-family: inherit;
  transition: all 0.15s;
}
.calque-actions button:hover { background: #475569; }
.calque-actions button.sup { background: #7f1d1d; color: #fecaca; }
.calque-actions button.sup:hover { background: #991b1b; }

/* ── Panneau de réglages ── */
.elements-panel { margin-bottom: 10px; }
.elem-vide {
  font-size: 12.5px;
  color: #64748b;
  background: #0f172a;
  border: 1px dashed #334155;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  line-height: 1.5;
}
.elem-carte {
  background: #0f172a;
  border: 1px solid #f59e0b;
  border-radius: 10px;
  padding: 12px;
}
.elem-titre {
  font-size: 13px;
  font-weight: 600;
  color: #f59e0b;
  margin-bottom: 10px;
}
.elem-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #94a3b8;
  margin: 8px 0 4px;
}
.elem-label span { color: #f59e0b; font-weight: 600; }
.elem-note {
  font-size: 11.5px;
  color: #64748b;
  font-style: italic;
  margin: 8px 0;
}
.elem-carte input[type="range"] {
  width: 100%;
  margin-bottom: 6px;
  accent-color: #f59e0b;
}
.elem-textarea {
  width: 100%;
  background: #1e293b;
  border: 1px solid #475569;
  color: #e2e8f0;
  border-radius: 7px;
  padding: 8px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  margin-bottom: 6px;
}
.elem-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.btn-mini {
  background: #334155;
  border: none;
  color: #e2e8f0;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-mini:hover { background: #475569; }
.btn-mini.actif { background: #166534; color: #bbf7d0; }
.btn-mini.danger { background: #7f1d1d; color: #fecaca; }
.btn-mini.danger:hover { background: #991b1b; }

/* ── ONGLETS ILLUSTRATIONS / PHOTOS ── */
.src-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  background: #0f172a;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid #334155;
}
.src-tab {
  flex: 1;
  background: none;
  border: none;
  color: #94a3b8;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.src-tab:hover { color: #e2e8f0; background: #1e293b; }
.src-tab.active {
  background: linear-gradient(90deg, #172554, #1e3a8a);
  color: #fff;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.5);
}
.vcat-bar-inner { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── VIGNETTES PHOTOS ── */
.visuel-btn.photo { padding: 5px 4px 5px; }
.visuel-photo {
  width: 100%;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  background: #1e293b;
}
.visuels-grid.mode-photos .visuels-grid,
.visuels-grid.mode-photos { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
.vgroupe-grid .visuel-btn.photo .visuel-photo { height: 58px; }

/* ── Bibliothèque ── */
.vcat-bar { margin-bottom: 12px; }
.vcat {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 6px 10px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: inherit;
}
.vcat:hover { border-color: #f59e0b; color: #fff; }
.vcat.active { background: #f59e0b; border-color: #f59e0b; color: #1e293b; font-weight: 600; }
.vcat-tout {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  color: #1e293b !important;
  font-weight: 700;
  border-color: #f59e0b;
}
.vcat-tout.active { background: #166534; color: #bbf7d0 !important; border-color: #166534; }

.visuels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}
.visuels-grid.mode-tout { display: block; max-height: 380px; }
.vgroupe { margin-bottom: 14px; }
.vgroupe-titre {
  font-size: 11.5px;
  font-weight: 700;
  color: #f59e0b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 7px;
  padding-bottom: 5px;
  border-bottom: 1px solid #334155;
}
.vgroupe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}
.visuel-btn {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 8px 4px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
  font-family: inherit;
}
.visuel-btn:hover { border-color: #f59e0b; background: #1e293b; transform: translateY(-2px); }
.visuel-btn:active { transform: scale(0.96); }
.visuel-img, .visuel-img svg { display: block; width: 46px; height: 46px; line-height: 0; }
.visuel-nom { font-size: 9.5px; color: #94a3b8; text-align: center; line-height: 1.2; }

#preview-canvas { touch-action: none; }

/* ══════════════════════════════════════════════
   ASSISTANT D'AIDE
   ══════════════════════════════════════════════ */
.aide-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 900;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #1e293b;
  font-size: 25px;
  cursor: pointer;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.18s;
}
.aide-btn:hover { transform: scale(1.09); }
.aide-btn::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(245, 158, 11, 0.45);
  animation: pulse-aide 2.4s infinite;
}
@keyframes pulse-aide {
  0%   { transform: scale(1);   opacity: 0.8; }
  70%  { transform: scale(1.22); opacity: 0; }
  100% { transform: scale(1.22); opacity: 0; }
}

.aide-panneau {
  position: fixed;
  right: 20px;
  bottom: 88px;
  z-index: 901;
  width: 370px;
  max-width: calc(100vw - 32px);
  max-height: min(560px, calc(100vh - 130px));
  background: #121c30;
  border: 1px solid #334155;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.aide-panneau.ouvert { display: flex; }

.aide-tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  background: linear-gradient(90deg, #172554, #1e3a8a);
  border-bottom: 2px solid #f59e0b;
}
.aide-tete b { display: block; color: #fff; font-size: 14.5px; }
.aide-tete small { color: #bfdbfe; font-size: 11.5px; }
.aide-fermer {
  background: none;
  border: none;
  color: #cbd5e1;
  font-size: 17px;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 6px;
}
.aide-fermer:hover { background: rgba(255, 255, 255, 0.13); color: #fff; }

.aide-corps {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.aide-msg {
  font-size: 13px;
  line-height: 1.55;
  padding: 10px 13px;
  border-radius: 12px;
  max-width: 92%;
  word-wrap: break-word;
}
.aide-msg.bot {
  background: #1e293b;
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.aide-msg.user {
  background: #1e3a8a;
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.aide-msg b { color: #fbbf24; }

.aide-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.aide-sugg {
  background: #0f172a;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 8px 11px;
  border-radius: 9px;
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.15s;
}
.aide-sugg:hover { border-color: #f59e0b; background: #1e293b; color: #fff; }

.aide-pied {
  display: flex;
  gap: 7px;
  padding: 11px;
  border-top: 1px solid #334155;
  background: #0f172a;
}
.aide-pied input {
  flex: 1;
  background: #1e293b;
  border: 1px solid #475569;
  color: #e2e8f0;
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
}
.aide-pied input:focus { outline: none; border-color: #f59e0b; }
.aide-pied button {
  background: #f59e0b;
  border: none;
  color: #1e293b;
  width: 40px;
  border-radius: 9px;
  font-size: 16px;
  cursor: pointer;
  font-weight: 700;
}
.aide-pied button:hover { background: #fbbf24; }

@media (max-width: 600px) {
  .visuels-grid { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); max-height: 240px; }
  .vcat { font-size: 11px; padding: 5px 8px; }
  .calque-actions button { width: 24px; height: 24px; font-size: 11px; }
  .calque-info b { font-size: 12px; }
  .btn-action { min-width: 110px; font-size: 12px; }
  .aide-btn { right: 14px; bottom: 14px; width: 50px; height: 50px; font-size: 22px; }
  .aide-panneau {
    right: 8px; left: 8px; bottom: 76px;
    width: auto; max-height: calc(100vh - 110px);
  }
}
