/* Canvas modal universel — accessible depuis V1 (legacy) et V2 (wizard). */

.canvas-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.canvas-modal[hidden] { display: none; }
.canvas-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.canvas-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.canvas-modal-shell {
  position: relative;
  width: 96vw;
  height: 96vh;
  max-width: 1600px;
  background: var(--surface, #1a1a1a);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
}

.canvas-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 0.5px solid var(--border, rgba(255, 255, 255, 0.08));
  flex-shrink: 0;
}
.canvas-modal-title {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text, #fff);
}
.canvas-modal-close-btn {
  background: transparent;
  border: none;
  color: var(--muted, #999);
  font-size: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.canvas-modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.canvas-modal-body {
  flex: 1;
  overflow: auto;
  position: relative;
  /* Le canvas V1 (editor-wrap) vit ici. Ses propres styles continuent. */
}

.canvas-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 20px;
  border-top: 0.5px solid var(--border, rgba(255, 255, 255, 0.08));
  flex-shrink: 0;
}
.canvas-modal-footer[hidden] { display: none; }
.canvas-modal-btn-secondary,
.canvas-modal-btn-primary {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  border: 0.5px solid transparent;
  transition: all 0.2s;
  font-family: inherit;
}
.canvas-modal-btn-secondary {
  background: transparent;
  border-color: var(--border2, rgba(255, 255, 255, 0.15));
  color: var(--muted, #999);
}
.canvas-modal-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}
.canvas-modal-btn-primary {
  background: var(--accent, #7C6FD6);
  color: white;
  border-color: var(--accent, #7C6FD6);
  font-weight: 500;
}
.canvas-modal-btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Mobile : plein écran, footer collé en bas */
@media (max-width: 768px) {
  .canvas-modal-shell {
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
  }
  .canvas-modal-header { padding: 8px 12px; }
  .canvas-modal-footer { padding: 8px 12px; }
  .canvas-modal-btn-secondary,
  .canvas-modal-btn-primary {
    padding: 8px 12px;
    font-size: 12px;
  }
}
